-- INSERT --
at the bottom of the screen).
When you are done editing the text, you can press Esc
key to return to console mode state.i |insert text, before the cursor, until the user press <esc> a |insert text, after the cursor, until the user press <esc> I |insert text, at the beginning of the current line, until the user press <esc> A |insert text, at the end of the current line, until the user press <esc> o |insert a new line below the current line, insert text, until the user press <esc> O |insert a new line above the current line, insert text, until the user press <esc>
r |replace the character under cursor with another character R |replace many characters, starting with the character under cursor, until the user press <esc> cw |replace the word, starting with the character under cursor, until the user press <esc> c{n}w |replace {n} words, starting with the character under cursor, until the user press <esc> (c3w: replace 3 words) C |replace the remainder of the line, starting with the character under cursor, until the user press <esc> cc |replace the current line, until the user press <esc> {n}cc c{n}c |replace {n} lines, starting with the current line, until the user press <esc>
x |delete the character under cursor {n}x |delete {n} characters, starting with character under cursor (3x: delete 3 characters) dw |delete the word, starting with the character under cursor d{n}w |delete {n} words, starting with the character under cursor (d3w: delete 3 words) D |delete the remainder of the line, starting with the character under cursor dd |delete the current line {n}dd d{n}d |delete {n} lines, starting with the current line (3dd: delete 3 lines)
yy |copy the current line to the clipboard {n}yy y{n}y |copy {n} lines, including the current line, to the clipboard (3yy: copy 3 lines) p |insert text from the clipboard after the current line
u |undo last modification
/{pattern} |Search forward in the file for the occurrence of the string (/foo: search for the string "foo") ?{pattern} |Search backward in the file for the occurrence of the string n |Search forward in the file for the next occurrence of the string N |Search backward in the file for the previous occurrence of the string
j <return> <down arrow> |move the cursor down one line k <up arrow> |move the cursor up one line h <delete> <left arrow> |move the cursor one character to the left l <space> <right arrow> |move the cursor one character to the right 0 |move the cursor to the beginning of the current line $ |move the cursor to the end of the current line w |move the cursor forward to the beginning of the next word b |move the cursor backward to the beginning of the preceding word :0 <return> 1G |move the cursor to the first line :n <return> {n}G |move the cursor to the {n} line :$ <return> G |move the cursor to the first line
<control>f |move down one screen <control>b |move up one screen <control>d |move down one half screen <control>u |move up one half screen <control>l |redraw the screen <control>r |redraw the screen, removing deleted lines
:.= <return> |show the current line number at the bottom of the screen := <return> |show the total number of lines at the bottom of the screen <control>g |show detailed information (current line number, total number of lines, ...) at the bottom of the screen |example: "file1" [Modified] line 4 of 11 --36%-- col 5
:r <return> |read the current file and insert its content after current line :r {filename} <return> |read the file "filename" and insert its content after current line :w <return> |save the current file :w {filename} <return> |save the contents to the file "filename" |It will complain if the file "filename" already exists: "File exists (add ! to override)" :w! {filename} <return> |force saving the contents to the file "filename", even if the file already exists :{n},{m}w {filename} <return> |save to the file "filename" the contents of the lines numbered {n} through {m} |It will complain if the file "filename" already exists: "File exists (add ! to override)" :{n},{m}w! <return> |save to the current file the contents of the lines numbered {n} through {m} :{n},{m}w! {filename} <return> |save to the file "filename" the contents of the lines numbered {n} through {m}
:x <return> :wq <return> |exit vim + saving modified file :q <return> |exit vim (will complain if the file has been changed: "No write since last change (add ! to override)") :q! <return> |exit vim + discarding all modifications