"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'] , "\ } "\ } "\ 's' : [ ':CocFzfList symbols' , 'list symbols' ] , " Maps for code actions "let g:which_key_map['m'] = { "\ 'name' : '+Code-actions' , "\ 'd' : [ ':call luaeval("vim.lsp.buf.hover()")' , 'show documentation' ] , "\ 'b' : [ ':Lspsaga lsp_finder' , 'find stuff' ] , "\ 'x' : [ ':Lspsaga preview_definition' , 'Preview definition' ] , "\ 'o' : [ ':Telescope lsp_document_symbols' , 'symbols in document' ] , "\ 's' : [ ':Telescope lsp_workspace_symbols' , 'symbols in workspace' ] , "\ 'g' : [ ':call luaeval("vim.lsp.buf.definition()")' , 'go to definition' ] , "\ 't' : [ ':call luaeval("vim.lsp.buf.signature_help()")' , 'Show signature help' ] , "\ 'i' : [ ':call luaeval("vim.lsp.buf.implementation()")' , 'show implementation' ] , "\ 'r' : [ ':call luaeval("vim.lsp.buf.references()")' , 'show references' ] , "\ 'n' : [ ':call luaeval("vim.lsp.buf.rename()")' , 'rename' ] , "\ 'f' : [ ':call luaeval("vim.lsp.buf.formatting()")' , 'format file' ] , "\ 'v' : [ ':call luaeval("vim.lsp.buf.code_action()")' , 'apply codeaction' ] , "\ 'e' : [ ':call luaeval("vim.lsp.diagnostic.goto_next()")' , 'Jump to next error' ] , "\ 'E' : [ ':call luaeval("vim.lsp.diagnostic.goto_prev()")' , 'Jump to previous error' ] , "\ 'a' : [ ':call luaeval("vim.lsp.diagnostic.show_line_diagnostics()")' , 'diagnostics info' ] , "\ } " this is the one! "let g:which_key_map['m'] = { "\ 'name' : '+Code-actions' , "\ 'd' : [ ':Lspsaga hover_doc' , 'show documentation' ] , "\ 'b' : [ ':Lspsaga lsp_finder' , 'find stuff' ] , "\ 'x' : [ ':Lspsaga preview_definition' , 'Preview definition' ] , "\ 'o' : [ ':Telescope lsp_document_symbols' , 'symbols in document' ] , "\ 's' : [ ':Telescope lsp_workspace_symbols' , 'symbols in workspace' ] , "\ 'g' : [ ':call luaeval("vim.lsp.buf.definition()")' , 'go to definition' ] , "\ 't' : [ ':Lspsaga signature_help' , 'Show signature help' ] , "\ 'i' : [ ':call luaeval("vim.lsp.buf.implementation()")' , 'show implementation' ] , "\ 'r' : [ ':call luaeval("vim.lsp.buf.references()")' , 'show references' ] , "\ 'n' : [ ':Lspsaga rename' , 'rename' ] , "\ 'f' : [ ':call luaeval("vim.lsp.buf.formatting()")' , 'format file' ] , "\ 'v' : [ ':Lspsaga code_action' , 'apply codeaction' ] , "\ 'e' : [ ':call luaeval("vim.lsp.diagnostic.goto_next()")' , 'Jump to the next error' ] , "\ 'E' : [ ':Telescope lsp_workspace_diagnostics' , 'List diagnostics' ] , "\ 'a' : [ ':Lspsaga show_cursor_diagnostics' , 'Cursor diagnostics' ] , "\ 'A' : [ ':Lspsaga show_line_diagnostics' , 'Line diagnostics' ] , "\ } "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' ] , "\ } "" 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