From 829561732c18336010a0ebc8c04a00f745591634 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Sun, 12 May 2024 21:33:45 +0200 Subject: attempt to make the README look better --- .gitignore | 1 + README.md | 403 +++++++++++++++++++++++++++++-------------------------------- gvimrc | 2 +- 3 files changed, 195 insertions(+), 211 deletions(-) diff --git a/.gitignore b/.gitignore index 8b51aea..429ea9e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ !spell/.keep /systags /pack/max/** +shada.file diff --git a/README.md b/README.md index 2d5747f..141a549 100755 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ # Installation -``` -git clone http://git.entwicklerseite.de/vim ~/.config/nvim/ -``` + + git clone http://git.entwicklerseite.de/vim ~/.config/nvim/ + ln -s ~/.config/nvim ~/.vim # Overview -- init.lua :: my every day neovim config. It sources my vimrc (see below) +- `init.lua` :: my every day neovim config. It sources my vimrc (see below) -- init-mini.lua :: if you want to start from scratch this is a good start. It +- `init-mini.lua` :: if you want to start from scratch this is a good start. It sets up nvim with a language server to support the creation of a new config. -- vimrc :: commented version of a vimrc with sane defaults +- `vimrc` :: commented version of a vimrc with sane defaults + +- `gvimrc` :: configures the gui of gvim and sources the vimrc ``` @@ -47,213 +49,194 @@ For different working scenarios. - use `gw` or `gq` in visual mode to break selected text at the current textwidth (configured with `set textwidth=80` for example) -``` -:viusage = summary of all keyboard shortcuts -:options = shows currently :set options (with descriptions) -leader key = usually set to backslash expects a quick command - - -[normal mode] -f{char} = move cursor to the character {char} -gf = open file under cursor -gf = open file under cursor in a tab -] = jump to the tag under the cursor in a new window - = jump back from where that ^ brought you -K = keyword lookup for the word under the cursor (see :help kp) -w = next word -e = end of word (=inner word) - - -@see: :h text-objects -ci' = change between single quote -ci" = change between double quote -ci( = change between brace -cit = change XML Tag -ciw = select inner word -caw = select 'a word' -" where c can be replaced by v for visual mode - -:%s/foo/bar/g = replace all foo with bar -:g/foo/s/bar//g = on lines with foo replace bar with nothing -:g!/foo/s/bar//g = on lines not containing foo replace bar with nothing -:g!/^foo/execute("normal dd") delete lines starting with foo - -flags, end: after the last / -g = replace globally (all occurances on the current line) -c = confirm each replace, also allows to switch to g (use the flag to see the help message) -e = places the cursor in the end of the selection - -flags, within the search string: -\v = use very magic search (more like perl) -\V = use no very magic, more like searching verbatim -\zs .. \ze = mark begin and end of a sub pattern (like perl lookaround assertions) - - - -[visual mode] # with selected lines -gq = formats text so that it fits in whatever :set textwidth was set -iB = select block between curly braces (:help object-select) - - -[commands] -command line mode begins with : and has its own key mappings starting with c like in cnormap - -:spell [word] = adds a word to the current dictionary (no mistake any more) -:set list = display non printable characters -:retab = replaces tabs with spaces -:set expandtab = in insert mode: replace tab with spaces -:Explore = cli version open file dialog (file explorer) -:Lex = use netrw as project drawer (stays open in its own window) -:only = 'maximize' current buffer - - = auto completion with the word under the cursor (interesting with incsearch) - = expand pattern from command line (e.g. *.txt) - - -[navigation] - = look up the tag under the cursor (help links as well) - = return back from tag under the cursor -gd = jump to the declaration of the variable under the cursor - - -[macros] # record and play back a series of vim commands -qa = start (q) macro recording in register a (can be anything) -q = stop macro recording -@a = replay macro a -:'<,'>normal @a = apply a to every line in the current selection -:reg = lists all registers (including those with macros in them) - -[registers] -notice, that registers get used for both: macro recordings and copying text - -:reg = shows contents of all registers -"0p = pasts from register 0, which is the same as "", but not overwritten by dd -"ap = same for register a -"0yy = yanks to register 0 (same as y by itself) -"ay = yanks current selection to register a (in visual mode) - - -[marker] -ma = set marker a-z (a in this case) -mA = create a session persistent file marker which can be used to reopen a file (not bound to the buffer) -`a = go to marker a (line & column) -'a = go to marker a (line, first non blank), same as `a^ - - -[hotkeys] -, = increment, decrement number under the cursor + :viusage = summary of all keyboard shortcuts + :options = shows currently :set options (with descriptions) + leader key = usually set to backslash expects a quick command + + [normal mode] + f{char} = move cursor to the character {char} + gf = open file under cursor + gf = open file under cursor in a tab + ] = jump to the tag under the cursor in a new window + = jump back from where that ^ brought you + K = keyword lookup for the word under the cursor (see :help kp) + w = next word + e = end of word (=inner word) + + @see: :h text-objects + ci' = change between single quote + ci" = change between double quote + ci( = change between brace + cit = change XML Tag + ciw = select inner word + caw = select 'a word' + " where c can be replaced by v for visual mode + + :%s/foo/bar/g = replace all foo with bar + :g/foo/s/bar//g = on lines with foo replace bar with nothing + :g!/foo/s/bar//g = on lines not containing foo replace bar with nothing + :g!/^foo/execute("normal dd") delete lines starting with foo + + flags, end: after the last / + g = replace globally (all occurances on the current line) + c = confirm each replace, also allows to switch to g (use the flag to see the help message) + e = places the cursor in the end of the selection + + flags, within the search string: + \v = use very magic search (more like perl) + \V = use no very magic, more like searching verbatim + \zs .. \ze = mark begin and end of a sub pattern (like perl lookaround assertions) + + [visual mode] # with selected lines + gq = formats text so that it fits in whatever :set textwidth was set + iB = select block between curly braces (:help object-select) + + [commands] + command line mode begins with : and has its own key mappings starting with c like in cnormap + + :spell [word] = adds a word to the current dictionary (no mistake any more) + :set list = display non printable characters + :retab = replaces tabs with spaces + :set expandtab = in insert mode: replace tab with spaces + :Explore = cli version open file dialog (file explorer) + :Lex = use netrw as project drawer (stays open in its own window) + :only = 'maximize' current buffer + + = auto completion with the word under the cursor (interesting with incsearch) + = expand pattern from command line (e.g. *.txt) + + [navigation] + = look up the tag under the cursor (help links as well) + = return back from tag under the cursor + gd = jump to the declaration of the variable under the cursor + + [macros] # record and play back a series of vim commands + qa = start (q) macro recording in register a (can be anything) + q = stop macro recording + @a = replay macro a + :'<,'>normal @a = apply a to every line in the current selection + :reg = lists all registers (including those with macros in them) + + [registers] + notice, that registers get used for both: macro recordings and copying text + + :reg = shows contents of all registers + "0p = pasts from register 0, which is the same as "", but not overwritten by dd + "ap = same for register a + "0yy = yanks to register 0 (same as y by itself) + "ay = yanks current selection to register a (in visual mode) + + [marker] + ma = set marker a-z (a in this case) + mA = create a session persistent file marker which can be used to reopen a file (not bound to the buffer) + `a = go to marker a (line & column) + 'a = go to marker a (line, first non blank), same as `a^ + + [hotkeys] + , = increment, decrement number under the cursor + + [windows] + v = splits buffer vertically (screen uses |) + s = splits buffer horizontally (same as screen) + w = moves the cursor to the next window and back + [dir] = moves the cursor in that direction (use hjkl or arrow keys) + [HK] = make a vertical split horizontal and vice versa + o = only: close all other windows + c = close: current window in which the cursor sits + + [vimdiff] + do = get changes from other window into the current + dp = put changes from current window into the other + ]c = jump to the next change + [c = jump to the prevous change + + [folds] + za = toggle a fold + zM = close all folds + zR = opens all folds (unfold all) + zE = eliminates all folds + + [buffers] + :bn = buffer next + :bp = buffer previous + :bd = buffer dispatch (close) + :b = switch buffer by name (use and ) + :set nobuflisted = hide buffer in buffer list (great for neovim's terminal) + + [args] + :n **/*.c = opens all files with that name or type in buffers and also fills the argument list + + [special] + g CTRL-g = display file properties including word and char count + q: = show command history and use it like a normal buffer + z= = show spellcheck suggestions + + [completions] + CTRL-O = display completions: omnicomplete (context dependant completions) + + CTRL-X CTRL-F = display completions: file name (using vim-internals omnicomplete) + CTRL-N CTRL-P = display completions: file keywords + CTRL-K = display completions: dictionary + CTRL-T = display completions: thesaurus + CTRL-I = display completions: include files + CTRL-] = display completions: tags + CTRL-D = display completions: (marcro-) definitions + CTRL-V = display completions: vim command line + CTRL-U = display completions: user-defined + + [annoyances] + gv = visual mode: reselect last selection + CTRL-o = lets the caret jump back to the previous location + CTRL-L = redraws the complete screen + CTRL-R = in insert mode and command line: paste contents of (e.g. : for last command, * for clipboard) + CTRL-R = in normal mode: redoes what has been undone with u + "p = in normal mode: paste paste contents of + + [registers] + "/ = last search expression + ": = last command entered + "= = expression register (to do calculations or call vim functions) + + [netrw] + :Lex = open the netrw-view as project drawer + gn = makes the directory under the cursor the root directory + a = toggles display of hidden files + + [filetype:css] + viB:sort = sort inner block by name + + [vim commands] + :for i in range(1,12) | put ='2016-'.i | endfor + + [fancy utf-8 symbols] + ௵ + + [debugging] + :profile! start /tmp/profile.log + :profile func * + :profile file * + " At this point do slow actions + :profdel * + :e /tmp/profile.log + " add a break point to a vim script (like vimrc) to invoke the internal debugger + :breakadd here + + :finish = from within a viml-script: stop sourcing it + + [substitutions] + delete all comments: %s/\/\*\*< [^(\*\/)]*\*\///g + remove empty lines: global/^$/d + remove non-empty lines: v/^$/d + + [programs] + gpm - cut and paste helper for the linux console (to get text from CTRL-ALT-F2 to CTRL-ALT-F3) + + [vim modeline] + filetype can have multiple values, like python.django + The last line can be a mode line, which holds settings like tab width: -[windows] -v = splits buffer vertically (screen uses |) -s = splits buffer horizontally (same as screen) -w = moves the cursor to the next window and back -[dir] = moves the cursor in that direction (use hjkl or arrow keys) -[HK] = make a vertical split horizontal and vice versa -o = only: close all other windows -c = close: current window in which the cursor sits - - -[vimdiff] -do = get changes from other window into the current -dp = put changes from current window into the other -]c = jump to the next change -[c = jump to the prevous change - -[folds] -za = toggle a fold -zM = close all folds -zR = opens all folds (unfold all) -zE = eliminates all folds - - -[buffers] -:bn = buffer next -:bp = buffer previous -:bd = buffer dispatch (close) -:b = switch buffer by name (use and ) -:set nobuflisted = hide buffer in buffer list (great for neovim's terminal) - -[args] -:n **/*.c = opens all files with that name or type in buffers and also fills the argument list - - -[special] -g CTRL-g = display file properties including word and char count -q: = show command history and use it like a normal buffer -z= = show spellcheck suggestions - - -[completions] -CTRL-O = display completions: omnicomplete (context dependant completions) - -CTRL-X CTRL-F = display completions: file name (using vim-internals omnicomplete) -CTRL-N CTRL-P = display completions: file keywords -CTRL-K = display completions: dictionary -CTRL-T = display completions: thesaurus -CTRL-I = display completions: include files -CTRL-] = display completions: tags -CTRL-D = display completions: (marcro-) definitions -CTRL-V = display completions: vim command line -CTRL-U = display completions: user-defined - - -[annoyances] -gv = visual mode: reselect last selection -CTRL-o = lets the caret jump back to the previous location -CTRL-L = redraws the complete screen -CTRL-R = in insert mode and command line: paste contents of (e.g. : for last command, * for clipboard) -CTRL-R = in normal mode: redoes what has been undone with u -"p = in normal mode: paste paste contents of - -[registers] -"/ = last search expression -": = last command entered -"= = expression register (to do calculations or call vim functions) - - - -[netrw] -:Lex = open the netrw-view as project drawer -gn = makes the directory under the cursor the root directory -a = toggles display of hidden files - -[filetype:css] -viB:sort = sort inner block by name - -[vim commands] -:for i in range(1,12) | put ='2016-'.i | endfor - -[fancy utf-8 symbols] -௵ - -[debugging] -:profile! start /tmp/profile.log -:profile func * -:profile file * -" At this point do slow actions -:profdel * -:e /tmp/profile.log -" add a break point to a vim script (like vimrc) to invoke the internal debugger -:breakadd here - -:finish = from within a viml-script: stop sourcing it - -[substitutions] -delete all comments: %s/\/\*\*< [^(\*\/)]*\*\///g -remove empty lines: global/^$/d -remove non-empty lines: v/^$/d - -[programs] -gpm - cut and paste helper for the linux console (to get text from CTRL-ALT-F2 to CTRL-ALT-F3) - - -[vim modeline] -filetype can have multiple values, like python.django -The last line can be a mode line, which holds settings like tab width: -``` - ## git diff --git a/gvimrc b/gvimrc index 2f9e8ec..77bfa32 100644 --- a/gvimrc +++ b/gvimrc @@ -29,4 +29,4 @@ if has("gui_running") cnoremap * endif -source fnamemodify(expand("$MYVIMRC"), ":p:h") . "/vimrc" +exec ":source " . fnamemodify(expand("$MYVIMRC"), ":p:h") . "/vimrc" -- cgit v1.2.3