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