1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | h – move the cursor left j – move the cursor down k – move the cursor up l – move the cursor right b – move to the start of a word B – move to the start of a token w – move to the start of the next word W – move to the start of the next token e – move to the end of a word E – move to the end of a token 0 – jump to the beginning of the line $ – jump to the end of the line ^ – jump to the first (non-blank) character of the line #G / #gg / :# – move to a specified line number (replace # with the line number) r – replace a single character (and return to command mode) cc – replace an entire line (deletes the line and moves into insert mode) C / c$ – replace from the cursor to the end of a line cw – replace from the cursor to the end of a word s – delete a character (and move into insert mode) J – merge the line below to the current one with a space in between them gJ – merge the line below to the current one with no space in between them u – undo Ctrl + r – redo . – repeat last command yy – copy (yank) entire line #yy – copy the specified number of lines dd – cut (delete) entire line #dd – cut the specified number of lines p – paste after the cursor P – paste before the cursor v – select text using character mode V – select lines using line mode Ctrl+v – select text using block mode o – move from one end of the selected text to the other Ctrl + b – move back one full screen Ctrl + f – move forward one full screen Ctrl + d – move forward 1/2 a screen Ctrl + u – move back 1/2 a screen Ctrl + e – move screen down one line (without moving the cursor) Ctrl + y – move screen up one line (without moving the cursor) Ctrl + o – move backward through the jump history Ctrl + i – move forward through the jump history H – move to the top of the screen (H=high) M – move to the middle of the screen (M=middle) L – move to the bottom of the screen (L=low) i – switch to insert mode before the cursor I – insert text at the beginning of the line a – switch to insert mode after the cursor A – insert text at the end of the line o – open a new line below the current one O – open a new line above the current one ea – insert text at the end of the word Esc – exit insert mode; switch to command mode y – yank (copy) the marked text d – delete (cut) the marked text p – paste the text after the cursor u – change the market text to lowercase U – change the market text to uppercase * – jump to the next instance of the current word # – jump to previous instance of the current word /pattern – search forward for the specified pattern ?pattern – search backward for the specified pattern n – repeat the search in the same direction N – repeat the search in the opposite direction :w – save the file :wq / :x / ZZ – save and close the file :q – quit :q!/ ZQ – quit without saving changes :w new_file_name – save the file under a new name and continue editing the original :sav – save the file under a new name and continue editing the new copy :w !sudo tee % – write out the file using sudo and see command |