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