Thursday, 9 August 2012

vim oh how I love thee

every day I get to love it more and more...

my favourite .vimrc line is, by a million miles:

imap jj <esc>

i also like this one:
" make f6 do an inner select on here docs:
nmap <F6> ?<<<<CR>w*kV?<<<<CR>j

This finds all lines containing word and adds them to a file:

:g/word/.w!>>filename

sort (unique) a range (as with all things works in visual mode too!):

:1,16sort u


but note to self must add these to my vimrc:

" Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk

" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l

No comments:

Post a Comment