Created
October 3, 2021 06:20
-
-
Save char101/38c5a0e826baca3d44fdc68264cc1123 to your computer and use it in GitHub Desktop.
[vim] switch to existing terminal window
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
func s:Term() | |
let terms = term_list() | |
if len(terms) > 0 | |
let winid = win_findbuf(terms[0]) | |
let winnr = win_id2tabwin(winid[0]) | |
exe 'tabnext '.winnr[0] | |
exe winnr[1].'wincmd w' | |
else | |
tab term | |
endif | |
endf | |
command Term call s:Term() | |
nnoremap <silent> <Leader>tt :Term<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment