Find out vim executable name inside vimrc

前提是你 提交于 2019-12-25 06:00:01

问题


I share my ~/.vimrc file between different computers and use it with three different vims (macvim in mac, gvim in my Ubuntu desktop and plain old vim in the servers which I manage)

Most of what I have in my ~/.vimrc file applies to all three instance, but I want to make some small changes based on which vim I am using (like removing certain plugins when invoked vim from console)

My question is how do I distinguish different vim executables in my ~/.vimrc, so that I can have different settings for different vim's?


回答1:


I, too, use the same config in different environments. This is what I have in my 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


来源:https://stackoverflow.com/questions/17018416/find-out-vim-executable-name-inside-vimrc

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