Repost from stackoverflow after suggestion
I am trying to move from vim to neovim. I have a strange problem.
I have, in my .bashrc, exported $VIMINIT to .config/vim/vimrc
so that vim files like .viminfo
are not polluting my home folder. This trick was suggested in stackoverflow and if I remember correctly, it was only thing that actually removed all .vim*
files out of my home directory.
But neovim also seems to give priority to $VIMINIT over its own config folder. I cloned lunarvim as .config/nvim and upon launching neovim, it wasn't using it. Only after I commented out the export statement from my bashrc file, it detected its config folder.
I don't want to remove my well tested vim setup without getting comfortable with neovim first. What is a safe and appropriate way to separate neovim and vim? I want to have .config/vim and .config/nvim as config location for settings and generated junks respectively and not have any related dotfiles in home folder.
Update: Based on @martin-tournoij suggestion, currently this is setting in my viminit proxy file
let g:nvim_path='~/dotfiles/editors/nvim'
let g:vim_path='~/.config/vim'
if has('nvim')
" let g:runtimepath += '~/.config/nvim/'
execute 'set runtimepath+=' . g:nvim_path
execute 'set packpath+=' . g:nvim_path . '/plugins'
execute 'source '. g:nvim_path . '/init.lua'
finish
else
execute 'source '. g:vim_path . '/vimrc'
finish
endif
Any suggestion to improve this?
VIMINIT
anywhere. That said,VIMINIT
is "used as an Ex command line", so you could just check for Neovim in it and source a different file. Or you could write a wrapper for neovim:nvim () ( unset VIMINIT; nvim "$@"; )
oralias nvim='env -u VIMINIT nvim'
.VIMINIT
blocks, say, vimrc files (:help VIMINIT
). A better solution might be to use-i
or set'viminfofile'
if that was your only concern. (There's also'undodir'
,'directory'
,'backupdir'
, etc.)