From 00794985c214177286d01a4cbec8f495d34f0c4e Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 29 Aug 2020 12:29:11 -0400 Subject: added configuration for vscodium integration --- vscode/windows.vim | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 vscode/windows.vim (limited to 'vscode/windows.vim') diff --git a/vscode/windows.vim b/vscode/windows.vim new file mode 100644 index 00000000..def66822 --- /dev/null +++ b/vscode/windows.vim @@ -0,0 +1,76 @@ +" TODO there is a more contemporary version of this file +"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 + +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 + +nnoremap s :call split('h') +xnoremap s :call split('h') + +nnoremap v :call split('v') +xnoremap v :call split('v') + +nnoremap n :call splitNew('h', '__vscode_new__') +xnoremap n :call splitNew('h', '__vscode_new__') + +nnoremap :call VSCodeNotify('workbench.action.focusBelowGroup') +xnoremap :call VSCodeNotify('workbench.action.focusBelowGroup') +nnoremap :call VSCodeNotify('workbench.action.focusAboveGroup') +xnoremap :call VSCodeNotify('workbench.action.focusAboveGroup') +nnoremap :call VSCodeNotify('workbench.action.focusLeftGroup') +xnoremap :call VSCodeNotify('workbench.action.focusLeftGroup') +nnoremap :call VSCodeNotify('workbench.action.focusRightGroup') +xnoremap :call VSCodeNotify('workbench.action.focusRightGroup') + +nnoremap = :call VSCodeNotify('workbench.action.evenEditorWidths') +xnoremap = :call VSCodeNotify('workbench.action.evenEditorWidths') + +nnoremap > :call manageEditorSize(v:count, 'increase') +xnoremap > :call manageEditorSize(v:count, 'increase') +nnoremap + :call manageEditorSize(v:count, 'increase') +xnoremap + :call manageEditorSize(v:count, 'increase') +nnoremap < :call manageEditorSize(v:count, 'decrease') +xnoremap < :call manageEditorSize(v:count, 'decrease') +nnoremap - :call manageEditorSize(v:count, 'decrease') +xnoremap - :call manageEditorSize(v:count, 'decrease') + +" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors +xnoremap :call Comment() +nnoremap :call Comment() + +nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') + +" nnoremap :call VSCodeCall('whichkey.show') +" xnoremap :call VSCodeCall('whichkey.show') + +nnoremap :call VSCodeNotify('whichkey.show') +xnoremap :call VSCodeNotify('whichkey.show') -- cgit v1.2.3