Robert Hicks wrote:
A.J.Mechelynck wrote:
Robert Hicks wrote:
I have never used a gvimrc. Does that get parsed by gVim only?
:Robert
Yes indeed. It is guaranteed to be sourced when gvim starts and not
when console Vim starts; and in gvim it is sourced later than the
vimrc in startup. Me I don't use a gvimrc either: rather than
maintain two different startup files, I put everything in my a vimrc,
with, when needed, constructs like the following:
if has("gui_running")
" any code here affects gvim but not console vim
else
" any code here affects console vim but not gvim
endif
This implies that I'm not going to start vim as the console version
and later type ":gui" to turn it into a GUI display. This isn't much
of a limitation, considering how I start Vim (and anyway on Windows
each Vim executable is either a console version or a GUI version but
not both).
Best regards,
Tony.
Thanks Tony, I guess my next question is "how do I know?". How do I
know what commands are only going to to affect gvim? I guess I have to
look them all up?
:Robert
In some cases it's rather obvious; for instance:
'guifont' cannot be used in console Vim because it cannot change the
font face. (In addition, it has 4 different formats for different
"flavours" of gvim; but that's off-topic for this thread.)
'guicursor' can be used in _all_ GUI versions and in _some_ console
versions, but it must be used differrently in both, because the GUI can
have a vertical, horizontal or block cursor while in the console version
the cursor is always full-width (but can sometimes be part-height).
the GUIEnter autocommand is not available in console Vim.
'lines' and 'columns' can be changed in all GUI versions AFAIK, but
they may or may not be changed in a console terminal depending on what
terminal you're running in (for instance, the "hardware text console",
which is always full-screen, has only a few lines/columns combinations,
and I don't know if Vim can change from one to another).
Other commands can be used identically in both but with different
results; for instance, the ":colorscheme" command usees the term=
arguments of the colorscheme's ":highlight" lines in B&W consoles (if
they still exist), the cterm= ctermfg= ctermbg= in colour consoles, and
gui= guifg= guibg= in the GUI. I can imagine that you may prefer one
colorscheme in gvim and another one for a color-xterm.
And when you hesitate, lookup the help: for instance the help on an
option (something set by a ":set" ":setlocal" or ":setglobal" command)
is under the option name in single quotes, as you probably know. Or if
you get an error in console Vim, it may alert you to the fact that you
didn't know that an option was "GUI only" (or that it could be "left
out" at compile-time in some other way).
Best regards,
Tony.