Press Ctrl-v to start a VISUAL BLOCK
Move the cursor (up/down arrow key) to expand the block
Press I (Shift-i) to start insert.
Type in the character(s) that you want to insert, such as #, or //.
Press ESC to leave the visual block.
Showing posts with label vi. Show all posts
Showing posts with label vi. Show all posts
Friday, December 30, 2011
Tuesday, December 6, 2011
Global search in vi and list results
We use the simple command to search a pattern (or a fragment of text),
:/{pattern}
Sometimes, there would be a few dozens of matches that you want to list and browse quickly. Use this command,
:g/{pattern}
It lists the search results in one buffer. If you want to search the pattern case insensitive, add \c in the command, like
:g/\c{pattern}
Subscribe to:
Posts (Atom)