nnoremap :WhichKey '' vnoremap :'WhichKeyVisual '' let g:which_key_map = {} call which_key#register('', "g:which_key_map") "\ 'h' : 'which_key_ignore', 'l' : 'which_key_ignore' , "\ 'h' : ':bprevious', 'l' : ':bnext' , "\ 'h' : [':BufferPrevious', 'prev buffer'], 'l' : [':BufferNext', 'next buffer'] , let g:which_key_map = { \ 'h' : [':bprevious', 'prev buffer'], 'l' : [':bnext', 'next buffer'], \ 'f' : 'which_key_ignore', 's': 'which_key_ignore' , \ 'c' : { 'name': '+comment_out' }, \ 'e' : { 'name': '+emmet' }, \ '[' : ['(YoinkPostPasteSwapBack)', 'Swap last paste backwards' ], \ ']' : ['(YoinkPostPasteSwapForward)', 'Swap last paste backwards' ], \ ':' : [':Commands' , 'Search command with fzf' ], \ 'z' : { 'name': '+folds', 'c': ['foldclose', 'close fold'], \ 'o': ['foldopen', 'open fold'] , \ } \ } " Maps for code actions let g:which_key_map['m'] = { \ 'name' : '+Code-actions' , \ 'd' : [ ':call Show_documentation()' , 'show documentation' ] , \ 's' : [ ':CocFzfList symbols' , 'list symbols' ] , \ 'o' : [ ':CocFzfList outline' , 'show outline' ] , \ 'c' : [ ':CocFzfList commands' , 'show all coc-commands' ] , \ 'g' : [ '(coc-definition)' , 'go to definition' ] , \ 't' : [ '(coc-type-definition)' , 'show type definition' ] , \ 'i' : [ '(coc-implementation)' , 'show implementation' ] , \ 'r' : [ '(coc-references-used)' , 'show references' ] , \ 'b' : [ '(coc-refactor)' , 'refactor' ] , \ 'n' : [ '(coc-rename)' , 'rename' ] , \ 'F' : [ '(coc-format-selected)' , 'format selection' ] , \ 'f' : [ '(coc-format)' , 'format file' ] , "\ 'v' : [ ':CocCommand actions.open' , 'apply codeaction' ] , \ 'v' : [ '(coc-codeaction-cursor)', 'apply codeaction' ] , \ 'V' : [ '(coc-codeaction-line)' , 'codeaction current line'] , \ 'e' : [ ':CocList diagnostics' , 'list all errors' ] , \ 'L' : [ '(coc-diagnostic-next)' , 'go to next error' ] , \ 'H' : [ '(coc-diagnostic-prev)' , 'go to prev error' ] , \ 'a' : [ '(coc-diagnostic-info)' , 'diagnostics info' ] , \ 'O' : [ '(coc-openlink)' , 'open link under cursor' ] , \} let g:which_key_map['f'] = { \ 'name': '+folds', \ 'o': [ ':foldopen' , 'open fold' ] , \ 'n': [ ':foldclose' , 'close fold' ] , \ 'j': [ 'zj' , 'jump to next fold' ] , \ 'k': [ 'zk' , 'jump to previous fold' ] , \ } let g:which_key_map['a'] = { \ 'name': '+Bookmarks', \ ' ' : ['(coc-bookmark-toggle)' , 'toggle bookmark' ] , \ 'a' : ['(coc-bookmark-annotate)' , 'annotate bookmark' ] , \ 'j' : ['(coc-bookmark-next)' , 'next bookmark' ] , \ 'k' : ['(coc-bookmark-prev)' , 'prev bookmark' ] , \ 'l' : [':CocList bookmark' , 'list bookmarks' ] , \ 'c' : [':CocCommand bookmark.clearForCurrentFile' , 'clear for current file' ] , \ 'C' : [':CocCommand bookmark.clearForAllFiles' , 'clear for all files' ] \} " mappings for view and layout let g:which_key_map['v'] = { \ 'name' : '+view-and-layout', \ 'n' : [':set relativenumber!' , 'toggle relative numbers' ] , \ 'm' : [':set nonumber! norelativenumber' , 'toggle numbers'] , \ 'g' : [':Goyo | set linebreak' , 'toggle focus mode' ] , \ 'i' : [':IndentGuidesToggle' , 'toggle indent guides' ] , \ } " :bwipeout! bdelete! "\ 'b' : ['BufferPick' , 'select open buffer' ] , "\ 'c' : ['BufferClose', 'close open buffer' ] , "\ 'w' : ['BufferWipeout', 'wipeout open buffer' ] , let g:which_key_map['b'] = { \ 'name': '+buffers', \ 'b' : [':Buffers' , 'select open buffer' ] , \ 'c' : [':bdelete!', 'close open buffer' ] , \ 'w' : [':bwipeout!', 'wipeout open buffer' ] , \ } let g:which_key_map['x'] = { \ 'name' : '+other', \ 'f' : ['NERDTreeToggle' , ' show file tree'], \ 'p' : ['FZF' , ' search file (c-v/c-x to open in split)' ] , \ 'h' : [':History:' , 'search command history'], \ 'c' : [':Commands' , 'search through commands'], \ 's' : ['OverCommandLine', 'Substitute with preview'], \ 'y' : [':CocFzfList yank', 'Show yank history'] \ } " CocList -A --normal yank needs :CocInstall coc-yank "nnoremap m :WhichKey 'm' autocmd! VimEnter * :unmap ig autocmd! FileType which_key "autocmd! FileType which_key set laststatus=2 noshowmode noruler "\| autocmd! BufLeave set laststatus=2 showmode ruler set timeoutlen=200