From 8ea1f5ef4574c627bc90360b9e22c60226879c5b Mon Sep 17 00:00:00 2001 From: aktersnurra Date: Mon, 15 Feb 2021 19:31:04 +0100 Subject: some vim commits and zsh --- .config/nvim/keys/which-key.vim | 292 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 292 insertions(+) create mode 100644 .config/nvim/keys/which-key.vim (limited to '.config/nvim/keys') diff --git a/.config/nvim/keys/which-key.vim b/.config/nvim/keys/which-key.vim new file mode 100644 index 0000000..c8cee0d --- /dev/null +++ b/.config/nvim/keys/which-key.vim @@ -0,0 +1,292 @@ +" Leader Key Maps + +let @s = 'veS"' + +" Timeout +let g:which_key_timeout = 100 + +let g:which_key_display_names = {'': '↵', '': '⇆'} + +" Map leader to which_key +nnoremap :silent :silent WhichKey '' +vnoremap :silent :silent WhichKeyVisual '' + +" Create map to add keys to +let g:which_key_map = {} +" Define a separator +let g:which_key_sep = '→' + +" Coc Search & refactor +nnoremap ? :CocSearch =expand("") +let g:which_key_map['?'] = 'search word' + +" Not a fan of floating windows for this +let g:which_key_use_floating_win = 0 +let g:which_key_max_size = 0 + + +" Change the colors if you want + +" Hide status line +autocmd! FileType which_key +autocmd FileType which_key set laststatus=0 noshowmode noruler + \| autocmd BufLeave set laststatus=2 noshowmode ruler + + +" Single mappings +let g:which_key_map['/'] = [ ':call Comment()' , 'comment' ] +let g:which_key_map['.'] = [ ':e $MYVIMRC' , 'open init' ] +let g:which_key_map[';'] = [ ':Commands' , 'commands' ] +let g:which_key_map['='] = [ '=' , 'balance windows' ] +let g:which_key_map['e'] = [ ':CocCommand explorer --toggle --sources=file+' , 'explorer' ] +let g:which_key_map['h'] = [ 's' , 'split below'] +let g:which_key_map['n'] = [ ':let @/ = ""' , 'no highlight' ] +let g:which_key_map['o'] = [ ':RnvimrToggle' , 'open' ] +let g:which_key_map['p'] = [ ':Files' , 'search files' ] +let g:which_key_map['q'] = [ '(coc-fix-current)' , 'quickfix' ] +let g:which_key_map['T'] = [ ':TSHighlightCapturesUnderCursor' , 'treesitter highlight' ] +let g:which_key_map['u'] = [ ':UndotreeToggle' , 'undo tree'] +let g:which_key_map['v'] = [ 'v' , 'split right'] +let g:which_key_map['W'] = [ ':call WindowSwap#EasyWindowSwap()' , 'move window' ] +let g:which_key_map['z'] = [ 'Goyo' , 'zen' ] + +" Group mappings + +" a is for actions +let g:which_key_map.a = { + \ 'name' : '+actions' , + \ 'c' : [':ColorizerToggle' , 'colorizer'], + \ 'e' : [':CocCommand explorer' , 'explorer'], + \ 'h' : [':let @/ = ""' , 'remove search highlight'], + \ 'l' : [':Bracey' , 'start live server'], + \ 'L' : [':BraceyStop' , 'stop live server'], + \ 'm' : [':MarkdownPreview' , 'markdown preview'], + \ 'M' : [':MarkdownPreviewStop' , 'markdown preview stop'], + \ 'n' : [':set nonumber!' , 'line-numbers'], + \ 's' : [':s/\%V\(.*\)\%V/"\1"/' , 'surround'], + \ 'r' : [':set norelativenumber!' , 'relative line nums'], + \ 't' : [':FloatermToggle' , 'terminal'], + \ 'v' : [':Codi' , 'virtual repl on'], + \ 'V' : [':Codi!' , 'virtual repl off'], + \ 'w' : [':StripWhitespace' , 'strip whitespace'], + \ } + +" b is for buffer +let g:which_key_map.b = { + \ 'name' : '+buffer' , + \ '>' : [':BufferMoveNext' , 'move next'], + \ '<' : [':BufferMovePrevious' , 'move prev'], + \ '1' : [':BufferGoto 1' , 'buffer 1'], + \ '2' : [':BufferGoto 2' , 'buffer 2'], + \ '3' : [':BufferGoto 3' , 'buffer 3'], + \ '4' : [':BufferGoto 4' , 'buffer 4'], + \ '5' : [':BufferGoto 5' , 'buffer 5'], + \ '6' : [':BufferGoto 6' , 'buffer 6'], + \ '7' : [':BufferGoto 7' , 'buffer 7'], + \ '8' : [':BufferGoto 8' , 'buffer 8'], + \ '9' : [':BufferGoto 9' , 'buffer 9'], + \ '0' : [':BufferGoto 0' , 'buffer 0'], + \ 'b' : [':BufferPick' , 'pick buffer'], + \ 'd' : [':Bdelete' , 'delete-buffer'], + \ 'D' : [':BufferOrderByDirectory', 'order by directory'], + \ 'f' : ['bfirst' , 'first-buffer'], + \ 'l' : ['blast' , 'last buffer'], + \ 'L' : [':BufferOrderByLanguage' , 'order by language'], + \ 'n' : ['bnext' , 'next-buffer'], + \ 'p' : ['bprevious' , 'previous-buffer'], + \ '?' : ['Buffers' , 'fzf-buffer'], + \ } + +" d is for debug +let g:which_key_map.d = { + \ 'name' : '+debug' , + \ 'b' : ['VimspectorToggleBreakpoint' , 'breakpoint'], + \ 'B' : ['VimspectorToggleConditionalBreakpoint' , 'conditional breakpoint'], + \ 'c' : ['VimspectorRunToCursor' , 'run to cursor'], + \ 'd' : ['VimspectorContinue' , 'continue'], + \ 'f' : ['VimspectorAddFunctionBreakpoint' , 'function breakpoint'], + \ 'm' : [':MaximizerToggle' , 'maximize window'], + \ 'o' : ['VimspectorStepOver' , 'step over'], + \ 'O' : ['VimspectorStepOut' , 'step out'], + \ 'i' : ['VimspectorStepInto' , 'step into'], + \ 'p' : ['VimspectorPause' , 'pause'], + \ 'r' : ['VimspectorRestart' , 'restart'], + \ 's' : ['VimspectorStop' , 'stop'], + \ } + +" f is for find and replace +let g:which_key_map.f = { + \ 'name' : '+find & replace' , + \ 'f' : [':Farr --source=vimgrep' , 'file'], + \ 'p' : [':Farr --source=rgnvim' , 'project'], + \ } + +" k is for task +let g:which_key_map.k = { + \ 'name' : '+task' , + \ 'c' : [':AsyncTask file-compile' , 'compile file'], + \ 'b' : [':AsyncTask project-build' , 'build project'], + \ 'e' : [':AsyncTaskEdit' , 'edit local tasks'], + \ 'f' : [':AsyncTaskFzf' , 'find task'], + \ 'g' : [':AsyncTaskEdit!' , 'edit global tasks'], + \ 'h' : [':AsyncTaskList!' , 'list hidden tasks'], + \ 'l' : [':CocList tasks' , 'list tasks'], + \ 'm' : [':AsyncTaskMacro' , 'macro help'], + \ 'o' : [':copen' , 'open task view'], + \ 'r' : [':AsyncTask file-run' , 'run file'], + \ 'p' : [':AsyncTask project-run' , 'run project'], + \ 'x' : [':cclose' , 'close task view'], + \ } + " \ 'l' : [':AsyncTaskList' , 'list tasks'], + +" m is for mark +let g:which_key_map.m = { + \ 'name' : '+mark' , + \ 'c' : [':CocCommand bookmark.clearForCurrentFile', 'clear file'], + \ 'C' : [':CocCommand bookmark.clearForAllFiles', 'clear project'], + \ 'j' : [':CocCommand bookmark.next', 'next bookmark'], + \ 'k' : [':CocCommand bookmark.prev', 'prev bookmark'], + \ 't' : [':CocCommand bookmark.toggle', 'toggle bookmark'], + \ } + + +" s is for search +let g:which_key_map.s = { + \ 'name' : '+search' , + \ '/' : [':History/' , 'history'], + \ ';' : [':FzfPreviewCommandPalette' , 'commands'], + \ 'a' : [':Ag' , 'text Ag'], + \ 'b' : [':CocCommand fzf-preview.BufferLines' , 'current buffer'], + \ 'B' : [':CocCommand fzf-preview.Buffers' , 'open buffers'], + \ 'c' : [':Commits' , 'commits'], + \ 'C' : [':BCommits' , 'buffer commits'], + \ 'd' : [':CocCommand fzf-preview.DirectoryFiles' , 'directories'], + \ 'f' : [':CocCommand fzf-preview.ProjectFiles' , 'files'], + \ 'g' : [':CocCommand fzf-preview.GitFiles' , 'git files'], + \ 'G' : [':GFiles?' , 'modified git files'], + \ 'h' : [':History' , 'file history'], + \ 'H' : [':History:' , 'command history'], + \ 'l' : [':Lines' , 'lines'] , + \ 'm' : [':CocCommand fzf-preview.Marks', 'list marks'], + \ 'M' : [':Maps' , 'normal maps'] , + \ 'p' : [':Helptags' , 'help tags'] , + \ 'P' : [':Tags' , 'project tags'], + \ 'q' : [':CocCommand fzf-preview.QuickFix' , 'quickfix list'], + \ 's' : [':CocList snippets' , 'snippets'], + \ 'S' : [':Colors' , 'color schemes'], + \ 't' : [':Rg' , 'text Rg'], + \ 'T' : [':BTags' , 'buffer tags'], + \ 'w' : [':Windows' , 'search windows'], + \ 'y' : [':Filetypes' , 'file types'], + \ 'z' : [':FZF' , 'FZF'], + \ } + +let g:which_key_map.S = { + \ 'name' : '+Session' , + \ 'c' : [':SClose' , 'Close Session'] , + \ 'd' : [':SDelete' , 'Delete Session'] , + \ 'l' : [':SLoad' , 'Load Session'] , + \ 's' : [':Startify' , 'Start Page'] , + \ 'S' : [':SSave' , 'Save Session'] , + \ } + +" g is for git +let g:which_key_map.g = { + \ 'name' : '+git' , + \ 'a' : [':Git add .' , 'add all'], + \ 'A' : [':CocCommand fzf-preview.GitStatus' , 'actions'], + \ 'b' : [':Git blame' , 'blame'], + \ 'B' : [':GBrowse' , 'browse'], + \ 'c' : [':Git commit' , 'commit'], + \ 'd' : [':Git diff' , 'diff'], + \ 'D' : [':Gdiffsplit' , 'diff split'], + \ 'g' : [':GGrep' , 'git grep'], + \ 'G' : [':Gstatus' , 'status'], + \ 'h' : [':GitGutterLineHighlightsToggle' , 'highlight hunks'], + \ 'H' : ['(GitGutterPreviewHunk)' , 'preview hunk'], + \ 'i' : [':Gist -b' , 'post gist'], + \ 'j' : ['(GitGutterNextHunk)' , 'next hunk'], + \ 'k' : ['(GitGutterPrevHunk)' , 'prev hunk'], + \ 'l' : [':Git log' , 'log'], + \ 'm' : ['(git-messenger)' , 'message'], + \ 'p' : [':Git push' , 'push'], + \ 'P' : [':Git pull' , 'pull'], + \ 'r' : [':GRemove' , 'remove'], + \ 's' : ['(GitGutterStageHunk)' , 'stage hunk'], + \ 'S' : [':CocCommand fzf-preview.GitStatus' , 'status'], + \ 't' : [':GitGutterSignsToggle' , 'toggle signs'], + \ 'u' : ['(GitGutterUndoHunk)' , 'undo hunk'], + \ 'v' : [':GV' , 'view commits'], + \ 'V' : [':GV!' , 'view buffer commits'], + \ } + +let g:which_key_map.G = { + \ 'name' : '+gist' , + \ 'a' : [':Gist -a' , 'post gist anon'], + \ 'b' : [':Gist -b' , 'post gist browser'], + \ 'd' : [':Gist -d' , 'delete gist'], + \ 'e' : [':Gist -e' , 'edit gist'], + \ 'l' : [':Gist -l' , 'list public gists'], + \ 's' : [':Gist -ls' , 'list starred gists'], + \ 'm' : [':Gist -m' , 'post gist all buffers'], + \ 'p' : [':Gist -P' , 'post public gist '], + \ 'P' : [':Gist -p' , 'post private gist '], + \ } + +" l is for language server protocol +let g:which_key_map.l = { + \ 'name' : '+lsp' , + \ '.' : [':CocConfig' , 'config'], + \ ';' : ['(coc-refactor)' , 'refactor'], + \ 'a' : ['(coc-codeaction)' , 'code action'], + \ 'A' : ['(coc-codeaction-selected)' , 'selected action'], + \ 'b' : [':CocNext' , 'next action'], + \ 'B' : [':CocPrev' , 'prev action'], + \ 'c' : [':CocList commands' , 'commands'], + \ 'd' : ['(coc-definition)' , 'definition'], + \ 'D' : ['(coc-declaration)' , 'declaration'], + \ 'e' : [':CocList extensions' , 'extensions'], + \ 'f' : ['(coc-format-selected)' , 'format selected'], + \ 'F' : ['(coc-format)' , 'format'], + \ 'h' : ['(coc-float-hide)' , 'hide'], + \ 'i' : ['(coc-implementation)' , 'implementation'], + \ 'I' : [':CocList diagnostics' , 'diagnostics'], + \ 'j' : ['(coc-float-jump)' , 'float jump'], + \ 'l' : ['(coc-codelens-action)' , 'code lens'], + \ 'n' : ['(coc-diagnostic-next)' , 'next diagnostic'], + \ 'N' : ['(coc-diagnostic-next-error)' , 'next error'], + \ 'o' : [':Vista!!' , 'outline'], + \ 'O' : [':CocList outline' , 'search outline'], + \ 'p' : ['(coc-diagnostic-prev)' , 'prev diagnostic'], + \ 'P' : ['(coc-diagnostic-prev-error)' , 'prev error'], + \ 'q' : ['(coc-fix-current)' , 'quickfix'], + \ 'r' : ['(coc-references)' , 'references'], + \ 'R' : ['(coc-rename)' , 'rename'], + \ 's' : [':CocList -I symbols' , 'references'], + \ 'S' : [':CocList snippets' , 'snippets'], + \ 't' : ['(coc-type-definition)' , 'type definition'], + \ 'u' : [':CocListResume' , 'resume list'], + \ 'U' : [':CocUpdate' , 'update CoC'], + \ 'z' : [':CocDisable' , 'disable CoC'], + \ 'Z' : [':CocEnable' , 'enable CoC'], + \ } + +" t is for terminal +let g:which_key_map.t = { + \ 'name' : '+terminal' , + \ ';' : [':FloatermNew --wintype=normal --height=6' , 'terminal'], + \ 'f' : [':FloatermNew fzf' , 'fzf'], + \ 'g' : [':FloatermNew lazygit' , 'git'], + \ 'd' : [':FloatermNew lazydocker' , 'docker'], + \ 'n' : [':FloatermNew node' , 'node'], + \ 'N' : [':FloatermNew nnn' , 'nnn'], + \ 'p' : [':FloatermNew python' , 'python'], + \ 'm' : [':FloatermNew lazynpm' , 'npm'], + \ 'r' : [':FloatermNew ranger' , 'ranger'], + \ 't' : [':FloatermToggle' , 'toggle'], + \ 'y' : [':FloatermNew ytop' , 'ytop'], + \ 's' : [':FloatermNew ncdu' , 'ncdu'], + \ } + +" Register which key map +call which_key#register('', "g:which_key_map") -- cgit v1.2.3-70-g09d2