I have one folder synced between two computers (using one of online sync tools). I have gVim installed in this folder and I am wondering, is there a way, that I can distinguish those two computers in .vimrc file?
I know that testing with
if has("win32")
...
elseif has("macunix")
...
endif
I can check different operating systems - but is there an similar function/variable to test ie. name of the PC on which gVim is running?
I will also mention, that both PC's are running Windows XP.
On CentOS 7 and RHEL 7, the system wide configuration file for Vim is in /etc/vimrc. You can also do user specific configuration of Vim. All you have to do is to create a . vimrc file in the HOME directory of the user than you want to configure Vim for and add the required Vim configuration options there.
Vim's user-specific configuration file is located in the home directory: ~/. vimrc , and Vim files of current user are located inside ~/. vim/ . The global configuration file is located at /etc/vimrc .
vim/ directory ($HOME/vimfiles/ for MS-Windows). That makes it easy to copy it to another system.
vimrc using vim. In vim, add the commands that you know you want to put in, then type :wq to save the file. Now open vim again. Once in vim you can just type: :scriptnames to print a list of scripts that have been sourced.
There is a vim builtin routine named hostname() to get the host machine's name.
As an additional tip you can store your vimrc file on the net and load it (you may break down its functionality by hostname() as outlined above.
fu! gNetVimrc(hhtpvimrc)
source $VIMRUNTIME/plugin/netrwPlugin.vim
Nread a:*hhtpvimrc*
let tf = tempname()
save! tf
source tf
delete(tf)
ene
endf
Add this to your .vimrc on all computers you want to share the vimrc file for
:call gNetVimrc("http://www.mydomain.com/myvimrc")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With