Monday, April 30, 2007

VIM tips

Seven habits of VIM

Habit 1: Moving around quickly

/argc n, n, n ... => : set hlsearch *
=> Put :set hlsearch in .vimrc; use * again again

Habit 2: Don't type it twice.
type XpmCreatePixmapFromData() => type CTRL-N on word (word completion)

Habit 3: Fix it when it is wrong.
mis-spell => :iabbrev teh the
:syntax keyword WordError teh

Habit 4: A file seldom comes alone.
:!ctags -R
:tag init
:tnext
:grep "\" **/*.h <- search
:cnext

or gf => Go to file on header file names (work for http)
=> make sure the path option is set correctly.

[I => find the word under cursor to include files.
[ => Jump there.

Habit 5: Let's work together
Working with MsWord
=> set Vim with :set tw=0; wrap linebreak

Copy the text between app and Vim through clipboard.

No comments: