Browse Source

importing vim cheatsheet

Brennen Bearnes 9 years ago
commit
d8d0520ccc
1 changed files with 177 additions and 0 deletions
  1. 177
    0
      vimcheat.html

+ 177
- 0
vimcheat.html View File

@@ -0,0 +1,177 @@
1
+<html>
2
+<head>
3
+  <title>vim cheatsheet</title>
4
+  <style>
5
+    body {
6
+      font-family: Georgia, Serif;
7
+      margin-left: 2em;
8
+    }
9
+    th {
10
+      font-size: normal;
11
+      text-align: right;
12
+    }
13
+    td {
14
+      padding-right: .5em;
15
+      padding-left: .5em;
16
+      padding-bottom: .5em;
17
+      vertical-align: top;
18
+    }
19
+    td.keymap {
20
+      text-align: center;
21
+    }
22
+    kbd {
23
+      /* border-bottom: 1px solid #EAEEF2;
24
+      border-right: 1px solid #EAEEF2; */
25
+      padding: 1px;
26
+    }
27
+    kbd, pre, td.keymap {
28
+      font-family: monospace;
29
+      font-weight: bold;
30
+      font-size: larger;
31
+      color: green;
32
+    }
33
+    .change kbd, kbd.change { color: orange; }
34
+    .insert kbd, kbd.insert { color: blue;   }
35
+    .delete kbd, kbd.delete { color: red;    }
36
+
37
+    i { color: gray; }
38
+  </style>
39
+</head>
40
+
41
+<body>
42
+
43
+<table>
44
+
45
+<tr>
46
+  <th>edit</th>
47
+
48
+  <td>
49
+    <span class="insert">
50
+      <kbd>i</kbd>nsert at cursor<br>
51
+      <kbd>I</kbd>nsert at start<br>
52
+      <kbd>a</kbd>ppend after cursor<br>
53
+      <kbd>A</kbd>ppend to line<br>
54
+    </span>
55
+  </td>
56
+
57
+  <td>
58
+    <span class="delete">
59
+      <kbd>x</kbd> kill char<br>
60
+      <kbd>X</kbd> kill back<br>
61
+      <kbd>d</kbd>elete/cut text<br>
62
+      <kbd>d<i>obj</i></kbd> - <kbd>dw</kbd>, <kbd>d$</kbd>, etc.<br>
63
+      <kbd>dd</kbd> clears whole line<br>
64
+      <kbd>D</kbd> to end of line
65
+    </span><br>
66
+    <span class="change"><kbd>c</kbd>hange - <kbd>c<i>obj</i></kbd>, <kbd>ci<i>obj</i></kbd>, <kbd>cc</kbd>, <kbd>C</kbd></span><br>
67
+  </td>
68
+
69
+  <td>
70
+    <kbd class="change">r</kbd>eplace one char<br>
71
+    <kbd class="change">R</kbd>eplace text<br>
72
+    <span class="change"><kbd>s</kbd>ubstitute char</span><br>
73
+    <kbd>y</kbd>ank/copy - <kbd>y<i>obj</i></kbd>, <kbd>yy</kbd><br>
74
+    <kbd>p</kbd>ut (paste)<br>
75
+    <kbd>u</kbd>ndo, <kbd>ctrl-r</kbd>edo<br>
76
+    <kbd>v</kbd>isual select<br>
77
+    <kbd>.</kbd> repeat edit
78
+  </td>
79
+</tr>
80
+
81
+<tr>
82
+  <th>move</th>
83
+
84
+  <td>
85
+    <kbd>e</kbd>nd, <kbd>b</kbd>egin <kbd>w</kbd>ord<br>
86
+    <kbd>$</kbd>,<kbd>0</kbd> end, begin line<br>
87
+    <kbd>(</kbd>,<kbd>)</kbd> sentence &larr;, &rarr;<br>
88
+    <kbd>{</kbd>,<kbd>}</kbd> paragraph &larr;, &rarr;<br>
89
+    <kbd>ctrl-b</kbd>ack, <kbd>ctrl-f</kbd>wd page<br>
90
+    <kbd>fA</kbd> goes to next "A"<br>
91
+    <kbd>tA</kbd> before next "A"
92
+  </td>
93
+
94
+  <td class="keymap">
95
+    <small>gg</small><br>
96
+    <small>&lt;C-b&gt;</small><br>
97
+    H<br>
98
+    k<br>
99
+    { ( B b h l w W ) }<br>
100
+    j<br>
101
+    L<br>
102
+    <small>&lt;C-f&gt;</small><br>
103
+    <small>G</small>
104
+  </td>
105
+
106
+  <td>
107
+    <kbd>/<i>pattern</i></kbd> &rarr;<br>
108
+    <kbd>?<i>pattern</i></kbd> &larr;<br>
109
+    <kbd>n</kbd>ext <i>pattern</i><br>
110
+    <kbd>*</kbd> word under cursor<br>
111
+    <kbd>%</kbd> matching bracket<br>
112
+    <kbd>m<i>x</i></kbd> set mark <i>x</i><br>
113
+    <kbd>``</kbd> go back, <kbd>`<i>x</i></kbd> to mark
114
+  </td>
115
+</tr>
116
+
117
+<tr>
118
+  <th>files<br><small>&amp; windows</small></th>
119
+
120
+  <td>
121
+    <kbd>:e <i>file</i></kbd> edit<br>
122
+    <kbd>:w <i>file</i></kbd> write<br>
123
+    <kbd>:wq</kbd> write &amp; quit<br>
124
+    <kbd>:r <i>file</i></kbd> read into buffer<br>
125
+    <kbd>:r !<i>command</i></kbd> - get output<br>
126
+    <kbd>:sp <i>file</i></kbd> - in new window<br>
127
+    <kbd>:q</kbd> - quit buffer/window
128
+  </td>
129
+
130
+  <td colspan=2><kbd>ctrl-w</kbd> then...<br>
131
+    <kbd>n</kbd>ew<br>
132
+    <kbd>s</kbd>plit current<br>
133
+    <kbd>v</kbd>ertical split<br>
134
+    <kbd>h</kbd>, <kbd>j</kbd>, <kbd>k</kbd>, <kbd>l</kbd> jump &larr; &darr; &uarr; &rarr;<br>
135
+    <kbd>+</kbd>, <kbd>-</kbd>, <kbd>=</kbd> size current<br>
136
+    <kbd>f</kbd>ile under cursor in new window<br>
137
+  </td>
138
+</tr>
139
+
140
+</table>
141
+
142
+<p>- - - cut or fold here - - -</p>
143
+
144
+<table>
145
+
146
+<tr>
147
+  <th>style</th>
148
+
149
+  <td>
150
+    <kbd>:set expandtab</kbd> - use spaces<br>
151
+    <kbd>:set shiftwidth=2</kbd><br>
152
+    <kbd>:set textwidth=70</kbd><br>          
153
+    <kbd>:set nowrap</kbd>
154
+  </td>
155
+
156
+  <th>tweak</th>
157
+
158
+  <td>
159
+    <kbd class="change">J</kbd>oin<br>
160
+    <kbd class="change">gq<i>obj</i></kbd> - autoformat<br>
161
+    <kbd>~</kbd> change case of char<br>
162
+    <kbd>&gt;&gt;</kbd>,<kbd>&lt;&lt;</kbd> indent, unindent<br>
163
+    <kbd>=</kbd> autoindent<br>
164
+    <kbd>:rangesort</kbd><br>
165
+  </td>
166
+</tr>
167
+</table>
168
+
169
+<p><kbd><i>n</i>ctrl-a</kbd>, <kbd><i>n</i>ctrl-x</kbd> - inc or dec number by <i>n</i></p>
170
+
171
+<p><kbd class="change">:s/pattern/replacement/g</kbd> - on this line (g for multiple)<br>
172
+<kbd class="change">:%s/pattern/replacement/gc</kbd> - on every line but confirm<br>
173
+<kbd class="change">:perldo s/foo/bar/g</kbd> - do Perl on every line<br>
174
+<kbd class="change">:.perldo s/bar/baz/g</kbd> - do Perl on this line</p>
175
+
176
+</body>
177
+</html>

Loading…
Cancel
Save