简体   繁体   中英

Find out vim executable name inside vimrc

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM