views:

157

answers:

3

I'v been using vim/gVim so far in my Linux Machine, and I have a Windows machine as well. In this windows machine I'm mainly notepad++.

I would like to store all my .vimrc settings and .vim folder in Dropbox, and create symbolic links in Linux pointing to them, and them do the same in my Windows machine.

I have plenty of "home shortcut notation" (don't if this is the correct name) ~ in my configuration, and would like to know if writing down for example $HOME instead of ~ it's going to work: this way, I can create some symbolic links in Windows as well that points to these files (I'm using Windows 7, so my home is c:\Users\username).

Any other pitfalls or recommendations when creating vimrc cross-plataform with Dropbox?

+2  A: 

That's exactly what I do, and it works like a charm for me. The only place I use $HOME instead of ~ is for the backup directories, but that works fine. The main problem I run into is that editing the .vimrc file on Windows never works quite right, so I just edit it on OS X instead.

kejadlen
Not exactly like a charm since I needed to create a lot of symlinks, but in the end it worked well. Not flawlessly because of the .vimrc problem (I can't edit from windows because it keeps me saying my file c:\users\user/.vimrc doesn't exist), but I can live with it. :) This is a minor problem when I thought about creating different vim configuration files each time I want to use them cross-plataform...
Somebody still uses you MS-DOS
+1  A: 

If you use vim from within Cygwin, you can easily distinguish the platform inside the .vimrc file like this:

let s:sys=system('uname -s | perl -pe "chomp"')
if s:sys == "Linux"
  " do Linux stuff here
endif

and similar for s:sys == "Cygwin_NT". If you're using a natively compiled vim under Win, e.g., Gvim, you'll have to find another system call, that is understood by both your Linux shell and the Win cmd.

Boldewyn
I dont have too much specific plataform customizations in my vim/gVim, I was more interested in keeping them in sync, so if I change something at work it would be available at home.
Somebody still uses you MS-DOS
+2  A: 

I do a bunch of customization of my .vimrc, but it's all based on capabilities, rather than platform.

I check for the different has("gui_*") flags, and also check has("unix"). This way I avoid dealing with messy platform dependent path issues.

Bryan Ross
This is already being done, thanks for the suggestion anyway. What I would like is to edit a config here at work and be available at home.
Somebody still uses you MS-DOS