Wednesday, September 15, 2010

Vim stuff

TAB completion

The following lines should be added to .vimrc and .gvimrc to make vim's auto-completion work just like bash:

set wildmode=longest,list
set wildmenu

Text width

Vim does not break text into lines automatically. This is good for programming, but not so much for documents. To make vim break the text into lines set the textwidth property:

set textwidth=70

When you do that, vim will apply the property to the current text. If you want to set the property for the entire document go to the top, enter gq, and then go to the bottom:

gg
gq
G

The gq command applies the format to a text segment marked by 'movement'.


Working with tabs

Edit file in a new tab:

:tabe

Next and previous tab:

gt
gT

Bookmarks:

Mark position
: m {a-z}

Return to marked position
: ' {a-z}

Return to previous position
: ' '

Editing remote files:
tabe scp://hostname//path/to/file
or
vim scp://hostname//path/to/file

No comments:

Post a Comment