From 570d317285b929d9462f65539d9f8e5f6a470b49 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 16 Mar 2021 21:03:48 -0400 Subject: trying to get react commenting to work --- lua/nv-vscode/init.vim | 109 ------------------------------------------------- 1 file changed, 109 deletions(-) delete mode 100644 lua/nv-vscode/init.vim (limited to 'lua/nv-vscode') diff --git a/lua/nv-vscode/init.vim b/lua/nv-vscode/init.vim deleted file mode 100644 index 746d189d..00000000 --- a/lua/nv-vscode/init.vim +++ /dev/null @@ -1,109 +0,0 @@ -" TODO there is a more contemporary version of this file -" TODO Also some of it is redundant -"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 -- cgit v1.2.3