aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xREADME.md323
1 files changed, 172 insertions, 151 deletions
diff --git a/README.md b/README.md
index c6da247..0d4f81b 100755
--- a/README.md
+++ b/README.md
@@ -50,191 +50,212 @@ For different working scenarios.
50 textwidth (configured with `set textwidth=80` for example) 50 textwidth (configured with `set textwidth=80` for example)
51 51
52 52
53 :viusage = summary of all keyboard shortcuts 53## general
54 :options = shows currently :set options (with descriptions)
55 leader key = usually set to backslash expects a quick command
56 54
57 [normal mode] 55 :viusage = summary of all keyboard shortcuts
58 f{char} = move cursor to the character {char} 56 :options = shows currently :set options (with descriptions)
59 gf = open file under cursor 57 leader key = usually set to backslash expects a quick command
60 <C-w>gf = open file under cursor in a tab
61 <C-w>] = jump to the tag under the cursor in a new window
62 <C-t> = jump back from where that ^ brought you
63 K = keyword lookup for the word under the cursor (see :help kp)
64 w = next word
65 e = end of word (=inner word)
66 58
67 @see: :h text-objects 59### normal mode
68 ci' = change between single quote
69 ci" = change between double quote
70 ci( = change between brace
71 cit = change XML Tag
72 ciw = select inner word
73 caw = select 'a word'
74 " where c can be replaced by v for visual mode
75 60
76 :%s/foo/bar/g = replace all foo with bar 61 f{char} = move cursor to the character {char}
77 :g/foo/s/bar//g = on lines with foo replace bar with nothing 62 gf = open file under cursor
78 :g!/foo/s/bar//g = on lines not containing foo replace bar with nothing 63 <C-w>gf = open file under cursor in a tab
79 :g!/^foo/execute("normal dd") delete lines starting with foo 64 <C-w>] = jump to the tag under the cursor in a new window
65 <C-t> = jump back from where that ^ brought you
66 K = keyword lookup for the word under the cursor (see :help kp)
67 w = next word
68 e = end of word (=inner word)
80 69
81 flags, end: after the last / 70 @see: :h text-objects
82 g = replace globally (all occurances on the current line) 71 ci' = change between single quote
83 c = confirm each replace, also allows to switch to g (use the flag to see the help message) 72 ci" = change between double quote
84 e = places the cursor in the end of the selection 73 ci( = change between brace
74 cit = change XML Tag
75 ciw = select inner word
76 caw = select 'a word'
77 " where c can be replaced by v for visual mode
85 78
86 flags, within the search string: 79 :%s/foo/bar/g = replace all foo with bar
87 \v = use very magic search (more like perl) 80 :g/foo/s/bar//g = on lines with foo replace bar with nothing
88 \V = use no very magic, more like searching verbatim 81 :g!/foo/s/bar//g = on lines not containing foo replace bar with nothing
89 \zs .. \ze = mark begin and end of a sub pattern (like perl lookaround assertions) 82 :g!/^foo/execute("normal dd") delete lines starting with foo
90 83
91 [visual mode] # with selected lines 84 flags, end: after the last /
92 gq = formats text so that it fits in whatever :set textwidth was set 85 g = replace globally (all occurances on the current line)
93 iB = select block between curly braces (:help object-select) 86 c = confirm each replace, also allows to switch to g (use the flag to see the help message)
87 e = places the cursor in the end of the selection
94 88
95 [commands] 89 flags, within the search string:
96 command line mode begins with : and has its own key mappings starting with c like in cnormap 90 \v = use very magic search (more like perl)
91 \V = use no very magic, more like searching verbatim
92 \zs .. \ze = mark begin and end of a sub pattern (like perl lookaround assertions)
97 93
98 :spell [word] = adds a word to the current dictionary (no mistake any more) 94### visual mode (with selected lines)
99 :set list = display non printable characters
100 :retab = replaces tabs with spaces
101 :set expandtab = in insert mode: replace tab with spaces
102 :Explore = cli version open file dialog (file explorer)
103 :Lex = use netrw as project drawer (stays open in its own window)
104 :only = 'maximize' current buffer
105 95
106 <c-r><c-w> = auto completion with the word under the cursor (interesting with incsearch) 96 gq = formats text so that it fits in whatever :set textwidth was set
107 <c-a> = expand pattern from command line (e.g. *.txt) 97 iB = select block between curly braces (:help object-select)
108 98
109 [navigation] 99### command line mode
110 <CTRL-]> = look up the tag under the cursor (help links as well) 100command line mode begins with : and has its own key mappings starting with c
111 <CTRL-T> = return back from tag under the cursor 101like in cnormap
112 gd = jump to the declaration of the variable under the cursor
113 102
114 [macros] # record and play back a series of vim commands 103 :spell [word] = adds a word to the current dictionary (no mistake any more)
115 qa = start (q) macro recording in register a (can be anything) 104 :set list = display non printable characters
116 q = stop macro recording 105 :retab = replaces tabs with spaces
117 @a = replay macro a 106 :set expandtab = in insert mode: replace tab with spaces
118 :'<,'>normal @a = apply a to every line in the current selection 107 :Explore = cli version open file dialog (file explorer)
119 :reg = lists all registers (including those with macros in them) 108 :Lex = use netrw as project drawer (stays open in its own window)
109 :only = 'maximize' current buffer
120 110
121 [registers]
122 notice, that registers get used for both: macro recordings and copying text
123 111
124 :reg = shows contents of all registers 112### insert mode
125 "0p = pasts from register 0, which is the same as "", but not overwritten by dd
126 "ap = same for register a
127 "0yy = yanks to register 0 (same as y by itself)
128 "ay = yanks current selection to register a (in visual mode)
129 113
130 [marker] 114 <c-r><c-w> = auto completion with the word under the cursor (interesting with incsearch)
131 ma = set marker a-z (a in this case) 115 <c-a> = expand pattern from command line (e.g. *.txt)
132 mA = create a session persistent file marker which can be used to reopen a file (not bound to the buffer)
133 `a = go to marker a (line & column)
134 'a = go to marker a (line, first non blank), same as `a^
135 116
136 [hotkeys] 117### navigation
137 <C-A>, <C-X> = increment, decrement number under the cursor
138 118
139 [windows] 119 <CTRL-]> = look up the tag under the cursor (help links as well)
140 <C-W>v = splits buffer vertically (screen uses |) 120 <CTRL-T> = return back from tag under the cursor
141 <C-W>s = splits buffer horizontally (same as screen) 121 gd = jump to the declaration of the variable under the cursor
142 <C-W>w = moves the cursor to the next window and back
143 <C-W>[dir] = moves the cursor in that direction (use hjkl or arrow keys)
144 <C-W>[HK] = make a vertical split horizontal and vice versa
145 <C-W>o = only: close all other windows
146 <C-W>c = close: current window in which the cursor sits
147 122
148 [vimdiff] 123### macros
149 do = get changes from other window into the current 124record and play back a series of vim commands
150 dp = put changes from current window into the other
151 ]c = jump to the next change
152 [c = jump to the prevous change
153 125
154 [folds] 126 qa = start (q) macro recording in register a (can be anything)
155 za = toggle a fold 127 q = stop macro recording
156 zM = close all folds 128 @a = replay macro a
157 zR = opens all folds (unfold all) 129 :'<,'>normal @a = apply a to every line in the current selection
158 zE = eliminates all folds 130 :reg = lists all registers (including those with macros in them)
159 131
160 [buffers] 132### registers
161 :bn = buffer next 133notice, that registers get used for both: macro recordings and copying text
162 :bp = buffer previous
163 :bd = buffer dispatch (close)
164 :b <tab> = switch buffer by name (use <tab> and <return>)
165 :set nobuflisted = hide buffer in buffer list (great for neovim's terminal)
166 134
167 [args] 135 :reg = shows contents of all registers
168 :n **/*.c = opens all files with that name or type in buffers and also fills the argument list 136 "0p = pasts from register 0, which is the same as "", but not overwritten by dd
137 "ap = same for register a
138 "0yy = yanks to register 0 (same as y by itself)
139 "ay = yanks current selection to register a (in visual mode)
169 140
170 [special] 141### marker
171 g CTRL-g = display file properties including word and char count
172 q: = show command history and use it like a normal buffer
173 z= = show spellcheck suggestions
174 142
175 [completions] 143 ma = set marker a-z (a in this case)
176 CTRL-O = display completions: omnicomplete (context dependant completions) 144 mA = create a session persistent file marker which can be used to reopen a file (not bound to the buffer)
145 `a = go to marker a (line & column)
146 'a = go to marker a (line, first non blank), same as `a^
177 147
178 CTRL-X CTRL-F = display completions: file name (using vim-internals omnicomplete) 148### other hotkeys
179 CTRL-N CTRL-P = display completions: file keywords
180 CTRL-K = display completions: dictionary
181 CTRL-T = display completions: thesaurus
182 CTRL-I = display completions: include files
183 CTRL-] = display completions: tags
184 CTRL-D = display completions: (marcro-) definitions
185 CTRL-V = display completions: vim command line
186 CTRL-U = display completions: user-defined
187 149
188 [annoyances] 150 <C-A>, <C-X> = increment, decrement number under the cursor
189 gv = visual mode: reselect last selection
190 CTRL-o = lets the caret jump back to the previous location
191 CTRL-L = redraws the complete screen
192 CTRL-R<register> = in insert mode and command line: paste contents of <register> (e.g. : for last command, * for clipboard)
193 CTRL-R = in normal mode: redoes what has been undone with u
194 "<register>p = in normal mode: paste paste contents of <register>
195 151
196 [registers] 152## windows
197 "/ = last search expression
198 ": = last command entered
199 "= = expression register (to do calculations or call vim functions)
200 153
201 [netrw] 154 <C-w>v = splits buffer vertically (screen uses |)
202 :Lex = open the netrw-view as project drawer 155 <C-w>s = splits buffer horizontally (same as screen)
203 gn = makes the directory under the cursor the root directory 156 <C-w>w = moves the cursor to the next window and back
204 a = toggles display of hidden files 157 <C-w>[dir] = moves the cursor in that direction (use hjkl or arrow keys)
158 <C-w>[HK] = make a vertical split horizontal and vice versa
159 <C-w>o = only: close all other windows
160 <C-w>c = close: current window in which the cursor sits
205 161
206 [filetype:css] 162### vimdiff
207 viB:sort = sort inner block by name
208 163
209 [vim commands] 164 do = get changes from other window into the current
210 :for i in range(1,12) | put ='2016-'.i | endfor 165 dp = put changes from current window into the other
166 ]c = jump to the next change
167 [c = jump to the prevous change
211 168
212 [fancy utf-8 symbols] 169### folds
213
214 170
215 [debugging] 171 za = toggle a fold
216 :profile! start /tmp/profile.log 172 zM = close all folds
217 :profile func * 173 zR = opens all folds (unfold all)
218 :profile file * 174 zE = eliminates all folds
219 " At this point do slow actions
220 :profdel *
221 :e /tmp/profile.log
222 " add a break point to a vim script (like vimrc) to invoke the internal debugger
223 :breakadd here
224 175
225 :finish = from within a viml-script: stop sourcing it 176### buffers
226 177
227 [substitutions] 178 :bn = buffer next
228 delete all comments: %s/\/\*\*< [^(\*\/)]*\*\///g 179 :bp = buffer previous
229 remove empty lines: global/^$/d 180 :bd = buffer dispatch (close)
230 remove non-empty lines: v/^$/d 181 :b <tab> = switch buffer by name (use <tab> and <return>)
182 :set nobuflisted = hide buffer in buffer list (great for neovim's terminal)
231 183
232 [programs] 184### args
233 gpm - cut and paste helper for the linux console (to get text from CTRL-ALT-F2 to CTRL-ALT-F3)
234 185
235 [vim modeline] 186 :n **/*.c = opens all files with that name or type in buffers and also fills the argument list
236 filetype can have multiple values, like python.django 187
237 The last line can be a mode line, which holds settings like tab width: 188### special
189
190 g CTRL-g = display file properties including word and char count
191 q: = show command history and use it like a normal buffer
192 z= = show spellcheck suggestions
193
194### completions
195
196 CTRL-O = display completions: omnicomplete (context dependant completions)
197 CTRL-X CTRL-F = display completions: file name (using vim-internals omnicomplete)
198 CTRL-N CTRL-P = display completions: file keywords
199 CTRL-K = display completions: dictionary
200 CTRL-T = display completions: thesaurus
201 CTRL-I = display completions: include files
202 CTRL-] = display completions: tags
203 CTRL-D = display completions: (marcro-) definitions
204 CTRL-V = display completions: vim command line
205 CTRL-U = display completions: user-defined
206
207### annoyances
208 gv = visual mode: reselect last selection
209 CTRL-o = lets the caret jump back to the previous location
210 CTRL-l = redraws the complete screen
211 CTRL-R<register> = in insert mode and command line: paste contents of <register> (e.g. : for last command, * for clipboard)
212 CTRL-R = in normal mode: redoes what has been undone with u
213 "<register>p = in normal mode: paste paste contents of <register>
214
215### registers
216 "/ = last search expression
217 ": = last command entered
218 "= = expression register (to do calculations or call vim functions)
219
220### netrw
221 :Lex = open the netrw-view as project drawer
222 gn = makes the directory under the cursor the root directory
223 a = toggles display of hidden files
224
225### filetype:css
226
227 viB:sort = sort inner block by name
228
229### vim commands
230
231 :for i in range(1,12) | put ='2016-'.i | endfor
232
233### debugging
234
235 :profile! start /tmp/profile.log
236 :profile func *
237 :profile file *
238 " At this point do slow actions
239 :profdel *
240 :e /tmp/profile.log
241 " add a break point to a vim script (like vimrc) to invoke the internal debugger
242 :breakadd here
243 :finish = from within a viml-script: stop sourcing it
244
245### substitutions
246
247 delete all comments: %s/\/\*\*< [^(\*\/)]*\*\///g
248 remove empty lines: global/^$/d
249 remove non-empty lines: v/^$/d
250
251### programs
252
253 gpm - cut and paste helper for the linux console (to get text from CTRL-ALT-F2 to CTRL-ALT-F3)
254
255### vim modeline
256
257 filetype can have multiple values, like python.django
258 The last line can be a mode line, which holds settings like tab width:
238 259
239 260
240 261
..