From 2cd8c6a21cb6c9af91e631f565e31f5803cdaa7c Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Thu, 15 Apr 2021 00:17:48 -0400 Subject: LunarVim --- vimscript/functions.vim | 54 +++++---- vimscript/lv-vscode/init.vim | 119 ++++++++++++++++++++ vimscript/lv-whichkey/init.vim | 140 ++++++++++++++++++++++++ vimscript/nv-vscode/init.vim | 119 -------------------- vimscript/nv-whichkey/init.vim | 242 ----------------------------------------- 5 files changed, 284 insertions(+), 390 deletions(-) create mode 100644 vimscript/lv-vscode/init.vim create mode 100644 vimscript/lv-whichkey/init.vim delete mode 100644 vimscript/nv-vscode/init.vim delete mode 100644 vimscript/nv-whichkey/init.vim (limited to 'vimscript') diff --git a/vimscript/functions.vim b/vimscript/functions.vim index c1905971..78da3589 100644 --- a/vimscript/functions.vim +++ b/vimscript/functions.vim @@ -1,28 +1,28 @@ -command! LspCodeAction lua require 'nv-utils'.code_action() -command! LspDeclaration lua require 'nv-utils'.declaration() -command! LspDefinition lua require 'nv-utils'.definition() -command! LspDocumentSymbol lua require 'nv-utils'.document_symbol() -command! LspFormatting lua require 'nv-utils'.formatting() -command! LspFormattingSync lua require 'nv-utils'.formatting_sync() -command! LspHover lua require 'nv-utils'.hover() -command! LspImplementation lua require 'nv-utils'.implementation() -command! LspRangeCodeAction lua require 'nv-utils'.range_code_action() -command! LspRangeFormatting lua require 'nv-utils'.range_formatting() -command! LspReferences lua require 'nv-utils'.references() -command! LspRename lua require 'nv-utils'.rename() -command! LspTypeDefinition lua require 'nv-utils'.type_definition() -command! LspWorkspaceSymbol lua require 'nv-utils'.workspace_symbol() -command! LspGotoNext lua require 'nv-utils'.goto_next() -command! LspGotoPrev lua require 'nv-utils'.goto_prev() -command! LspShowLineDiagnostics lua require 'nv-utils'.show_line_diagnostics() -command! NextHunk lua require 'nv-utils'.next_hunk() -command! PrevHunk lua require 'nv-utils'.prev_hunk() -command! StageHunk lua require 'nv-utils'.stage_hunk() -command! UndoStageHunk lua require 'nv-utils'.undo_stage_hunk() -command! ResetHunk lua require 'nv-utils'.reset_hunk() -command! ResetBuffer lua require 'nv-utils'.reset_buffer() -command! PreviewHunk lua require 'nv-utils'.preview_hunk() -command! BlameLine lua require 'nv-utils'.blame_line() +command! LspCodeAction lua require 'lv-utils'.code_action() +command! LspDeclaration lua require 'lv-utils'.declaration() +command! LspDefinition lua require 'lv-utils'.definition() +command! LspDocumentSymbol lua require 'lv-utils'.document_symbol() +command! LspFormatting lua require 'lv-utils'.formatting() +command! LspFormattingSync lua require 'lv-utils'.formatting_sync() +command! LspHover lua require 'lv-utils'.hover() +command! LspImplementation lua require 'lv-utils'.implementation() +command! LspRangeCodeAction lua require 'lv-utils'.range_code_action() +command! LspRangeFormatting lua require 'lv-utils'.range_formatting() +command! LspReferences lua require 'lv-utils'.references() +command! LspRename lua require 'lv-utils'.rename() +command! LspTypeDefinition lua require 'lv-utils'.type_definition() +command! LspWorkspaceSymbol lua require 'lv-utils'.workspace_symbol() +command! LspGotoNext lua require 'lv-utils'.goto_next() +command! LspGotoPrev lua require 'lv-utils'.goto_prev() +command! LspShowLineDiagnostics lua require 'lv-utils'.show_line_diagnostics() +command! NextHunk lua require 'lv-utils'.next_hunk() +command! PrevHunk lua require 'lv-utils'.prev_hunk() +command! StageHunk lua require 'lv-utils'.stage_hunk() +command! UndoStageHunk lua require 'lv-utils'.undo_stage_hunk() +command! ResetHunk lua require 'lv-utils'.reset_hunk() +command! ResetBuffer lua require 'lv-utils'.reset_buffer() +command! PreviewHunk lua require 'lv-utils'.preview_hunk() +command! BlameLine lua require 'lv-utils'.blame_line() command! W noa w " Debugging @@ -55,10 +55,6 @@ command! DebugGetSession lua require'dap'.session() " nnoremap dr :lua require'dap'.repl.open() " nnoremap dl :lua require'dap'.run_last() -" TODO find out why this thing follows me everywhere in java -let blacklist = ['java'] -autocmd CursorHold,CursorHoldI * if index(blacklist, &ft) < 0 | lua require'nvim-lightbulb'.update_lightbulb() - autocmd! User GoyoEnter lua require('gitsigns').toggle_signs() autocmd! User GoyoLeave lua require('gitsigns').toggle_signs() diff --git a/vimscript/lv-vscode/init.vim b/vimscript/lv-vscode/init.vim new file mode 100644 index 00000000..e3e7f6eb --- /dev/null +++ b/vimscript/lv-vscode/init.vim @@ -0,0 +1,119 @@ +" TODO there is a more contemporary version of this file +" TODO Also some of it is redundant +" packadd quickscope + +luafile ~/.config/nvim/lua/settings.lua + +" let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] + +" highlight QuickScopePrimary guifg='#00C7DF' gui=underline ctermfg=155 cterm=underline +" highlight QuickScopeSecondary guifg='#eF5F70' gui=underline ctermfg=81 cterm=underline +" let g:qs_max_chars=150 + +"VSCode +function! s:split(...) abort + let direction = a:1 + let file = a:2 + call VSCodeCall(direction == 'h' ? 'workbench.action.splitEditorDown' : 'workbench.action.splitEditorRight') + if file != '' + call VSCodeExtensionNotify('open-file', expand(file), 'all') + endif +endfunction + +function! s:splitNew(...) + let file = a:2 + call s:split(a:1, file == '' ? '__vscode_new__' : file) +endfunction + +function! s:closeOtherEditors() + call VSCodeNotify('workbench.action.closeEditorsInOtherGroups') + call VSCodeNotify('workbench.action.closeOtherEditors') +endfunction + +function! s:manageEditorSize(...) + let count = a:1 + let to = a:2 + for i in range(1, count ? count : 1) + call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize') + endfor +endfunction + +function! s:vscodeCommentary(...) abort + if !a:0 + let &operatorfunc = matchstr(expand(''), '[^. ]*$') + return 'g@' + elseif a:0 > 1 + let [line1, line2] = [a:1, a:2] + else + let [line1, line2] = [line("'["), line("']")] + endif + + call VSCodeCallRange("editor.action.commentLine", line1, line2, 0) +endfunction + +function! s:openVSCodeCommandsInVisualMode() + normal! gv + let visualmode = visualmode() + if visualmode == "V" + let startLine = line("v") + let endLine = line(".") + call VSCodeNotifyRange("workbench.action.showCommands", startLine, endLine, 1) + else + let startPos = getpos("v") + let endPos = getpos(".") + call VSCodeNotifyRangePos("workbench.action.showCommands", startPos[1], endPos[1], startPos[2], endPos[2], 1) + endif +endfunction + +function! s:openWhichKeyInVisualMode() + normal! gv + let visualmode = visualmode() + if visualmode == "V" + let startLine = line("v") + let endLine = line(".") + call VSCodeNotifyRange("whichkey.show", startLine, endLine, 1) + else + let startPos = getpos("v") + let endPos = getpos(".") + call VSCodeNotifyRangePos("whichkey.show", startPos[1], endPos[1], startPos[2], endPos[2], 1) + endif +endfunction + + +command! -complete=file -nargs=? Split call split('h', ) +command! -complete=file -nargs=? Vsplit call split('v', ) +command! -complete=file -nargs=? New call split('h', '__vscode_new__') +command! -complete=file -nargs=? Vnew call split('v', '__vscode_new__') +command! -bang Only if == '!' | call closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif + +" Better Navigation +nnoremap :call VSCodeNotify('workbench.action.navigateDown') +xnoremap :call VSCodeNotify('workbench.action.navigateDown') +nnoremap :call VSCodeNotify('workbench.action.navigateUp') +xnoremap :call VSCodeNotify('workbench.action.navigateUp') +nnoremap :call VSCodeNotify('workbench.action.navigateLeft') +xnoremap :call VSCodeNotify('workbench.action.navigateLeft') +nnoremap :call VSCodeNotify('workbench.action.navigateRight') +xnoremap :call VSCodeNotify('workbench.action.navigateRight') + +nnoremap gr call VSCodeNotify('editor.action.goToReferences') + +" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors +xnoremap vscodeCommentary() +nnoremap vscodeCommentary() . '_' + +nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') + +nnoremap :call VSCodeNotify('whichkey.show') +xnoremap :call openWhichKeyInVisualMode() + +xnoremap :call openVSCodeCommandsInVisualMode() + +xmap gc VSCodeCommentary +nmap gc VSCodeCommentary +omap gc VSCodeCommentary +nmap gcc VSCodeCommentaryLine + +" Simulate same TAB behavior in VSCode +nmap :Tabnext +nmap :Tabprev diff --git a/vimscript/lv-whichkey/init.vim b/vimscript/lv-whichkey/init.vim new file mode 100644 index 00000000..2d2b4441 --- /dev/null +++ b/vimscript/lv-whichkey/init.vim @@ -0,0 +1,140 @@ +" Leader Key Maps + +" Timeout +let g:which_key_timeout = 100 + +let g:which_key_display_names = {'': '↵', '': '⇆', " ": 'SPC'} + +" Map leader to which_key +nnoremap :silent :silent WhichKey '' +vnoremap :silent :silent WhichKeyVisual '' + +let g:which_key_map = {} +let g:which_key_sep = '→' + +" Not a fan of floating windows for this +let g:which_key_use_floating_win = 0 +let g:which_key_max_size = 0 + +" Hide status line +autocmd! FileType which_key +autocmd FileType which_key set laststatus=0 noshowmode noruler + \| autocmd BufLeave set laststatus=2 noshowmode ruler + +let g:which_key_map['/'] = 'comment toggle' +let g:which_key_map[';'] = [ ':Dashboard' , 'home screen' ] +let g:which_key_map['?'] = [ ':NvimTreeFindFile' , 'find current file' ] +let g:which_key_map['e'] = [ ':NvimTreeToggle' , 'explorer' ] +let g:which_key_map['f'] = [ ':Telescope find_files' , 'find files' ] +let g:which_key_map['h'] = [ 's' , 'split below'] +let g:which_key_map['H'] = [ ':let @/ = ""' , 'no highlight' ] +let g:which_key_map['r'] = [ ':RnvimrToggle' , 'ranger' ] +" TODO create entire treesitter section +let g:which_key_map['v'] = [ 'v' , 'split right'] +" TODO play nice with status line + +" Group mappings + +" b is for buffer +let g:which_key_map.b = { + \ 'name' : '+buffer' , + \ '>' : [':BufferMoveNext' , 'move next'], + \ '<' : [':BufferMovePrevious' , 'move prev'], + \ 'b' : [':BufferPick' , 'pick buffer'], + \ 'd' : [':BufferClose' , 'delete-buffer'], + \ 'n' : ['bnext' , 'next-buffer'], + \ 'p' : ['bprevious' , 'previous-buffer'], + \ '?' : ['Buffers' , 'fzf-buffer'], + \ } + +" d is for debug +let g:which_key_map.d = { + \ 'name' : '+debug' , + \ 'b' : ['DebugToggleBreakpoint ' , 'toggle breakpoint'], + \ 'c' : ['DebugContinue' , 'continue'], + \ 'i' : ['DebugStepInto' , 'step into'], + \ 'o' : ['DebugStepOver' , 'step over'], + \ 'r' : ['DebugToggleRepl' , 'toggle repl'], + \ 's' : ['DebugStart' , 'start'], + \ } + +" F is for fold +let g:which_key_map.F = { + \ 'name': '+fold', + \ 'O' : [':set foldlevel=20' , 'open all'], + \ 'C' : [':set foldlevel=0' , 'close all'], + \ 'c' : [':foldclose' , 'close'], + \ 'o' : [':foldopen' , 'open'], + \ '1' : [':set foldlevel=1' , 'level1'], + \ '2' : [':set foldlevel=2' , 'level2'], + \ '3' : [':set foldlevel=3' , 'level3'], + \ '4' : [':set foldlevel=4' , 'level4'], + \ '5' : [':set foldlevel=5' , 'level5'], + \ '6' : [':set foldlevel=6' , 'level6'] + \ } + +" s is for search powered by telescope +let g:which_key_map.s = { + \ 'name' : '+search' , + \ '.' : [':Telescope filetypes' , 'filetypes'], + \ 'B' : [':Telescope git_branches' , 'git branches'], + \ 'd' : [':Telescope lsp_document_diagnostics' , 'document_diagnostics'], + \ 'D' : [':Telescope lsp_workspace_diagnostics' , 'workspace_diagnostics'], + \ 'f' : [':Telescope find_files' , 'files'], + \ 'h' : [':Telescope command_history' , 'history'], + \ 'i' : [':Telescope media_files' , 'media files'], + \ 'm' : [':Telescope marks' , 'marks'], + \ 'M' : [':Telescope man_pages' , 'man_pages'], + \ 'o' : [':Telescope vim_options' , 'vim_options'], + \ 't' : [':Telescope live_grep' , 'text'], + \ 'r' : [':Telescope registers' , 'registers'], + \ 'w' : [':Telescope file_browser' , 'buf_fuz_find'], + \ 'u' : [':Telescope colorscheme' , 'colorschemes'], + \ } + +" S is for Session +let g:which_key_map.S = { + \ 'name' : '+Session' , + \ 's' : [':SessionSave' , 'save session'], + \ 'l' : [':SessionLoad' , 'load Session'], + \ } + +" g is for git +let g:which_key_map.g = { + \ 'name' : '+git' , + \ 'b' : [':GitBlameToggle' , 'blame'], + \ 'B' : [':GBrowse' , 'browse'], + \ 'd' : [':Git diff' , 'diff'], + \ 'j' : [':NextHunk' , 'next hunk'], + \ 'k' : [':PrevHunk' , 'prev hunk'], + \ 'l' : [':Git log' , 'log'], + \ 'p' : [':PreviewHunk' , 'preview hunk'], + \ 'r' : [':ResetHunk' , 'reset hunk'], + \ 'R' : [':ResetBuffer' , 'reset buffer'], + \ 's' : [':StageHunk' , 'stage hunk'], + \ 'S' : [':Gstatus' , 'status'], + \ 'u' : [':UndoStageHunk' , 'undo stage hunk'], + \ } + +" l is for language server protocol +let g:which_key_map.l = { + \ 'name' : '+lsp' , + \ 'a' : [':Lspsaga code_action' , 'code action'], + \ 'A' : [':Lspsaga range_code_action' , 'selected action'], + \ 'd' : [':Telescope lsp_document_diagnostics' , 'document diagnostics'], + \ 'D' : [':Telescope lsp_workspace_diagnostics', 'workspace diagnostics'], + \ 'f' : [':LspFormatting' , 'format'], + \ 'I' : [':LspInfo' , 'lsp info'], + \ 'v' : [':LspVirtualTextToggle' , 'lsp toggle virtual text'], + \ 'l' : [':Lspsaga lsp_finder' , 'lsp finder'], + \ 'L' : [':Lspsaga show_line_diagnostics' , 'line_diagnostics'], + \ 'p' : [':Lspsaga preview_definition' , 'preview definition'], + \ 'q' : [':Telescope quickfix' , 'quickfix'], + \ 'r' : [':Lspsaga rename' , 'rename'], + \ 'T' : [':LspTypeDefinition' , 'type defintion'], + \ 'x' : [':cclose' , 'close quickfix'], + \ 's' : [':Telescope lsp_document_symbols' , 'document symbols'], + \ 'S' : [':Telescope lsp_workspace_symbols' , 'workspace symbols'], + \ } + +call which_key#register('', "g:which_key_map") diff --git a/vimscript/nv-vscode/init.vim b/vimscript/nv-vscode/init.vim deleted file mode 100644 index a10afc97..00000000 --- a/vimscript/nv-vscode/init.vim +++ /dev/null @@ -1,119 +0,0 @@ -" TODO there is a more contemporary version of this file -" TODO Also some of it is redundant -packadd quickscope - -luafile ~/.config/nvim/lua/settings.lua - -let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] - -highlight QuickScopePrimary guifg='#00C7DF' gui=underline ctermfg=155 cterm=underline -highlight QuickScopeSecondary guifg='#eF5F70' gui=underline ctermfg=81 cterm=underline -let g:qs_max_chars=150 - -"VSCode -function! s:split(...) abort - let direction = a:1 - let file = a:2 - call VSCodeCall(direction == 'h' ? 'workbench.action.splitEditorDown' : 'workbench.action.splitEditorRight') - if file != '' - call VSCodeExtensionNotify('open-file', expand(file), 'all') - endif -endfunction - -function! s:splitNew(...) - let file = a:2 - call s:split(a:1, file == '' ? '__vscode_new__' : file) -endfunction - -function! s:closeOtherEditors() - call VSCodeNotify('workbench.action.closeEditorsInOtherGroups') - call VSCodeNotify('workbench.action.closeOtherEditors') -endfunction - -function! s:manageEditorSize(...) - let count = a:1 - let to = a:2 - for i in range(1, count ? count : 1) - call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize') - endfor -endfunction - -function! s:vscodeCommentary(...) abort - if !a:0 - let &operatorfunc = matchstr(expand(''), '[^. ]*$') - return 'g@' - elseif a:0 > 1 - let [line1, line2] = [a:1, a:2] - else - let [line1, line2] = [line("'["), line("']")] - endif - - call VSCodeCallRange("editor.action.commentLine", line1, line2, 0) -endfunction - -function! s:openVSCodeCommandsInVisualMode() - normal! gv - let visualmode = visualmode() - if visualmode == "V" - let startLine = line("v") - let endLine = line(".") - call VSCodeNotifyRange("workbench.action.showCommands", startLine, endLine, 1) - else - let startPos = getpos("v") - let endPos = getpos(".") - call VSCodeNotifyRangePos("workbench.action.showCommands", startPos[1], endPos[1], startPos[2], endPos[2], 1) - endif -endfunction - -function! s:openWhichKeyInVisualMode() - normal! gv - let visualmode = visualmode() - if visualmode == "V" - let startLine = line("v") - let endLine = line(".") - call VSCodeNotifyRange("whichkey.show", startLine, endLine, 1) - else - let startPos = getpos("v") - let endPos = getpos(".") - call VSCodeNotifyRangePos("whichkey.show", startPos[1], endPos[1], startPos[2], endPos[2], 1) - endif -endfunction - - -command! -complete=file -nargs=? Split call split('h', ) -command! -complete=file -nargs=? Vsplit call split('v', ) -command! -complete=file -nargs=? New call split('h', '__vscode_new__') -command! -complete=file -nargs=? Vnew call split('v', '__vscode_new__') -command! -bang Only if == '!' | call closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif - -" Better Navigation -nnoremap :call VSCodeNotify('workbench.action.navigateDown') -xnoremap :call VSCodeNotify('workbench.action.navigateDown') -nnoremap :call VSCodeNotify('workbench.action.navigateUp') -xnoremap :call VSCodeNotify('workbench.action.navigateUp') -nnoremap :call VSCodeNotify('workbench.action.navigateLeft') -xnoremap :call VSCodeNotify('workbench.action.navigateLeft') -nnoremap :call VSCodeNotify('workbench.action.navigateRight') -xnoremap :call VSCodeNotify('workbench.action.navigateRight') - -nnoremap gr call VSCodeNotify('editor.action.goToReferences') - -" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors -xnoremap vscodeCommentary() -nnoremap vscodeCommentary() . '_' - -nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') - -nnoremap :call VSCodeNotify('whichkey.show') -xnoremap :call openWhichKeyInVisualMode() - -xnoremap :call openVSCodeCommandsInVisualMode() - -xmap gc VSCodeCommentary -nmap gc VSCodeCommentary -omap gc VSCodeCommentary -nmap gcc VSCodeCommentaryLine - -" Simulate same TAB behavior in VSCode -nmap :Tabnext -nmap :Tabprev diff --git a/vimscript/nv-whichkey/init.vim b/vimscript/nv-whichkey/init.vim deleted file mode 100644 index cd5f255f..00000000 --- a/vimscript/nv-whichkey/init.vim +++ /dev/null @@ -1,242 +0,0 @@ -" Leader Key Maps - -" Timeout -let g:which_key_timeout = 100 - -let g:which_key_display_names = {'': '↵', '': '⇆', " ": 'SPC'} - -" Map leader to which_key -nnoremap :silent :silent WhichKey '' -vnoremap :silent :silent WhichKeyVisual '' - -let g:which_key_map = {} -let g:which_key_sep = '→' - -" Not a fan of floating windows for this -let g:which_key_use_floating_win = 0 -let g:which_key_max_size = 0 - -" Hide status line -autocmd! FileType which_key -autocmd FileType which_key set laststatus=0 noshowmode noruler - \| autocmd BufLeave set laststatus=2 noshowmode ruler - -let g:which_key_map['/'] = 'comment toggle' -let g:which_key_map[';'] = [ ':Dashboard' , 'home screen' ] -let g:which_key_map[','] = [ '(emmet-expand-abbr)' , 'expand tags' ] -let g:which_key_map['"'] = [ 'PeekupOpen' , 'registers' ] -let g:which_key_map['?'] = [ ':NvimTreeFindFile' , 'find current file' ] -let g:which_key_map['e'] = [ ':NvimTreeToggle' , 'explorer' ] -let g:which_key_map['f'] = [ ':Telescope find_files' , 'find files' ] -let g:which_key_map['h'] = [ 's' , 'split below'] -let g:which_key_map['M'] = [ ':MarkdownPreviewToggle' , 'markdown preview'] -let g:which_key_map['H'] = [ ':let @/ = ""' , 'no highlight' ] -let g:which_key_map['r'] = [ ':RnvimrToggle' , 'ranger' ] -let g:which_key_map['*'] = [ ':DogeGenerate' , 'documentation generator' ] -let g:which_key_map['u'] = [ ':UndotreeToggle' , 'undo tree' ] -" TODO create entire treesitter section -let g:which_key_map['T'] = [ ':TSHighlightCapturesUnderCursor' , 'treesitter highlight' ] -let g:which_key_map['v'] = [ 'v' , 'split right'] -" TODO play nice with status line -let g:which_key_map['z'] = [ 'Goyo' , 'zen' ] - -" Group mappings - -" . is for emmet -let g:which_key_map['.'] = { - \ 'name' : '+emmet' , - \ ',' : ['(emmet-expand-abbr)' , 'expand abbr'], - \ ';' : ['(emmet-expand-word)' , 'expand word'], - \ 'u' : ['(emmet-update-tag)' , 'update tag'], - \ 'd' : ['(emmet-balance-tag-inward)' , 'balance tag in'], - \ 'D' : ['(emmet-balance-tag-outward)' , 'balance tag out'], - \ 'n' : ['(emmet-move-next)' , 'move next'], - \ 'N' : ['(emmet-move-prev)' , 'move prev'], - \ 'i' : ['(emmet-image-size)' , 'image size'], - \ '/' : ['(emmet-toggle-comment)' , 'toggle comment'], - \ 'j' : ['(emmet-split-join-tag)' , 'split join tag'], - \ 'k' : ['(emmet-remove-tag)' , 'remove tag'], - \ 'a' : ['(emmet-anchorize-url)' , 'anchorize url'], - \ 'A' : ['(emmet-anchorize-summary)' , 'anchorize summary'], - \ 'm' : ['(emmet-merge-lines)' , 'merge lines'], - \ 'c' : ['(emmet-code-pretty)' , 'code pretty'], - \ } - -" a is for actions -let g:which_key_map.a = { - \ 'name' : '+actions' , - \ 'c' : [':ColorizerToggle' , 'colorizer'], - \ 'h' : [':let @/ = ""' , 'remove search highlight'], - \ 'i' : [':IndentBlanklineToggle' , 'toggle indent lines'], - \ 'n' : [':set nonumber!' , 'line-numbers'], - \ 's' : [':s/\%V\(.*\)\%V/"\1"/' , 'surround'], - \ 'r' : [':set norelativenumber!' , 'relative line nums'], - \ 'v' : [':Codi' , 'virtual repl on'], - \ 'V' : [':Codi!' , 'virtual repl off'], - \ } - " \ 'l' : [':Bracey' , 'start live server'], - " \ 'L' : [':BraceyStop' , 'stop live server'], - -" b is for buffer -let g:which_key_map.b = { - \ 'name' : '+buffer' , - \ '>' : [':BufferMoveNext' , 'move next'], - \ '<' : [':BufferMovePrevious' , 'move prev'], - \ 'b' : [':BufferPick' , 'pick buffer'], - \ 'd' : [':BufferClose' , 'delete-buffer'], - \ 'n' : ['bnext' , 'next-buffer'], - \ 'p' : ['bprevious' , 'previous-buffer'], - \ '?' : ['Buffers' , 'fzf-buffer'], - \ } - -" d is for debug -let g:which_key_map.d = { - \ 'name' : '+debug' , - \ 'b' : ['DebugToggleBreakpoint ' , 'toggle breakpoint'], - \ 'c' : ['DebugContinue' , 'continue'], - \ 'i' : ['DebugStepInto' , 'step into'], - \ 'o' : ['DebugStepOver' , 'step over'], - \ 'r' : ['DebugToggleRepl' , 'toggle repl'], - \ 's' : ['DebugStart' , 'start'], - \ } - " \ 'O' : ['DebugStepOut' , 'next-buffer'], - " \ 'S' : ['DebugGetSession ' , 'fzf-buffer'], - -" D is for database -let g:which_key_map.D = { - \ 'name' : '+database' , - \ 'u' : ['DBUIToggle ' , 'db ui toggle'], - \ 'f' : ['DBUIFindBuffer' , 'db find buffer'], - \ 'r' : ['DBUIRenameBuffer' , 'db rename buffer'], - \ 'l' : ['DBUILastQueryInfo' , 'db last query'], - \ } - -" F is for fold -let g:which_key_map.F = { - \ 'name': '+fold', - \ 'O' : [':set foldlevel=20' , 'open all'], - \ 'C' : [':set foldlevel=0' , 'close all'], - \ 'c' : [':foldclose' , 'close'], - \ 'o' : [':foldopen' , 'open'], - \ '1' : [':set foldlevel=1' , 'level1'], - \ '2' : [':set foldlevel=2' , 'level2'], - \ '3' : [':set foldlevel=3' , 'level3'], - \ '4' : [':set foldlevel=4' , 'level4'], - \ '5' : [':set foldlevel=5' , 'level5'], - \ '6' : [':set foldlevel=6' , 'level6'] - \ } - -" m is for mark -" I'd rather use regular marks but they never clear -let g:which_key_map.m = { -\ 'name': '+mark', - \ 't' : [':BookmarkToggle' , 'toggle'], - \ 'j' : [':BookmarkNext' , 'next mark'], - \ 'k' : [':BookmarkPrev' , 'prev mark'] - \ } - -" s is for search powered by telescope -let g:which_key_map.s = { - \ 'name' : '+search' , - \ '.' : [':Telescope filetypes' , 'filetypes'], - \ 'B' : [':Telescope git_branches' , 'git branches'], - \ 'd' : [':Telescope lsp_document_diagnostics' , 'document_diagnostics'], - \ 'D' : [':Telescope lsp_workspace_diagnostics' , 'workspace_diagnostics'], - \ 'f' : [':Telescope find_files' , 'files'], - \ 'h' : [':Telescope command_history' , 'history'], - \ 'i' : [':Telescope media_files' , 'media files'], - \ 'm' : [':Telescope marks' , 'marks'], - \ 'M' : [':Telescope man_pages' , 'man_pages'], - \ 'o' : [':Telescope vim_options' , 'vim_options'], - \ 't' : [':Telescope live_grep' , 'text'], - \ 'r' : [':Telescope registers' , 'registers'], - \ 'w' : [':Telescope file_browser' , 'buf_fuz_find'], - \ 'u' : [':Telescope colorscheme' , 'colorschemes'], - \ } - -" S is for Session -let g:which_key_map.S = { - \ 'name' : '+Session' , - \ 's' : [':SessionSave' , 'save session'], - \ 'l' : [':SessionLoad' , 'load Session'], - \ } - -" g is for git -let g:which_key_map.g = { - \ 'name' : '+git' , - \ 'b' : [':GitBlameToggle' , 'blame'], - \ 'B' : [':GBrowse' , 'browse'], - \ 'd' : [':Git diff' , 'diff'], - \ 'j' : [':NextHunk' , 'next hunk'], - \ 'k' : [':PrevHunk' , 'prev hunk'], - \ 'l' : [':Git log' , 'log'], - \ 'p' : [':PreviewHunk' , 'preview hunk'], - \ 'r' : [':ResetHunk' , 'reset hunk'], - \ 'R' : [':ResetBuffer' , 'reset buffer'], - \ 's' : [':StageHunk' , 'stage hunk'], - \ 'S' : [':Gstatus' , 'status'], - \ 'u' : [':UndoStageHunk' , 'undo stage hunk'], - \ } - " \ 'n' : [':Neogit' , 'neogit'], - -" G is for gist -let g:which_key_map.G = { - \ 'name' : '+gist' , - \ '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 '], - \ } - " \ 'a' : [':Gist -a' , 'post gist anon'], - -" l is for language server protocol -let g:which_key_map.l = { - \ 'name' : '+lsp' , - \ 'a' : [':Lspsaga code_action' , 'code action'], - \ 'A' : [':Lspsaga range_code_action' , 'selected action'], - \ 'd' : [':Telescope lsp_document_diagnostics' , 'document diagnostics'], - \ 'D' : [':Telescope lsp_workspace_diagnostics', 'workspace diagnostics'], - \ 'f' : [':LspFormatting' , 'format'], - \ 'I' : [':LspInfo' , 'lsp info'], - \ 'v' : [':LspVirtualTextToggle' , 'lsp toggle virtual text'], - \ 'l' : [':Lspsaga lsp_finder' , 'lsp finder'], - \ 'L' : [':Lspsaga show_line_diagnostics' , 'line_diagnostics'], - \ 'p' : [':Lspsaga preview_definition' , 'preview definition'], - \ 'q' : [':Telescope quickfix' , 'quickfix'], - \ 'r' : [':Lspsaga rename' , 'rename'], - \ 'T' : [':LspTypeDefinition' , 'type defintion'], - \ 'x' : [':cclose' , 'close quickfix'], - \ 's' : [':Telescope lsp_document_symbols' , 'document symbols'], - \ 'S' : [':Telescope lsp_workspace_symbols' , 'workspace symbols'], - \ } - " \ 'H' : [':Lspsaga signature_help' , 'signature_help'], - " \ 'o' : [':Vista!!' , 'outline'], - -" 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'], - \ 't' : [':FloatermToggle' , 'toggle'], - \ 'y' : [':FloatermNew ytop' , 'ytop'], - \ 'u' : [':FloatermNew ncdu' , 'ncdu'], - \ } - " \ 'r' : [':FloatermNew ranger' , 'ranger'], - -" let g:which_key_map.R = { -" \ 'name' : '+Find_Replace' , -" \ 'f' : [':Farr --source=vimgrep' , 'file'], -" \ 'p' : [':Farr --source=rgnvim' , 'project'], -" \ } - -call which_key#register('', "g:which_key_map") -- cgit v1.2.3