I started using neovim and moved my .vimrc to .config/nvim/init.vim and other stuff is located in .local/share/nvim.

What is the best way to share configs or even plugins between vim and Neovim? Symlinks? Can I change the directories in the .vimrc to use only one symlink?

After migrating my vim config to Neovim's default location, this seems to work almost:

ln -s ~/.local/share/nvim/site ~/.vim 
ln -s .config/nvim/init.vim .vimrc

Some plugins (using using vim-plug) don't seem to work correctly. I can't load custom colorschmes nor vim-airline.

  • 1
    you can use if has('nvim') for nvim only commands – wizzup Jul 1 '17 at 12:04


You can use your existing ~/.vimrc, files, and plugins located within ~/.vim without having to symlink the files.

And this is now documented in NeoVim manual, see Transitioning from Vim.

The below lines will add the existing paths and ~/.vimrc file to your nvim setup.

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath=&runtimepath
source ~/.vimrc

For Linux and macOS, just add the above lines to the top of your ~/.config/nvim/init.vim, or %LOCALAPPDATA%\nvim\init.vim for Windows.

Credit goes to 👉 this

cheers 🍻


Having your config in Neovim's default location, do the following:

mkdir -p ~/.local/share/nvim/site
ln -s ~/.local/share/nvim/site ~/.vim 
ln -s .config/nvim/init.vim .vimrc

To fix the colorscheme I had to set to 256 terminal color mode, i.e. add this to your .vimrc (= init.vim) file, which will be ignored by nvim:

set t_Co=256  " Note: Neovim ignores t_Co and other terminal codes.

To get vim-airline I added the following snippet to .vimrc:

set laststatus=2

I don't quite understand why this is necessary only in vim and not in Neovim, but I am not the only one stumbling upon this thing.

  • 1
    This has always been necessary in vim. Probably nvim sets this as default and that's why it is working there. – Christian Brabandt Jul 1 '17 at 19:41
  • 1
    @ChristianBrabandt yes, of course you are right. – lumbric Jul 3 '17 at 23:23
  • I reckon commonly people will have ~/.vimrc located in the home folder, as the previous line pointing to ~/.vim. – Konrad Dec 12 '17 at 13:09
  • Better to follow the other answer, so that one can have nvim specific config, meanwhile sourcing ~/.vimrc as shared config. – ryenus Sep 18 '18 at 3:54
  • While Neovim ignores t_xx options, I'd argue that it's more correct to wrap something like that with if !has('nvim'), such as in this example. It may ignore them now, but what if that changes in the future? It also implicitly indicates that the option is related to Vim only. – ZeroKnight Sep 19 '18 at 7:27

You can use if has('nvim'). Here are complete examples:

Configuration only for Neovim:

if has('nvim')
        tnoremap <Esc> <C-\><C-n>

Configuration only for Vim

if !has('nvim')
    set ttymouse=xterm2

Another method is to link ~/.vim from ~/.config/nvim.

let g:is_nvim = has('nvim')
let g:is_vim8 = v:version >= 800 ? 1 : 0

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

After adding above settings into ~/.config/nvim/init.vim.

# relative symlinks
ln -sf ./init.vim ~/.config/nvim/vimrc
ln -sf ./.config/nvim ~/.vim

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.