I've used Vim for about 8 years, and I am trying gVim for the first time. What settings do you to be productive? What's in your gvimrc?
Note: gVim only. Vim stuff is quite well taken care of in:
The cream feature list is quite long. Pick any feature you find useful, especially GUI ones.
Wikipedia provides a short description:
Cream is a configuration of the Vim text editor that consists of a set of scripts which can be run within Vim to make it behave more like an editor now common to most personal computers which conform to the Common User Access standards of interface and operability.
Through pulldown menus, keyboard shortcuts, and extensive editing functions, Cream tries to make Vim more approachable for novice users and adds features for those more experienced. These are provided through Vim's extensibility, without any special customizations to Vim itself.
The biggest thing of use is having more of the <alt/metta + letter keys>
that actually work. I use <a-h>
and <a-l>
for tab left and tab right for example. I find it easy to put my thumb on the alt button, so its useful for remapping various slightly hard to reach motions.
Turn on a horizontal scrollbar (displayed at the bottom of the window):
:set guioptions+=b
This is useful when reading fixed-width data files with very long lines, if you turn off word wrapping (set nowrap
).
The first thing I did in gVim was to get rid of unnecessary UI elements:
if has('gui_running')
set guioptions-=T " Get rid of toolbar "
set guioptions-=m " Get rid of menu "
endif
The only value added is of course just more screen real estate.
autocmd GUIEnter * simalt ~ x " start maximized
Makes gVim start in maximized mode on Windows. Since gVim doesn't seem to have a "remember last used windows size", so I just opt for the "always maximize windows" startup option.
I've disabled my toolbar:
set guioptions-=T
I still like to keep the menu bar, because sometimes I use the Syntax menu. You can disable it if you prefer:
set guioptions-=m
I've also mapped F12 to toggle word-wrapping, and Shift+F12 to toggle horizontal scrollbar:
function ToggleWrap()
set wrap!
echo &wrap ? 'wrap' : 'nowrap'
endfunc
"F12 toggles wrap (Thanks to Alexandre Moreira)
nnoremap <silent> <F12> :call ToggleWrap()<CR>
vnoremap <silent> <F12> <C-C>:call ToggleWrap()<CR>
inoremap <silent> <F12> <C-O>:call ToggleWrap()<CR>
function ToggleHorizontalScrollbar()
"set guioptions+=b
if &go =~# "b"
set go-=b
else
set go+=b
endif
endfunc
function ToggleHorizontalScrollbar_setKeys()
"Shift+F12 toggles the horizontal scrollbar
nnoremap <silent> <S-F12> :call ToggleHorizontalScrollbar()<CR>
vnoremap <silent> <S-F12> <C-C>:call ToggleHorizontalScrollbar()<CR>
inoremap <silent> <S-F12> <C-O>:call ToggleHorizontalScrollbar()<CR>
endfunc
au GUIEnter * call ToggleHorizontalScrollbar_setKeys()
Following keystrokes/commands used specially in "C" files
Actually, I'm always using gVim. Hence I have access to many more key-bindings, see David's response, that I use to expand my code related manipulations.
My gvimrc does not contain much, just a mapping to toggle the size of gVim windows on MS Windows.
The only real impact I see is that I try to provide menus for the plug-ins I'm maintaining. I even have functions that define toggle-able/cycle-able menu items. Which is quite useful to have options in &Project menu like : "[x] compile in background", "new functions go to end-of-file/where-a-pattern-matches/..."