2020-05-11 18:58:20 +02:00
|
|
|
" Map leader to which_key
|
|
|
|
nnoremap <silent> <leader> :silent WhichKey '<Space>'<CR>
|
|
|
|
vnoremap <silent> <leader> :silent <c-u> :silent WhichKeyVisual '<Space>'<CR>
|
|
|
|
|
|
|
|
" Create map to add keys to
|
2020-05-10 19:29:31 +02:00
|
|
|
let g:which_key_map = {}
|
2020-05-11 18:58:20 +02:00
|
|
|
" Define a separator
|
2020-05-10 19:29:31 +02:00
|
|
|
let g:which_key_sep = '→'
|
|
|
|
" set timeoutlen=100
|
2020-05-09 06:36:34 +02:00
|
|
|
|
2020-05-11 05:27:51 +02:00
|
|
|
|
2020-05-09 06:36:34 +02:00
|
|
|
" Not a fan of floating windows for this
|
|
|
|
let g:which_key_use_floating_win = 0
|
|
|
|
|
2020-05-10 19:29:31 +02:00
|
|
|
" Change the colors if you want
|
2020-05-09 06:36:34 +02:00
|
|
|
highlight default link WhichKey Operator
|
|
|
|
highlight default link WhichKeySeperator DiffAdded
|
|
|
|
highlight default link WhichKeyGroup Identifier
|
|
|
|
highlight default link WhichKeyDesc Function
|
|
|
|
|
|
|
|
" Hide status line
|
|
|
|
autocmd! FileType which_key
|
|
|
|
autocmd FileType which_key set laststatus=0 noshowmode noruler
|
2020-05-10 19:29:31 +02:00
|
|
|
\| autocmd BufLeave <buffer> set laststatus=2 noshowmode ruler
|
|
|
|
|
2020-05-12 00:48:29 +02:00
|
|
|
" Single mappings
|
2020-05-11 18:58:20 +02:00
|
|
|
let g:which_key_map['/'] = [ '<Plug>NERDCommenterToggle' , 'comment' ]
|
|
|
|
let g:which_key_map['.'] = [ ':e $MYVIMRC' , 'open init' ]
|
2020-05-11 01:23:44 +02:00
|
|
|
let g:which_key_map[';'] = [ ':Commands' , 'commands' ]
|
2020-05-11 18:58:20 +02:00
|
|
|
let g:which_key_map['='] = [ '<C-W>=' , 'balance windows' ]
|
2020-05-11 01:23:44 +02:00
|
|
|
let g:which_key_map['d'] = [ ':bd' , 'delete buffer']
|
|
|
|
let g:which_key_map['e'] = [ ':CocCommand explorer' , 'explorer' ]
|
2020-05-11 18:58:20 +02:00
|
|
|
let g:which_key_map['f'] = [ ':Files' , 'search files' ]
|
2020-05-11 01:23:44 +02:00
|
|
|
let g:which_key_map['h'] = [ '<C-W>s' , 'split below']
|
|
|
|
let g:which_key_map['q'] = [ 'q' , 'quit' ]
|
2020-05-12 22:09:40 +02:00
|
|
|
let g:which_key_map['r'] = [ ':RnvimrToggle' , 'ranger' ]
|
2020-05-11 05:27:51 +02:00
|
|
|
let g:which_key_map['S'] = [ ':Startify' , 'start screen' ]
|
2020-05-11 18:58:20 +02:00
|
|
|
let g:which_key_map['T'] = [ ':Rg' , 'search text' ]
|
2020-05-11 01:23:44 +02:00
|
|
|
let g:which_key_map['v'] = [ '<C-W>v' , 'split right']
|
2020-05-11 18:58:20 +02:00
|
|
|
let g:which_key_map['w'] = [ 'w' , 'write' ]
|
2020-05-11 01:23:44 +02:00
|
|
|
let g:which_key_map['z'] = [ 'Goyo' , 'zen' ]
|
|
|
|
|
2020-05-12 00:48:29 +02:00
|
|
|
" Group mappings
|
|
|
|
|
|
|
|
" b is for buffer
|
2020-05-11 18:58:20 +02:00
|
|
|
let g:which_key_map.b = {
|
|
|
|
\ 'name' : '+buffer' ,
|
|
|
|
\ '1' : ['b1' , 'buffer 1'] ,
|
|
|
|
\ '2' : ['b2' , 'buffer 2'] ,
|
|
|
|
\ 'd' : ['bd' , 'delete-buffer'] ,
|
|
|
|
\ 'f' : ['bfirst' , 'first-buffer'] ,
|
|
|
|
\ 'h' : ['Startify' , 'home-buffer'] ,
|
|
|
|
\ 'l' : ['blast' , 'last-buffer'] ,
|
|
|
|
\ 'n' : ['bnext' , 'next-buffer'] ,
|
|
|
|
\ 'p' : ['bprevious' , 'previous-buffer'] ,
|
|
|
|
\ '?' : ['Buffers' , 'fzf-buffer'] ,
|
|
|
|
\ }
|
|
|
|
|
|
|
|
" s is for search
|
|
|
|
let g:which_key_map.s = {
|
|
|
|
\ 'name' : '+search' ,
|
2020-05-10 19:29:31 +02:00
|
|
|
\ '/' : [':History/' , 'history'],
|
|
|
|
\ ';' : [':Commands' , 'commands'],
|
|
|
|
\ 'a' : [':Ag' , 'text Ag'],
|
|
|
|
\ 'b' : [':BLines' , 'current buffer'],
|
|
|
|
\ 'B' : [':Buffers' , 'open buffers'],
|
|
|
|
\ 'c' : [':Commits' , 'commits'],
|
|
|
|
\ 'C' : [':BCommits' , 'buffer commits'],
|
|
|
|
\ 'f' : [':Files' , 'files'],
|
|
|
|
\ 'g' : [':GFiles' , 'git files'],
|
|
|
|
\ 'G' : [':GFiles?' , 'modified git files'],
|
|
|
|
\ 'h' : [':History' , 'file history'],
|
|
|
|
\ 'H' : [':History:' , 'command history'],
|
|
|
|
\ 'l' : [':Lines' , 'lines'] ,
|
|
|
|
\ 'm' : [':Marks' , 'marks'] ,
|
|
|
|
\ 'M' : [':Maps' , 'normal maps'] ,
|
|
|
|
\ 'p' : [':Helptags' , 'help tags'] ,
|
2020-05-11 18:58:20 +02:00
|
|
|
\ 'P' : [':Tags' , 'project tags'],
|
2020-05-10 19:29:31 +02:00
|
|
|
\ 's' : [':Snippets' , 'snippets'],
|
|
|
|
\ 'S' : [':Colors' , 'color schemes'],
|
2020-05-11 18:58:20 +02:00
|
|
|
\ 't' : [':Rg' , 'text Rg'],
|
2020-05-10 19:29:31 +02:00
|
|
|
\ 'T' : [':BTags' , 'buffer tags'],
|
|
|
|
\ 'w' : [':Windows' , 'search windows'],
|
|
|
|
\ 'y' : [':Filetypes' , 'file types'],
|
|
|
|
\ 'z' : [':FZF' , 'FZF'],
|
|
|
|
\ }
|
2020-05-11 01:23:44 +02:00
|
|
|
|
|
|
|
" g is for git
|
|
|
|
let g:which_key_map.g = {
|
|
|
|
\ 'name' : '+git' ,
|
2020-05-11 05:27:51 +02:00
|
|
|
\ 'a' : [':Git add .' , 'add all'],
|
|
|
|
\ 'A' : [':Git add %' , 'add current'],
|
|
|
|
\ 'b' : [':Git blame' , 'blame'],
|
|
|
|
\ 'B' : [':GBrowse' , 'browse'],
|
|
|
|
\ 'c' : [':Git commit -m "autocommit"' , 'commit'],
|
|
|
|
\ 'd' : [':Git diff' , 'diff'],
|
|
|
|
\ 'D' : [':Gdiffsplit' , 'diff split'],
|
|
|
|
\ 'g' : [':GGrep' , 'git grep'],
|
|
|
|
\ 'G' : [':Gstatus' , 'status'],
|
|
|
|
\ 'h' : [':GitGutterLineHighlightsToggle' , 'highlight hunks'],
|
|
|
|
\ 'H' : ['<Plug>(GitGutterPreviewHunk)' , 'preview hunk'],
|
|
|
|
\ 'j' : ['<Plug>(GitGutterNextHunk)' , 'next hunk'],
|
|
|
|
\ 'k' : ['<Plug>(GitGutterPrevHunk)' , 'prev hunk'],
|
|
|
|
\ 'l' : [':Git log' , 'log'],
|
|
|
|
\ 'p' : [':Git push' , 'push'],
|
|
|
|
\ 'P' : [':Git pull' , 'pull'],
|
|
|
|
\ 'r' : [':GRemove' , 'remove'],
|
|
|
|
\ 's' : ['<Plug>(GitGutterStageHunk)' , 'stage hunk'],
|
|
|
|
\ 't' : [':GitGutterSignsToggle' , 'toggle signs'],
|
|
|
|
\ 'u' : ['<Plug>(GitGutterUndoHunk)' , 'undo hunk'],
|
|
|
|
\ 'v' : [':GV' , 'view commits'],
|
|
|
|
\ 'V' : [':GV!' , 'view buffer commits'],
|
2020-05-11 01:23:44 +02:00
|
|
|
\ }
|
2020-05-10 19:29:31 +02:00
|
|
|
|
|
|
|
" l is for language server protocol
|
|
|
|
let g:which_key_map.l = {
|
|
|
|
\ 'name' : '+lsp' ,
|
|
|
|
\ '.' : [':CocConfig' , 'config'],
|
|
|
|
\ ';' : ['<Plug>(coc-refactor)' , 'refactor'],
|
|
|
|
\ 'a' : ['<Plug>(coc-codeaction)' , 'line action'],
|
|
|
|
\ 'A' : ['<Plug>(coc-codeaction-selected)' , 'selected action'],
|
|
|
|
\ 'b' : [':CocNext' , 'next action'],
|
|
|
|
\ 'B' : [':CocPrev' , 'prev action'],
|
|
|
|
\ 'c' : [':CocList commands' , 'commands'],
|
|
|
|
\ 'd' : ['<Plug>(coc-definition)' , 'definition'],
|
|
|
|
\ 'D' : ['<Plug>(coc-declaration)' , 'declaration'],
|
|
|
|
\ 'e' : [':CocList extensions' , 'extensions'],
|
|
|
|
\ 'f' : ['<Plug>(coc-format-selected)' , 'format selected'],
|
|
|
|
\ 'F' : ['<Plug>(coc-format)' , 'format'],
|
|
|
|
\ 'h' : ['<Plug>(coc-float-hide)' , 'hide'],
|
|
|
|
\ 'i' : ['<Plug>(coc-implementation)' , 'implementation'],
|
|
|
|
\ 'I' : [':CocList diagnostics' , 'diagnostics'],
|
|
|
|
\ 'j' : ['<Plug>(coc-float-jump)' , 'float jump'],
|
|
|
|
\ 'l' : ['<Plug>(coc-codelens-action)' , 'code lens'],
|
|
|
|
\ 'n' : ['<Plug>(coc-diagnostic-next)' , 'next diagnostic'],
|
|
|
|
\ 'N' : ['<Plug>(coc-diagnostic-next-error)' , 'next error'],
|
|
|
|
\ 'o' : ['<Plug>(coc-openlink)' , 'open link'],
|
|
|
|
\ 'O' : [':CocList outline' , 'outline'],
|
|
|
|
\ 'p' : ['<Plug>(coc-diagnostic-prev)' , 'prev diagnostic'],
|
|
|
|
\ 'P' : ['<Plug>(coc-diagnostic-prev-error)' , 'prev error'],
|
|
|
|
\ 'q' : ['<Plug>(coc-fix-current)' , 'quickfix'],
|
|
|
|
\ 'r' : ['<Plug>(coc-rename)' , 'rename'],
|
|
|
|
\ 'R' : ['<Plug>(coc-references)' , 'references'],
|
|
|
|
\ 's' : [':CocList -I symbols' , 'references'],
|
|
|
|
\ 't' : ['<Plug>(coc-type-definition)' , 'type definition'],
|
|
|
|
\ 'u' : [':CocListResume' , 'resume list'],
|
|
|
|
\ 'U' : [':CocUpdate' , 'update CoC'],
|
2020-05-10 22:20:02 +02:00
|
|
|
\ 'v' : [':Vista!!' , 'tag viewer'],
|
2020-05-10 19:29:31 +02:00
|
|
|
\ 'z' : [':CocDisable' , 'disable CoC'],
|
|
|
|
\ 'Z' : [':CocEnable' , 'enable CoC'],
|
|
|
|
\ }
|
|
|
|
|
|
|
|
|
|
|
|
" t is for toggle
|
|
|
|
let g:which_key_map.t = {
|
|
|
|
\ 'name' : '+toggle' ,
|
2020-05-10 22:20:02 +02:00
|
|
|
\ 'c' : [':ColorizerToggle' , 'colorizer'],
|
2020-05-10 19:29:31 +02:00
|
|
|
\ 'e' : [':CocCommand explorer' , 'explorer'],
|
|
|
|
\ 'n' : [':set nonumber!' , 'line-numbers'],
|
2020-05-10 22:20:02 +02:00
|
|
|
\ 'r' : [':set norelativenumber!' , 'relative line nums'],
|
|
|
|
\ 's' : [':let @/ = ""' , 'remove search highlight'],
|
2020-05-10 19:29:31 +02:00
|
|
|
\ 't' : [':FloatermToggle' , 'terminal'],
|
2020-05-10 22:20:02 +02:00
|
|
|
\ 'v' : [':Vista!!' , 'tag viewer'],
|
2020-05-10 19:29:31 +02:00
|
|
|
\ }
|
|
|
|
|
2020-05-11 18:58:20 +02:00
|
|
|
" Register which key map
|
2020-05-10 19:29:31 +02:00
|
|
|
call which_key#register('<Space>', "g:which_key_map")
|
2020-05-11 01:23:44 +02:00
|
|
|
|
2020-05-09 06:36:34 +02:00
|
|
|
|