navigating, changing text:
^f ^b/ * forward, scroll back a full screen */
^d ^u/ * forward, scroll back half screen */
Z/ * Move the cursor to the top of the screen and roll the screen */
Z. /* Move the cursor to the middle and roll the screen */
/* Move cursor only */
H/ * Move to line at top of screen */
M/ * Move to middle of screen */
L/ * Move to bottom of screen */
NH/ * Move to the top down nth line */
{}/ * Move forward, move back a section */
[[]]/ * Move to current, beginning of next section */
Search, replace:
N/ * Forward repeat search */
N? / * Back to repeat search */
/pattern/ * Forward search pattern */
? pattern/ * Back to search pattern */
: 1,30s/his/the/g/ * Replaces all of his 1-30 rows with the */
: 1,30S/HIS/THE/GC/ * Confirm Replacement */
Show line number:
:Set nu
: Set Nonu
: 1,10#/ * Displays line number 1-10 */
:. =/ * Displays the current line line number */
: =/ * Displays the total number of files */
:/pattern/=/ * Displays the line number when the pattern first appears */
To delete a row:
: 1,10d/ * Delete 1-10 lines */
:/pattern/d/ * Delete the line containing the pattern */
Open, close, read in, write:
+n File/* Open files on nth line */
+ File/ * To open files in the last line */
+/pattern File/* Opens the document where the first pattern appears */
-C command File/ * Executes commands after opening the file */
: w/ * Save File */
: X/ * If updated, save file */
ZZ/ * Save and close the file */
: R/home/tim/data/ * reads data into the next line of the cursor */
: $r Data/ * reads data into the end of file */
:., 60w newfile/ * Writes the cursor line to line 60th to NewFile */
: 1,10w >>newfile/ * Append 1-10 lines to NewFile */
Command:
. /* Repeat last Command */
VI Common Commands