Glynn Foster wrote:
set matchpairs+=<:>
Awesome, didn't know that one. The vim help files aren't organised in the most
logical
manner.
Keep track of where you were
============================
In normal mode, you can leave a mark at any cursor position. Just type m<char>.
For example,
mh
Then to go back to that mark, you type a backtick: `<same char>
That is
`h
Or, to go to the start of the line containing the mark, type a single quote
'<same char>
'h
If you use a lowercase letter, the mark is per-buffer. If you use an uppercase
letter, the mark is global. You can see all marks you've set by typing
:marks
Copying delimited objects
=========================
To copy the entire {} block the cursor is in: yab or ya{
To copy the entire [] delimited text the cursor is in: ya[
To copy the entire () delimited text the cursor is in: ya(
You can combine these 2.
Set the cursor somewhere, drop a mark (i.e. ma), then shift cursor somewhere
else yank it
(i.e. y`a, or more usefully, "ay`a, yank into buffer a, all from current position to mark
"a").
This is very useful when editing multiple, similar files (when code re-use
isn't perhaps as good
as it could be). "aP or "ap to paste buffer "a" back. I believe there are 27
buffers, more than
enough.
My personal ~/.vimrc file contains -
set textwidth=80
set softtabstop=4
set expandtab
set shiftround
I like
set sm
set ts=4
set sw=4
set ai
map! {{ { ^M}^[O
set backupdir=~/tmp
and a bunch of other code formatting macros.
Cheers, Rex