Created
July 6, 2017 14:49
-
-
Save smlb/edc1d91f4a90fcb7aeb38b12a38d4194 to your computer and use it in GitHub Desktop.
terminal function gsora.xyz
This file contains hidden or 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
autocmd! BufWritePost * Neomake | |
" 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