vimrc to be cross-platform and synced with Dropbox.

自作多情 提交于 2019-12-04 03:47:26

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!