diff options
author | Chris <[email protected]> | 2020-09-01 20:34:19 -0400 |
---|---|---|
committer | Chris <[email protected]> | 2020-09-01 20:34:19 -0400 |
commit | 9379982b7ed35c1bae40725b11d2b372d9b56b1f (patch) | |
tree | 16ee6b4eecc4556750a33f0c6889cb953a210ba5 /vscode/settings.vim | |
parent | f5aef47d8028207d37bd67b5f8ce9c4f8dbf9372 (diff) |
vscodium updates
Diffstat (limited to 'vscode/settings.vim')
-rw-r--r-- | vscode/settings.vim | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/vscode/settings.vim b/vscode/settings.vim new file mode 100644 index 00000000..3df722a1 --- /dev/null +++ b/vscode/settings.vim @@ -0,0 +1,75 @@ +" 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 <SID>split('h', <q-args>) +command! -complete=file -nargs=? Vsplit call <SID>split('v', <q-args>) +command! -complete=file -nargs=? New call <SID>split('h', '__vscode_new__') +command! -complete=file -nargs=? Vnew call <SID>split('v', '__vscode_new__') +command! -bang Only if <q-bang> == '!' | call <SID>closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif + +nnoremap <silent> <C-w>s :call <SID>split('h')<CR> +xnoremap <silent> <C-w>s :call <SID>split('h')<CR> + +nnoremap <silent> <C-w>v :call <SID>split('v')<CR> +xnoremap <silent> <C-w>v :call <SID>split('v')<CR> + +nnoremap <silent> <C-w>n :call <SID>splitNew('h', '__vscode_new__')<CR> +xnoremap <silent> <C-w>n :call <SID>splitNew('h', '__vscode_new__')<CR> + + +nnoremap <silent> <C-w>= :<C-u>call VSCodeNotify('workbench.action.evenEditorWidths')<CR> +xnoremap <silent> <C-w>= :<C-u>call VSCodeNotify('workbench.action.evenEditorWidths')<CR> + +nnoremap <silent> <C-w>> :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR> +xnoremap <silent> <C-w>> :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR> +nnoremap <silent> <C-w>+ :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR> +xnoremap <silent> <C-w>+ :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR> +nnoremap <silent> <C-w>< :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR> +xnoremap <silent> <C-w>< :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR> +nnoremap <silent> <C-w>- :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR> +xnoremap <silent> <C-w>- :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR> + +" Better Navigation +nnoremap <silent> <C-j> :call VSCodeNotify('workbench.action.navigateDown')<CR> +xnoremap <silent> <C-j> :call VSCodeNotify('workbench.action.navigateDown')<CR> +nnoremap <silent> <C-k> :call VSCodeNotify('workbench.action.navigateUp')<CR> +xnoremap <silent> <C-k> :call VSCodeNotify('workbench.action.navigateUp')<CR> +nnoremap <silent> <C-h> :call VSCodeNotify('workbench.action.navigateLeft')<CR> +xnoremap <silent> <C-h> :call VSCodeNotify('workbench.action.navigateLeft')<CR> +nnoremap <silent> <C-l> :call VSCodeNotify('workbench.action.navigateRight')<CR> +xnoremap <silent> <C-l> :call VSCodeNotify('workbench.action.navigateRight')<CR> + +" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors +xnoremap <silent> <C-/> :call Comment()<CR> +nnoremap <silent> <C-/> :call Comment()<CR> + +nnoremap <silent> <C-w>_ :<C-u>call VSCodeNotify('workbench.action.toggleEditorWidths')<CR> + +nnoremap <silent> <Space> :call VSCodeNotify('whichkey.show')<CR> +xnoremap <silent> <Space> :call VSCodeNotify('whichkey.show')<CR> |