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