问题
I am trying to start using a vim plugin management tool to manage my vim plugins, like vundle, and I have multiple hosts and want them syncing with vim settings. currently I am checking the .vim dir into a git repo. but I don’t want to check in all plugins as they belongs to others. Wonder what would be the best practice if I use the plugin management tool to keep them sync without checking in plugins code
回答1:
if you used plugin mgmt, like vundle, you don't have to push your .vim dir to git repo. You just push your .vimrc file to git. Because vimrc should have already configured vundle and declared which plugins you want to have.
What you can do on a new host:(assume you put vundle to $HOME/.vim/Bundle
)
pull your .vimrc file from git repo
get vundle:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Then open vim, run
:PluginInstall
. You have all plugins.
回答2:
I recently came across the exact same problem regarding the sync between my laptop and my desktop workstation. Like Kent I already used the Vundle.vim plugin manager on both machines but had the need for a more comfortable sync solution for my vim setup than only syncing my ~/.vim/vimrc
between both machines and run :PluginInstall
on the other machine each time I add a plugin.
My solution now is that I use Syncthing that is configured to directly sync my ~/.vim
folder between both machines to each other as soon changes happen.
The only downside of this solution is that both machines need to be running to sync changes. But I handle this with my little homeserver which's also configured in the sync-chain and provides the latest version of my ~/.vim
directory to each of the machines when the other one is not running.
Let me know if you need any further details about the configuration settings.
来源:https://stackoverflow.com/questions/41232925/vim-what-the-best-practice-to-sync-up-all-plugins-on-multiple-hosts