OpenTerminal function & split resize keybinds

This commit is contained in:
tavo-wasd 2023-08-24 18:58:42 -06:00
parent 9af83afb92
commit 200fe3169a

View file

@ -32,9 +32,6 @@ autocmd FileType bib noremap <buffer> <F9> :w<CR> :!bibtex %<CR>
" Python
autocmd FileType python noremap <buffer> <F9> :w<CR> :!python %<CR>
" NERDTree
nnoremap <C-t> :NERDTreeToggle<CR>
" Global keybindings
noremap gc :!git commit -m ""<Left>
noremap gp :!git push<CR>
@ -45,6 +42,8 @@ noremap <C-e> !!$SHELL<CR>
noremap <tab> :bn<CR>
noremap <C-c> :bd<CR>
noremap <C-s> :w<CR>
noremap <A-h> 5<C-w>>
noremap <A-l> 5<C-w><
noremap <Space> za
noremap N /@@@<CR>
@ -98,6 +97,9 @@ set ttimeout ttimeoutlen=0
set laststatus=2
set noshowmode
" NERDTree
nnoremap <C-f> :NERDTreeToggle<CR>
" Goyo
map gy :Goyo<CR>
autocmd! User GoyoLeave highlight Normal ctermbg=NONE
@ -119,3 +121,33 @@ noremap gf :FzfLua files<CR>
let g:signify_disable_by_default = 1
highlight SignColumn ctermbg=NONE
noremap gd :SignifyToggle<CR>
" Neovim exclusive (I think)
" Open a shell on a vertical split
set splitright
function OpenTerminal()
execute "normal \<C-l>"
execute "normal \<C-l>"
execute "normal \<C-l>"
execute "normal \<C-l>"
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 <buffer> stopinsert!
silent au BufWinEnter,WinEnter <buffer> startinsert!
execute "tnoremap <buffer> <C-h> <C-\\><C-n><C-w><C-h>"
execute "tnoremap <buffer> <C-t> <C-\\><C-n>:q<CR>"
execute "tnoremap <buffer> <C-\\><C-\\> <C-\\><C-n>"
execute "IndentLinesDisable"
startinsert!
endif
endfunction
nnoremap <C-t> :call OpenTerminal()<CR>