On 2015-03-01, Tim Chase wrote: > On 2015-03-01 15:37, Bao Niu wrote: > > I have a quick question here: > > Is it safe to move everything from .vimrc to .gvimrc, or vise > > versa? Is there any particular command that can only be executed in > > one file but not the other? e.g. colorscheme? > > Commands in the gvimrc won't get executed if you invoke (non-g)vim. I > seem to recall that direct gvim-related commands don't work if put in > just the vimrc. You can trigger them with an autocmd, so I've seen > folks do things like > > autocmd GUIEnter * set guioptions-=t > > in a single vimrc, so that when the GUI fires up, those commands get > executed. That allows you to have one vimrc and then set those > GUI-specific options when the GUI fires up. > > That said, I just have a vimrc for most settings, and a gvimrc for my > few GUI-specific ones.
It's not that GUI-specific options have to be put in ~/.gvimrc, it's that options that need to be set after Vim has started the GUI have to be put in ~/.gvimrc (or in a GUIEnter autocommand). For example, you can set 'guifont' and 'guioptions' in your ~/.vimrc; but you should set your :colorscheme in ~/.gvimrc or with a GUIEnter autocommand because Vim won't know the background color of the GUI until it starts the GUI. In my case, I put everything in my ~/.vimrc file and use GUIEnter autocommands to execute those few commands I've discovered have to be executed after the GUI starts. I use both vim and gvim, but primarily vim as it is much easier to integrate with shell commands. Regards, Gary -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
