The goal of flatnvim is to make it easy to use Neovim's
terminal emulator.
When you open files from within the Neovim terminal, flatnvim will automatically add them
to the current instance instead of creating a new nested one.
Now you can easily use all your favorite command line programs inside Neovim.
You'll first need the flatnvim binary on you system.
git clone https://github.com/adamtabrams/flatnvim.git
cd flatnvim
./build.shThere are 4 environment variables flatnvim can use.
Add them to the config file for your shell (.bashrc, .profile, .zprofile, etc).
export FLATNVIM_EDITOR="nvim"- When
flatnvimis called from your regular terminal, it will just pass arguments to this editor.
export EDITOR="$HOME/repos/flatnvim/bin/flatnvim"- If you don't know what this should be, use the path printed by the build.sh script.
- In addition, you can make an alias to
flatnvim:alias vim="$EDITOR
export FLATNVIM_LOGFILE="$HOME/repos/flatnvim/log.txt"- If this is not set, any error messages are just printed.
export FLATNVIM_EXTRA_COMMAND="echo 'it works' | sleep"- Just in case you want
flatnvimto do something extra before it opens files in the parent instance.
autocmd TermOpen * setlocal laststatus=0 noshowmode noruler
\| autocmd TermClose * setlocal laststatus=2 showmode ruler
autocmd TermClose * if !v:event.status | exe 'bdelete! '..expand('<abuf>') | endifautocmd TermLeave * AirlineRefreshAdding this function to your Neovim config makes it easier to access the terminal and specific command line programs.
function! TempTerm(...)
let command = get(a:, 1)
exe "terminal ".command
return ""
endfunctionnnoremap <silent> gt :call TempTerm(" ")<CR>
nnoremap <silent> gL :call TempTerm("lazygit")<CR>
nnoremap <silent> gl :call TempTerm("lf")<CR>