Friday, March 13, 2009

vi editor tricks

R replace mode
ESC normal mode
CTRL-g show filename, current location in the file and status
SHIFT-g goto the end of file

:set ic search ignore cases
de delete to the end of word
dw delete to the end of word+space
d$ delete to the end of line
d^ delete to the begin of line

CTRL-R redo the last command

:r filename insert the contents of the file
:!command execute external command

1 comment:

Anonymous said...

"CTRL-R redo the last command" is not vi, that is vim.

POSIX states that ^R redraws the screen.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html

^[:version may clear things up for you.