dots-of-war/whichkeyConfig.vim

109 lines
5 KiB
VimL
Raw Normal View History

2020-08-06 19:20:51 +00:00
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
vnoremap <silent> <leader> :<c-u>'WhichKeyVisual '<Space>'<CR>
let g:which_key_map = {}
call which_key#register('<Space>', "g:which_key_map")
2020-11-07 13:06:08 +00:00
2020-11-20 17:17:11 +00:00
2021-02-16 18:00:01 +00:00
"\ 'h' : 'which_key_ignore', 'l' : 'which_key_ignore' ,
"\ 'h' : ':bprevious', 'l' : ':bnext' ,
2020-08-06 19:20:51 +00:00
let g:which_key_map = {
2021-02-16 18:00:01 +00:00
\ 'h' : [':BufferPrevious', 'prev buffer'], 'l' : [':BufferNext', 'next buffer'] ,
\ 'f' : 'which_key_ignore', 's': 'which_key_ignore' ,
2020-08-06 19:20:51 +00:00
\ 'c' : { 'name': '+comment_out' },
\ 'e' : { 'name': '+emmet' },
2020-11-20 17:17:11 +00:00
\ '[' : ['<Plug>(YoinkPostPasteSwapBack)', 'Swap last paste backwards' ],
\ ']' : ['<Plug>(YoinkPostPasteSwapForward)', 'Swap last paste backwards' ],
2021-02-16 18:00:01 +00:00
\ ':' : [':Commands' , 'Search command with fzf' ],
2020-08-06 19:20:51 +00:00
\ 'z' : { 'name': '+folds', 'c': ['foldclose', 'close fold'],
2020-11-20 17:17:11 +00:00
\ 'o': ['foldopen', 'open fold'] ,
2020-08-06 19:20:51 +00:00
\ }
\ }
" Maps for code actions
let g:which_key_map['m'] = {
\ 'name' : '+Code-actions' ,
\ 'd' : [ ':call Show_documentation()' , 'show documentation' ] ,
2020-11-20 17:17:11 +00:00
\ 's' : [ ':CocFzfList symbols' , 'list symbols' ] ,
2020-11-21 15:04:14 +00:00
\ 'o' : [ ':CocFzfList outline' , 'show outline' ] ,
\ 'c' : [ ':CocFzfList commands' , 'show all coc-commands' ] ,
2020-08-06 19:20:51 +00:00
\ 'g' : [ '<Plug>(coc-definition)' , 'go to definition' ] ,
\ 't' : [ '<Plug>(coc-type-definition)' , 'show type definition' ] ,
\ 'i' : [ '<Plug>(coc-implementation)' , 'show implementation' ] ,
2020-11-21 15:04:14 +00:00
\ 'r' : [ '<Plug>(coc-references-used)' , 'show references' ] ,
2020-11-07 13:06:08 +00:00
\ 'b' : [ '<Plug>(coc-refactor)' , 'refactor' ] ,
2020-08-06 19:20:51 +00:00
\ 'n' : [ '<Plug>(coc-rename)' , 'rename' ] ,
\ 'F' : [ '<Plug>(coc-format-selected)' , 'format selection' ] ,
\ 'f' : [ '<Plug>(coc-format)' , 'format file' ] ,
2021-02-16 18:00:01 +00:00
"\ 'v' : [ ':CocCommand actions.open' , 'apply codeaction' ] ,
\ 'v' : [ '<Plug>(coc-codeaction)' , 'apply codeaction' ] ,
2020-11-21 15:04:14 +00:00
\ 'V' : [ '<Plug>(coc-codeaction)' , 'codeaction current buffer' ] ,
2020-08-06 19:20:51 +00:00
\ 'e' : [ ':CocList diagnostics' , 'list all errors' ] ,
2020-11-21 15:04:14 +00:00
\ 'L' : [ '<Plug>(coc-diagnostic-next)' , 'go to next error' ] ,
\ 'H' : [ '<Plug>(coc-diagnostic-prev)' , 'go to prev error' ] ,
\ 'a' : [ '<Plug>(coc-diagnostic-info)' , 'diagnostics info' ] ,
\ 'O' : [ '<Plug>(coc-openlink)' , 'open link under cursor' ] ,
2020-08-06 19:20:51 +00:00
\}
2020-11-07 13:06:08 +00:00
2020-11-21 16:38:51 +00:00
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' ] ,
\ }
2020-08-06 19:20:51 +00:00
let g:which_key_map['a'] = {
\ 'name': '+Bookmarks',
\ ' ' : ['<Plug>(coc-bookmark-toggle)' , 'toggle bookmark' ] ,
\ 'a' : ['<Plug>(coc-bookmark-annotate)' , 'annotate bookmark' ] ,
\ 'j' : ['<Plug>(coc-bookmark-next)' , 'next bookmark' ] ,
\ 'k' : ['<Plug>(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' ] ,
\ }
2021-02-16 18:00:01 +00:00
" :bwipeout! bdelete!
2020-08-06 19:20:51 +00:00
let g:which_key_map['b'] = {
2021-02-16 18:00:01 +00:00
\ 'name': '+buffers',
\ 'b' : ['BufferPick' , 'select open buffer' ] ,
\ 'c' : ['BufferClose', 'close open buffer' ] ,
\ 'w' : ['BufferWipeout', 'wipeout open buffer' ] ,
2020-08-06 19:20:51 +00:00
\ }
let g:which_key_map['x'] = {
\ 'name' : '+other',
\ 'f' : ['NERDTreeToggle' , '<Ctrl+F> show file tree'],
\ 'p' : ['FZF' , '<Ctrl+p> 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'],
2020-11-21 15:04:14 +00:00
\ 'y' : [':CocFzfList yank', 'Show yank history']
2020-08-06 19:20:51 +00:00
\ }
" CocList -A --normal yank needs :CocInstall coc-yank
"nnoremap <silent> m :<c-u>WhichKey 'm'<CR>
autocmd! VimEnter * :unmap <space>ig
autocmd! FileType which_key
2020-11-21 15:04:14 +00:00
"autocmd! FileType which_key set laststatus=2 noshowmode noruler
"\| autocmd! BufLeave <buffer> set laststatus=2 showmode ruler
2020-08-25 17:45:43 +00:00
2020-08-06 19:20:51 +00:00
set timeoutlen=200