0

I have been using vim for a while on Arch Linux and decided to make a shift to Neovim. It's mostly working fine. The vimrc is sourced and thus all my configuration files and plugins are working fine, but neovim is not sourcing my ftplugin files.

Here is a screen shot of relevant info about neovim on my system:

nvim.png

The ftplugins were working fine in regular vim - I have them in ~/.vim/after/ftplugin/ but the custom keybindings and abbreviations I have in my filetype files (such as python.vim) are just not being sourced.

3

$HOME/.config/nvim is a 'runtimepath' in Neovim. $HOME/.vim is a 'runtimepath' in Vim. You're making the mistake of thinking that their relative location to the init.vim or .vimrc matters.

This is what you should do if you want the configs to work for Vim and Neovim:

mv ~/.vim ~/.config/nvim
mv ~/.vimrc ~/.config/nvim/init.vim

Obviously, you should reconcile your files/links before doing the above.

Then create a new ~/.vimrc file and add this to it:

let &rtp = '~/.config/nvim,'.&rtp
source ~/.config/nvim/init.vim

This turns ~/.vimrc into a shim for loading configs from ~/.config/nvim. The bonus is that you have one less directory in your home.

The opposite can be done in ~/.config/nvim/init.vim:

let &rtp = '~/.vim,'.&rtp
source ~/.vimrc

You could also just use symlnks:

ln -s ~/.vimrc ~/.vim/init.vim
ln -s ~/.vim ~/.config/nvim

I think using a shim script is cleaner, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.