parsed.org

Tips by tag: gvim

Gvim Configuration by xinu on Apr 23, 2008 07:52 AM

On a new windows install I'll always drop in these entries for startup configuration:

" general settings
set sw=4
set ts=4
set et
set nohls

" lhs comments
map ,# :s/^/#/<CR>
map ,/ :s/^/\/\//<CR>
map ,> :s/^/> /<CR>
map ," :s/^/\"/<CR>
map ,% :s/^/%/<CR>
map ,! :s/^/!/<CR>
map ,; :s/^/;/<CR>
map ,- :s/^/--/<CR>
map ,c :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR>

" wrapping comments
map ,* :s/^\(.*\)$/\/\* \1 \*\//<CR>
map ,( :s/^\(.*\)$/\(\* \1 \*\)/<CR>
map ,< :s/^\(.*\)$/<!-- \1 -->/<CR>
map ,d :s/^#//<CR>

" screen location & dimensions
winpos 50 50
set lines=30
set columns=120

" squirrel away backup files
set bdir=c:/backups
set directory=c:/backups

Note: You'll need to create the backup folder before you can use it.

gvimvimvimrc

Inserting a control character in vi(m) on Linux is a simple case of pressing Ctrl+V and then pressing your control character. Windows insists on pasting with a Ctrl+V, so you do the following:

test
controlgvimpastewindows
VIM Positioning by xinu on Jun 14, 2008 09:26 PM

If you've got a file open in vim, try the following shortcuts in command mode:

z. = center on current line
zt = make current line the top line
zb = make current line the bottom line
gvimvim
RSS