这里的方法尝试符号链接~/.config/nvim
到~/.vim
,并使conf与兼容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
设置完成后,~/.config/nvim/init.vim
是将实际文件用作conf。~/.vim/vimrc
只是一个链接。
现在,我们需要通过更改和来vim
使用复用器nvim
的插件管理器。实际上,插件路径会自动重用,以下修复方法是重用插件管理器。runtimepath
packpath
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
资料来源:在vim和nvim之间共享confs
if has('nvim')
只能将命令用于nvim