bgcolor="#abcdef" text="#000000"> silly vi tricks ____________________

Silly vi tricks
xp This will delete the character under the cursor, and put it afterwards. In other words, it swaps the location of two characters. ddp Similar to xp, but swapping lines. yyp duplicate a line uu Undo and redo last change. (This will take you to the last modification to the file without changing anything.) You can also use this to compare the changes to a line. Make the changes to the line, press U to undo the changes to the current line, and then press u to toggle between the two versions.
Silly macros
Note: <crtl-x> mean hold down control, and hit x. Swap character and one vertically above: map * kxjphxkP Fold a line that's too long map g $80<ctrl-v><ctrl-v>|F r<ctrl-v><enter> Change case on most words map v ywmno<ctrl-v><esc>P:s/./\~/g<ctrl-v><enter>0"nDdd`n@n Put `and' around the current word map *` i`<ctrl-v><esc>ea'<ctrl-v><esc> Put 'and' around the current word map *' i'<ctrl-v><esc>ea'<ctrl-v><esc> Put "and" around the current word map *" i"<ctrl-v><esc>ea"<ctrl-v><esc> Put `and' around the current word map! `` <ctrl-v><esc>bi`<ctrl-v><esc>ea' Split a line at the cursor, and put a > at the beginning of the next line. (For quoting Usenet, etc). If word wrapping is enabled, it might wrap the last word on the first line. map g may0O<ctrl-v><esc>P`ay$:s/./ /g0i><ctrl-v><esc>`aPa<ctrl-v><esc>D Insert one character map g i$^[r Format a paragraph without the fmt program. (To use, use J a few times, then this a few times) map K 072lBhr Make ctrl-x work as cut, ctrl-v as paste, ctrl-p as copy. You should mark the beginning of the area as m (use mm). (ctrl-c cannot be remapped) map <ctrl-v><ctrl-x> "zd`m map <ctrl-v><ctrl-p> "zy`m map <ctrl-v><ctrl-v><ctrl-v><ctrl-v> "zP Save a read-only file. Careful, it changes the permisions. map K :!chmod 666 %<ctrl-v><enter>:w!<ctrl-v><enter><ctrl-v><enter> vi status line (sort of...) [Note: It's slow...] map <ctrl-v><up-arrow> k<ctrl-v><ctrl-g> map <ctrl-v><down-arrow> j<ctrl-v><ctrl-g> map k k<ctrl-v><ctrl-g> map j j<ctrl-v><ctrl-g> map <ctrl-v><ctrl-f> <ctrl-v><ctrl-f><ctrl-v><ctrl-g> map <ctrl-v><ctrl-b> <ctrl-v><ctrl-b><ctrl-v><ctrl-g> map H H<ctrl-v><ctrl-g> map M M<ctrl-v><ctrl-g> map L L<ctrl-v><ctrl-g> map G G<ctrl-v><ctrl-g> map <ctrl-v><ctrl-u> <ctrl-v><ctrl-u><ctrl-v><ctrl-g> map <ctrl-v><ctrl-d> <ctrl-v><ctrl-d><ctrl-v><ctrl-g> center a line map = 80I <ctrl-v><esc>$78hd0:s/ / /g<ctrl-v><enter>$p redefines tab so that it inserts 5 spaces instead of a tab marker map! <ctrl-v><ctrl-i> <space><space><space><space><space> switch current and last line (repeat to reverse a file) map v Gdd''Pj