Vim Guide1
Vim Guide1
Press the <ESC> (escape) key to ensure youre in normal mode, then: :q! quits without saving :wq saves and quits (write quit) x deletes individual characters i inserts text dw deletes to the end of a word (d2w deletes two words, d3w deletes three words, etc.) d$ deletes to the end of a line dd deletes an entire line (2dd deletes two lines, 23dd deletes 23 lines, etc.) u undoes the last command U fixes an entire line <CTRL>R redoes the command p puts the last deletion after the cursor r replaces the character under the cursor cw is the change word command, that deletes the word (from the cursor to the right) and places you in insert mode c$ is the change line command, that deletes the line (from the cursor to the right) and places you in insert mode <CTRL>g shows your location in a file <SHIFT>G moves to the end of the file, [number]<SHIFT>G moves to the line number specified in the command, for example 1<SHIFT>G moves to line #1. /[search term] searches forward through a file for the search term. For example, /apache will search for the next instance of the word apache in the file ?[search term] searches backwards through a file for the search term. For example, ?apache will search for the last instance before the cursor of the word apache in the file :s/[old]/[new] will replace the next instance of old with new. For example, :s/blue/red will replace the next instance of blue with red. :s/[old]/[new]/g will replace the every instance of old on the current line with new. For example, :s/blue/red will replace the every instance of blue with red. :#,#s/[old]/[new]/g will replace every instance of old with new in the range of lines specified with the # sign. :! allows you to execute external commands :set nu turns on line numbering :nohlsearch turns off highlighting of search terms
2004, soundtraining.net All rights reserved.