A simple tool that prevents nested Neovim instances
GPL-3.0 License
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.sh
There are 4 environment variables flatnvim
can use.
Add them to the config file for your shell (.bashrc, .profile, .zprofile, etc).
export FLATNVIM_EDITOR="nvim"
flatnvim
is called from your regular terminal, it will just pass arguments to this editor.flatnvim
binary as your default terminal editor.export EDITOR="$HOME/repos/flatnvim/bin/flatnvim"
flatnvim
: alias vim="$EDITOR
flatnvim
to use.export FLATNVIM_LOGFILE="$HOME/repos/flatnvim/log.txt"
export FLATNVIM_EXTRA_COMMAND="echo 'it works' | sleep"
flatnvim
to 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>') | endif
autocmd TermLeave * AirlineRefresh
Adding 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 ""
endfunction
nnoremap <silent> gt :call TempTerm(" ")<CR>
nnoremap <silent> gL :call TempTerm("lazygit")<CR>
nnoremap <silent> gl :call TempTerm("lf")<CR>