I have been a happy Dropbox user for a while now. I try to link whatever possible to it like:
- Visual Studio settings
- PowerShell modules
- Resharper mounted live template file
Until today I was still copying my vimfiles back and forth though.
So I finally took the time to investigate how to point the vim runtimepath to a folder of my choice.
Turns out there are two ways to do this:
- Point the vim runtime path to a folder in your dropbox
- Create a link from your local vimfiles folder to the vimfiles folder in your dropbox
Point the vim runtime path to a folder in your dropbox
In this case vim itself (‘:help runtimepath’) was more helpful than stackoverflow and google.
This stackoverflow answer maybe useful to others, but in my case I never could get the printf() statemtent to work and I also would like to start vim without specifying the path every time.
As I said, the help helped (npi) and after a bit of experimentation I came up with this solution.
to my .vimrc file.
Note that for Windows the dropbox folder is called ‘My Dropbox’ and therefore you need to escape the space like so:
set runtimepath=~/Dropboxes/Gmail/My\ Dropbox/Settings/vimfiles,$VIM,$VIMRUNTIME
Now I could remove my .vim folder (vimfiles on Windows ) from my HOME directory and am picking up all my plugins, syntax highlighters, etc. directly from the given vimfiles folder inside my Dropbox.
Only the .vimrc file has to stay were it is and will have to be synchronized among my computers since something has to do the pointing.
Create a link from your usual vimfiles folder to the vimfiles folder in your dropbox
I found a great explanation on how to do this on different operating systems.
Here is an example on how to do this on Windows:
- Make sure that all your vimfiles have been copied to your Dropbox folder.
- Remove the vimfiles in you HOME directory.
- Launch cmd.exe and use mklink to create a link from ~/vimfiles to the vimfiles in your dropbox e.g.:
mklink /D "c:\Users\yourusername\vimfiles" "C:\Users\yourusername\My Dropbox\Settings\vimfiles"
- Optionally do the same for your .vimrc file (I actually link it to a window specific one, because I use a different font for each OS):
mklink "c:\Users\yourusername\.vimrc" "C:\Users\yourusername\My Dropbox\Settings\.vimrc_windows"
In this case you need to make sure to not directly edit the local .vimrc as this will overwrite the link you created. Instead edit the .vimrc inside your Dropbox folder.
Both solutions allow me to extend my vim, for all my machines in one shot.