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.

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

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

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

Credit goes to 👉 vimcast 71 : Meet Neovim


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

The method here tries to symlink ~/.config/nvim to ~/.vim, and make the conf compatible with vim.

# 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 vim reuse nvim's plugin manager, plugins, by changing runtimepath and 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

Source: Share confs between vim and nvim


Just to add to ipatch answer, which is the correct answer, if you have a slightly different setup from Vim you might need to adapt the path.

For example, on Windows, rather than using the default configuration with:


I am using:


(The reasons is that is it easier to put a single directory under revision control than a file and a directory, particularly when the file is at the root of your home directory)

The following works for me then:

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

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.