0

我在不同的计算机之间共享我的~/.vimrc文件,并将它与三个不同的 vim 一起使用(mac 中的 macvim,我的 Ubuntu 桌面中的 gvim 和我管理的服务器中的普通旧 vim)

~/.vimrc文件中的大部分内容都适用于所有三个实例,但我想根据我使用的 vim 进行一些小的更改(比如从控制台调用 vim 时删除某些插件)

我的问题是如何区分我的不同 vim 可执行文件~/.vimrc,以便我可以为不同的 vim 设置不同的设置?

4

1 回答 1

2

我也一样,在不同的环境中使用相同的配置。这就是我的vimrc

let os = substitute(system('uname'), '\n', '', '')

if has('gui_running')
  " generic GUI settings go here

  if os == 'Darwin' || os == 'Mac'
    " MacVim-specific settings go here

  elseif os == 'Linux'        
    " GVim-specific settings go here

  endif

else      
  " generic CLI Vim settings go here

  if os == 'Darwin' || os == 'Mac'        
    " Mac OS X-specific CLI Vim settings go here

  elseif os == 'Linux'
    " Linux-specific CLI Vim settings go here

  endif

endif
于 2013-06-10T07:44:23.503 回答