|
| 1 | +# Toolbox: Vim |
| 2 | + |
| 3 | +- Install Vim |
| 4 | + |
| 5 | + no answer needed |
| 6 | + |
| 7 | +- Launch Vim |
| 8 | + |
| 9 | + no answer needed |
| 10 | + |
| 11 | +- How do we enter "INSERT" mode? |
| 12 | + |
| 13 | + - `i` |
| 14 | + |
| 15 | +- How do we start entering text into our new Vim document? |
| 16 | + |
| 17 | + - `typing` |
| 18 | + |
| 19 | +- How do we return to command mode? |
| 20 | + |
| 21 | + - `esc` |
| 22 | + |
| 23 | +- How do we move the cursor left? |
| 24 | + |
| 25 | + - `h` |
| 26 | + |
| 27 | +- How do we move the cursor right? |
| 28 | + |
| 29 | + - `l` |
| 30 | + |
| 31 | +- How do we move the cursor up? |
| 32 | + |
| 33 | + - `k` |
| 34 | + |
| 35 | +- How do we move the cursor down? |
| 36 | + |
| 37 | + - `j` |
| 38 | + |
| 39 | +- How do we jump to the start of a word? |
| 40 | + |
| 41 | + - `w` |
| 42 | + |
| 43 | +- How do we jump to the end of a word? |
| 44 | + |
| 45 | + - `e` |
| 46 | + |
| 47 | +- How do we insert (before the cursor) |
| 48 | + |
| 49 | + - `i` |
| 50 | + |
| 51 | +- How do we insert (at the beginning of the line?) |
| 52 | + |
| 53 | + - `I` |
| 54 | + |
| 55 | +- How do we append (after the cursor) |
| 56 | + |
| 57 | + - `a` |
| 58 | + |
| 59 | +- How do we append (at the end of the line) |
| 60 | + |
| 61 | + - `A` |
| 62 | + |
| 63 | +- How do we make a new line under the current line? |
| 64 | + |
| 65 | + - `o` |
| 66 | + |
| 67 | +- How do we write the file, but don't exit? |
| 68 | + |
| 69 | + - `:w` |
| 70 | + |
| 71 | +- How do we write the file, but don't exit- as root? |
| 72 | + |
| 73 | + - `:w !sudo tee %` |
| 74 | + |
| 75 | +- How do we write and quit? |
| 76 | + |
| 77 | + - `:wq` |
| 78 | + |
| 79 | +- How do we quit? |
| 80 | + |
| 81 | + - `:q` |
| 82 | + |
| 83 | +- How do we force quit? |
| 84 | + |
| 85 | + - `:q!` |
| 86 | + |
| 87 | +- How do we save and quit, for all active tabs? |
| 88 | + |
| 89 | + - `:wqa` |
| 90 | + |
| 91 | +- How do we copy a line? |
| 92 | + |
| 93 | + - `yy` |
| 94 | + |
| 95 | +- How do we copy 2 lines? |
| 96 | + |
| 97 | + - `2yy` |
| 98 | + |
| 99 | +- How do we copy to the end of the line? |
| 100 | + |
| 101 | + - `y$` |
| 102 | + |
| 103 | +- How do we paste the clipboard contents after the cursor? |
| 104 | + |
| 105 | + - `p` |
| 106 | + |
| 107 | +- How do we paste the clipboard contents before the cursor? |
| 108 | + |
| 109 | + - `P` |
| 110 | + |
| 111 | +- How do we cut a line? |
| 112 | + |
| 113 | + - `d` |
| 114 | + |
| 115 | +- How do we cut two lines? |
| 116 | + |
| 117 | + - `2dd` |
| 118 | + |
| 119 | +- How do we cut to the end of the line? |
| 120 | + |
| 121 | + - `D` |
| 122 | + |
| 123 | +- How do we cut a character? |
| 124 | + |
| 125 | + - `x` |
| 126 | + |
| 127 | +- How do we search forwards for a pattern (use "pattern" for your answer) |
| 128 | + |
| 129 | + - `/pattern` |
| 130 | + |
| 131 | +- How do we search backwards for a pattern (use "pattern" for your answer) |
| 132 | + |
| 133 | + - `?pattern` |
| 134 | + |
| 135 | +- How do we repeat this search in the same direction? |
| 136 | + |
| 137 | + - `n` |
| 138 | + |
| 139 | +- How do we repeat this search in the opposite direction? |
| 140 | + |
| 141 | + - `N` |
| 142 | + |
| 143 | +- How do we search for "old" and replace it with "new" |
| 144 | + |
| 145 | + - `:%s/old/new/g` |
| 146 | + |
| 147 | +- How do we use "grep" to search for a pattern in multiple files? |
| 148 | + |
| 149 | + - `:vimgrep` |
| 150 | + |
| 151 | + |
0 commit comments