The post was created for the question How to share config between vim and Neovim.
In this solution, we try to symlink
~/.vim, and make the conf compatible with
# nvim conf dir: ~/.config/nvim # vim conf dir: ~/.vim # link the 1st as the 2nd with relative links # Prepare a vimrc file in ~/.config/nvim folder ln -sf ./init.vim ~/.config/nvim/vimrc # Link the whole ~/.config/nvim folder as ~/.vim foler ln -sf ./.config/nvim ~/.vim
After this setup,
~/.config/nvim/init.vim is the real file used as conf.
~/.vim/vimrc is just a link to it.
Now we need to make
nvim's plugin manager, plugins, by changing
packpath. In fact, the plugin paths are reused automatically, the following fix is reusing the plugin manger.
let g:is_nvim = has('nvim') let g:is_vim8 = v:version >= 800 ? 1 : 0 " Reuse nvim's runtimepath and packpath in vim if !g:is_nvim && g:is_vim8 set runtimepath-=~/.vim \ runtimepath^=~/.local/share/nvim/site runtimepath^=~/.vim \ runtimepath-=~/.vim/after \ runtimepath+=~/.local/share/nvim/site/after runtimepath+=~/.vim/after let &packpath = &runtimepath endif