-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
230 lines (215 loc) · 16.9 KB
/
index.html
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html lang="en">
<head>
<title>ikwyl6 vim cheat sheet</title>
<style>
body { font-family: Arial; font-size: 16px; }
table { /*border:1px solid #999;*/ border-collapse: collapse; }
tr { /*border-bottom: 1px solid #999;*/ }
td { padding-top: 8px; padding-bottom: 8px; }
a { } /* Need to fix this instead of default blue */
h1 { font-size: }
code { background: #eaeaea; /*#ddd;*/ border-radius:0; padding: 4px; font-weight: bold }
footer { font-size: 12px; font-color: #ddd }
/* div containers below */
#container {
width: 1200px;
margin: 0 auto; /* center the div in center of page */
display: grid;
grid-gap: 10px; /* Simply adjust this value !*/
grid-template-columns: repeat(3, 1fr); /* OR grid-template-columns: 1fr 1fr 1fr;*/
grid-auto-rows: 1fr;
}
</style>
</head>
<body>
<h1 color="red"><b>ikwyl6 Vim Cheat Sheet</b></h1>
<div id="container">
<div> <!-- # start of first column -->
<table>
<tr><td><h1>General</h1></td></tr>
<tr><td><code>[count][command][motion]</code> - General formation of commands</td></tr>
<tr><td><h1>Text Objects</h1></td></tr>
<tr><td><code>iw</code> - inside a word</td></tr>
<tr><td><code>aw</code> - around a word</td></tr>
<tr><td><code>ip</code> - inside a paragraph</td></tr>
<tr><td><code>aw</code> - around a paragraph</td></tr>
<tr><td><code>i{</code> - inside a {} block or [] () '' "" ``</td></tr>
<tr><td><code>a{</code> - around a {} block or [] () '' "" ``</td></tr>
<tr><td><h1>Files</h1></td></tr>
<tr><td><code>:e file</code> - edit file</td></tr>
<tr><td><code>:e!</code> - re-edit, dischard changes</td></tr>
<tr><td><code>:e + file</code> - edit file, starting at end of file</td></tr>
<tr><td><code>:e +#</code> - edit file, starting at line #</td></tr>
<tr><td><code>:e #</code> - edit alternate file (?)</td></tr>
<tr><td><code>:w [file]</code> - write file (current file if no name given)</td></tr>
<tr><td><code>:w! file</code> - overwrite file</td></tr>
<tr><td><code>:w >>file</code> - append file (current file if no name given)</td></tr>
<tr><td><code>:23,45w snippet.txt</code> - Write the contents of the lines numbered 23 through 45 to a new file named snippet.txt
<tr><td><code>:r file</code> - read file after line</td></tr>
<tr><td><code>:r !program</code> - read program output</td></tr>
<tr><td><code>:f</code> or <code>^G</code> - show file name, total number of lines and percentage location within file</td></tr>
<tr><td><code>:q</code> or </code>:q!</code> - quit or quit without saving</td></tr>
<tr><td><code>:x</code> or <code>ZZ</code> - Save (if there are changes) and quit
<tr><td><code>ZQ</code> - Quit without checking for changes</td></tr>
<tr><td><h1>Editing</h1></td></tr>
<tr><td><code>i</code> or <code>I</code> - insert before cursor or before the first non-blank in the line</td></tr>
<tr><td><code>a</code> or <code>A</code> - append text after cursor or end of line</td></tr>
<tr><td><code>o</code> or <code>O</code> - enter insert mode but insert line after current one or before current line</td></tr>
<tr><td><code>r[char]</code> - replace single character with letter [char]</td></tr>
<tr><td><code>[#]r[char]</code> - replace number of characters [#] with character [char]. Example: <code>3rf</code></td></tr>
<tr><td><code>R</code> - enter replace mode</td></tr>
<tr><td><code>s</code> - delete character under cursor and go into insert mode</td></tr>
<tr><td><code>x</code> or <code>X</code> - delete character under cursor or before cursor</td></tr>
<tr><td><code>c</code> or <code>#c</code> - change a character or change three characters <code>3c</code></td></tr>
<tr><td><code>cc</code> or <code>S</code> or <code>#cc</code> or <code>C</code> - change/replace whole line <code>cc/S</code> or remove and change # lines starting from cursor or change/replace to end of line<code>C</code></td></tr>
<tr><td><code>ciw</code> - change word under cursor</td></tr>
<tr><td><code>caw</code> - change around word (including trailing space)</td></tr>
<tr><td><code>cw</code> - change word under cursor</td></tr>
<tr><td><code>ci"</code> - change inside ""</td></tr>
<tr><td><code>d</code> - delete</td></tr>
<tr><td><code>dw</code> or <code>d#w</code> - delete word or delete # of words</td></tr>
<tr><td><code>diw</code> - Delete inside word</td></tr>
<tr><td><code>daw</code> - Delete word and trailing space</td></tr>
<tr><td><code>di"</code> or <code>di'</code> or <code>di)</code> or <code>di}</code> - Delete inside double quotes, single quotes, parenthese, or curly braces</td></tr>
<tr><td><code>dd</code> or <code>#dd</code> - delete a line (and copy it to system register), delete # lines</td></tr>
<tr><td><code>d$</code> or <code>D</code> - delete from cursor up to end of line</td></tr>
<tr><td><code>:5,25d</code> - delete lines 5-25
<tr><td><code>:.m 12</code> - move current line after line 12</td></tr>
<tr><td><code>:5,7m 21</code> - move lines 5-7 after line 21</td></tr>
<tr><td><code>ddp</code> or <code>ddkP</code> - move line down or move line up</td></tr>
<tr><td><code>u</code> or <code>U</code> - undo last change or restore (undo all changes to) current line</td></tr>
<tr><td><code>:undolist</code> - list your possible undo changes using <code>u</code></td></tr>
<tr><td><code>J</code> - join current and below line with space in between</td></tr>
<tr><td><code>gJ</code> - join current and below line with no space between</td></tr>
<tr><td><code>:78,83join</code> - join range of lines together</td></tr>
</table>
</div> <!-- #end of first column -->
<div> <!-- # Start of second column -->
<!-- template for rows: <tr><td><code></code> - </td></tr> -->
<table>
<tr><h1>Moving Around</h1></tr>
<tr><td><code>h</code> or <code>#h</code> - Move one character to the the left or # characters to the left</td></tr>
<tr><td><code>j</code> or <code>#j</code> - Move one line down or # lines down</td></tr>
<tr><td><code>k</code> or <code>#k</code> - Move one line up or # lines up</td></tr>
<tr><td><code>l</code> or <code>#l</code> - Move one character to the right or # characters to the right</td></tr>
<tr><td><code>ctrl-d</code> or <code>ctrl-u</code> - Move down 1/2 page or move up 1/2 page</td></tr>
<tr><td><code>ctrl-f</code> or <code>ctrl-b</code> - Move down full page or move up full page</td></tr>
<tr><td><code>H</code> or <code>M</code> or <code>L</code> - Move to top <code>H</code>, middle <code>M</code> or bottom of screen <code>L</code></td></tr>
<tr><td><code>w</code> or <code>W</code> - jump ahead to start of next <a href="https://vimhelp.org/motion.txt.html#word">word</a> or space-separated <a href="https://vimhelp.org/motion.txt.html#word">Word</a></td></tr>
<tr><td><code>e</code> or <code>E</code> - jump ahead to end of next word or space-separated word</td></tr>
<tr><td><code>b</code> or <code>B</code> - jump backward to start of previous word</td></tr>
<tr><td><code>gg</code> or <code>[[</code> or <code>G</code> or <code>]]</code> or <code>#G</code> - Jump to 1st line of file <code>gg or [[</code>, last line of file <code>G or ]]</code>, or #th-line of file</td></tr>
<tr><td><code>g;</code> or <code>g,</code> - Move back to previously / newer changed line (older/newer position in change list). Similar command as CTRL-O and CTRL-I (jump list)</td></tr>
<tr><td><code>``</code> - Jump between the last two changed positions in change list</td></tr>
<tr><td><code>#%</code> - Move to the # % of file. <code>25%</code> would move to the 25% percent of file</td></tr>
<tr><td><code>#|</code> - Move to # column in line</td></tr>
<tr><td><code>[Enter]</code> or <code>+</code> - Move to the next non-blank character on line</td></tr>
<tr><td><code>-</code> - move to the previous line at the first non-blank character</td></tr>
<tr><td><code>:#</code> - move to line # where # is a number.</td></tr>
<tr><td><code>%</code> - find matching ( ) or {</td></tr>
<tr><td><code>/[chars]</code> - search for a string below cursor</td></tr>
<tr><td><code>?[chars]</code> - search for a string above cursor</td></tr>
<tr><td><code>n</code> or <code>N</code> - search for next or previous search occurence using / or ?. Or keep hitting <code>/</code> or <code>?</code> and [Enter] will do same thing</td></tr>
<tr><td><code>(</code> or <code>)</code> or <code>{</code> or <code>}</code> - move to beginning or end of sentence or beginning/end of paragraph (or next blank line)</td></tr>
<tr><td><code>0</code> or <code>^</code> or <code>$</code> or <code>g_</code> - go to beginning of line, start of first non-blank character in line (or underscore _), end of line, or last non-blank character in line</td></tr>
<tr><td><code>f{char}</code> or <code>F{char}</code> or <code>t{char}</code> or <code>T{char}</code> - jump to next <code>f</code> or previous <code>F</code> character, jump to next <code>t</code> or previous <code>T</code> character but behind one character</td></tr>
<tr><td><code>,</code> or <code>;</code> - using <code>f</code> or <code>t</code> commands above, repeat in the command direction or previous direction</td></tr>
<tr><td><code>zt</code> <code>zz</code> <code>zb</code> - orient screen so line is at (top|center|bottom) of screen</td></tr>
<tr><td><h1>Repeating Commands</h1></td></tr>
<tr><td><code>.</code> or <code>ctrl-r</code> or <code>#.</code> - Repeat last command performed or repeat last command # times</td></tr>
<tr><td><code>#{command}</code> - Repeat command # times</td></tr>
<tr><td><h1>Searching for text</h1></td></tr>
<tr><td><code>:/search/d</code> - search and delete the text that was found</td></tr>
<tr><td><code>:/search/y</code> - search and yank the text that was found</td></tr>
<tr><td><code>:/search1/,/search2/d</code> - search and delete lines with multiple patterns</td></tr>
<tr><td><code>:%s/target/=@0/g</code> - replace target with what is yanked</td></tr>
<tr><td><code>:%s/search/replace/g</code> - search and replace over whole file (%)</td></tr>
<tr><td><code>:g/pattern/d</code> - delete all lines with pattern</td></tr>
<tr><td><code>:v/pattern/d</code> - delete all lines that <i>do not</i> match pattern</td></tr>
<tr><td><h1>Visual Mode</h1></td></tr>
<tr><td><code>v</code> - enter visual mode</td></tr>
<tr><td><code>V</code> - enter visual mode highlighting the current line</td></tr>
<tr><td><code>viw</code> - visually select word without spaces</td></tr>
<tr><td><code>vaw</code> - visually select word with trailing space</td></tr>
<tr><td><code>vi[</code> - visully select inside next occurence of [</td></tr>
<tr><td><code>gv</code> - reselect the last visual selection</td></tr>
<tr><td><h1>Moving Visually Selected Text</h1></td></tr>
<tr><td><code>:le 10</code> - takes the visually selected text and adds 10 spaces to the left of this selected text starting from beginning of line</td></tr>
</table>
</div> <!-- # end of second column -->
<div> <!-- # start of third column -->
<table>
<tr><td><h1>Copy, Cut and Paste / Registers</h1></td></tr>
<tr><td><code>yy</code> or <code>Y</code> - Copy/Yank current line</td></tr>
<tr><td><code>5yy</code> - Copy/Yank current line and 5 lines below it</td></tr>
<tr><td><code>y$</code> - Copy/yank from current cursor to end of line</td></tr>
<tr><td><code>:#y</code> - copy/yank line number #</td></tr>
<tr><td><code>:#copy</code> or <code>:#t.</code> - copies the line specified and pastes it to the line below</td></tr>
<tr><td><code>:-10t.</code> - copy 10 lines above the current line and paste it below the current line</td></tr>
<tr><td><code>:10,20t.</code> - copy lines 10 to 20 and paste them below</td></tr>
<tr><td><code>:t20</code> - copy the current line and paste it below line 20</td></tr>
<tr><td><code>p</code> or <code>P</code> - paste before cursor or after cursor</td></tr>
<tr><td><code>"ap</code> - paste from register <code>a</code></td></tr>
<tr><td><code>"+p</code> - paste from the system clipboard</td></tr>
<tr><td><code>".p</code> - paste from last inserted text</td></tr>
<tr><td><code>"0-9p</code> - paste from delete history</td></tr>
<tr><td><code>"xy</code> - yank into register <i>x</i></td></tr>
<tr><td><code>"xd</code> - delete into register <i>x</i></td></tr>
<tr><td><code>:reg[isters]</code> - list registers and their contents</td></tr>
<tr><td><code>]p</code> - paste line with right indent</td></tr>
<tr><td><code>:.!program</code> - replace line with program output
<tr><td><h1>Split Windows</h1></td></tr>
<tr><td><code>:sp[lit] [file]</code> - split window horizontally opening [file]</td></tr>
<tr><td><code>:vs[plit] [file]</code> - split window vertically opening [file]</td></tr>
<tr><td><code>Ctrl</code>+<code>ww</code> - switch to other split window</td></tr>
<tr><td><code>Ctrl</code>+<code>w[dir]</code> - move to split window using direction ([dir] can be hjkl or arrow keys)</td></tr>
<tr><td><h1>Folds</h1></td></tr>
<tr><td><code>zf</code> - create fold at cursor position</td></tr>
<tr><td><code>zf{motion}</code> OR <code>{Visual}zf</code> - create a fold. Example: <code>zf#j</code> - create a folder from cursor down # lines. <code>zfgg</code> - create fold from cursor to top of file. <code>zfG</code> - create fold from cursor to bottom of file</td></tr>
<tr><td><code>zf/string</code> - create a fold from the cursor position to the first instance of the search string</td></tr>
<tr><td><code>zj</code> or <code>zk</code> - move downwards or upwards</td></tr>
<tr><td><code>zd</code> or <code>zD</code> - delete fold marker under cursor (or recursively zD)</td></tr>
<tr><td><code>za</code> - toggle fold at cursor location</td></tr>
<tr><td><code>zF</code> - create a fold for [count] lines</td></tr>
<tr><td><code>:{range}fo[ld]</code> - create a fold for {range}</td></tr>
<tr><td><code>zo</code> or <code>zO</code> - open fold (zO) recursively</td></tr>
<tr><td><code>zc</code> or <code>zC</code> - close one fold under the cursor recursively</td></tr>
<tr><td><code>za</code> or <code>zA</code> - open or close a fold recursively (zA)</td></tr>
<tr><td><code>zv</code> - view cursor line</td></tr>
<tr><td><code>zm</code> or <code>zM</code> - increase folding: Subtract one from 'foldlevel'</td></tr>
<tr><td><code>zr</code> or <code>zR</code> - reduce folding: Add one to 'foldlevel'. zR Decreases foldlevel to zero and opens all folds</td></tr>
<tr><td><code>zE</code> - delete all folds</td></tr>
<tr><td><code>:{range}foldo[pen][!]</code> - open folds in {range}. [!] all folds are</td></tr>
<tr><td><code>:{range}foldc[lose][!]</code> - close folds in {range}. [!] all folds</td></tr>
<tr><td><code>zn</code> or <code>zN</code> - all folds will be open</td></tr>
<tr><td><code>zi</code> - invert 'foldenable'</td></tr>
<tr><td><code>[z</code> or <code>]z</code> - move to the start or the end of the current open fold</td></tr>
<tr><td><h1>Tabs</h1></td></tr>
<tr><td><code>$ vim file1 file2 ... -p</code> - Open each file in a tab</td></tr>
<tr><td><code>:argdo tabe</code> - Open all files in their own tab</td></tr>
<tr><td><code>:tabnew [file]</code> or <code>:tabe[dit] [file]</code> - Create a new tab [with file]</td></tr>
<tr><td><code>:tabc[lose]</code>- Close current tab</td></tr>
<tr><td><code>:tab help tabs</code> - create new help window about tabs in a new tab</td></tr>
<tr><td><code>Ctrl-Shift-[Up/Dn]</code>Rotate between tabs</td></tr>
<tr><td><code>Ctrl-w T</code>Move window to a new tab</td></tr>
<tr><td><code>:args</code> - Print the argument list</td></tr>
<tr><td><code>:ls</code> - List buffers</td></tr>
<tr><td><code>:n</code> - edit next file in buffer</td></tr>
<tr><td><code>:p</code> - edit previous file in buffer</td></tr>
</table>
</div> <!-- # end of third column -->
<div>
<table>
<tr><td><h1>Links</h1></td></tr>
<tr><td>Cheat sheet: <a href="https://github.com/sk3pp3r/cheat-sheet-pdf/tree/master/pdf">sk3pp3r cheat-sheet-pdf</a></td></tr>
<tr><td><code>:h index</code> or <a href="https://vimhelp.org/index.txt.html#index">vimhelp.org vim index</a></td></tr>
<tr><td><a href="https://vimhelp.org/usr_toc.txt.html#usr_toc.txt">vim TOC</a></td></tr>
<tr><td><a href="https://www.youtube.com/watch?v=rT-fbLFOCy0">I Read The Entire Neovim User Manual - TJ DeVries</a></td></tr>
</table>
</div>
<div><table></table></div><div><table></table></div>
</div> <!-- #container -->
<footer>Created by ikwyl6 on github with formatting inspiration from <a href="https://vim.rtorr.com/">vim.rtorr.com</a></footer>
</body>
</html>