From 200fe3169a78850c9ca248627a986f506b6ccedc Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Thu, 24 Aug 2023 18:58:42 -0600 Subject: [PATCH] OpenTerminal function & split resize keybinds --- vim/vimrc | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index d8be5d4..51c848e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -32,9 +32,6 @@ autocmd FileType bib noremap :w :!bibtex % " Python autocmd FileType python noremap :w :!python % -" NERDTree -nnoremap :NERDTreeToggle - " Global keybindings noremap gc :!git commit -m "" noremap gp :!git push @@ -45,6 +42,8 @@ noremap !!$SHELL noremap :bn noremap :bd noremap :w +noremap 5> +noremap 5< noremap za noremap N /@@@ @@ -98,6 +97,9 @@ set ttimeout ttimeoutlen=0 set laststatus=2 set noshowmode +" NERDTree +nnoremap :NERDTreeToggle + " Goyo map gy :Goyo autocmd! User GoyoLeave highlight Normal ctermbg=NONE @@ -119,3 +121,33 @@ noremap gf :FzfLua files let g:signify_disable_by_default = 1 highlight SignColumn ctermbg=NONE noremap gd :SignifyToggle + +" Neovim exclusive (I think) +" Open a shell on a vertical split +set splitright +function OpenTerminal() + execute "normal \" + execute "normal \" + execute "normal \" + execute "normal \" + + let bufNum = bufnr("%") + let bufType = getbufvar(bufNum, "&buftype", "not found") + + if bufType == "terminal" + execute "q" + else + execute "vsp term://bash" + execute "set nonu" + execute "set nornu" + silent au BufLeave stopinsert! + silent au BufWinEnter,WinEnter startinsert! + execute "tnoremap " + execute "tnoremap :q" + execute "tnoremap " + execute "IndentLinesDisable" + + startinsert! + endif +endfunction +nnoremap :call OpenTerminal()