What should I write in my .vimrc
file to test whether I am running vim or gvim.
Because the colorscheme I like very much is beautiful in vim, but is ugly in gvim. So I want it that when I am in vim, I use this aforementioned colorscheme, and when I am in gvim, use another colorscheme.
Is there any vimscript code can implement this function?
You can set your preferred color scheme in gvim for MS Windows by editing the file _vimrc in C:\Program Files\Vim or the location where you installed Vim. Save the file and start gvim you will see your color scheme.
In Ubuntu make a file with the name . vimrc in your Home directory if it doesn't exist, add colorscheme pablo in it and save it. Now restart GVim. For Windows put this file with the name _gvimrc in C:/Documents and Settings/<your-username> .
View preinstalled color schemes Some color schemes are already installed on your system. You can find those color schemes in the /usr/share/vim/vim*/colors directory as . vim extension.
The ctermfg=white is used to set the foreground color to white in a terminal text editor. Finally, the ctermbg=black is used to set the background color to black in a terminal text editor.
These two pages have a lot of info on color schemes and how to switch them: http://vim.wikia.com/wiki/Switch_color_schemes http://www.indelible.org/ink/vim-colorschemes/
It also features the issue you have:
if has('gui_running')
" GUI colors
colorscheme foo
else
" Non-GUI (terminal) colors
colorscheme bar
endif
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