-
-
Save jteneycke/5958aa307677426a86e1d88a3d78332c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Window split settings | |
highlight TermCursor ctermfg=red guifg=red | |
set splitbelow | |
set splitright | |
" Terminal settings | |
tnoremap <Leader><ESC> <C-\><C-n> | |
" Window navigation function | |
" Make ctrl-h/j/k/l move between windows and auto-insert in terminals | |
func! s:mapMoveToWindowInDirection(direction) | |
func! s:maybeInsertMode(direction) | |
stopinsert | |
execute "wincmd" a:direction | |
if &buftype == 'terminal' | |
startinsert! | |
endif | |
endfunc | |
execute "tnoremap" "<silent>" "<C-" . a:direction . ">" | |
\ "<C-\\><C-n>" | |
\ ":call <SID>maybeInsertMode(\"" . a:direction . "\")<CR>" | |
execute "nnoremap" "<silent>" "<C-" . a:direction . ">" | |
\ ":call <SID>maybeInsertMode(\"" . a:direction . "\")<CR>" | |
endfunc | |
for dir in ["h", "j", "l", "k"] | |
call s:mapMoveToWindowInDirection(dir) | |
endfor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment