-1

I use vim splits quite a bit. To switch faster, I use this shortcut instead of doing ctrl + w + h/j/k/l/

" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l

However, this does not work when you are in the terminal in vim. So at that time I have to use the default switching method which is confusing once you are used to the shortcut.

Using tmux isn't feasible because many times you have to do commands in the specific directory you are in, which is why I think the terminal in vim is so useful, as it opens to the current directory. What can be done here?

1
1

Terminal in vim has a separate mode like 'normal' but 'terminal'. You should use tmap or tnoremap there:

" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l

" Do the same for vim built-in terminal
tnoremap <C-j> <C-w>j
tnoremap <C-k> <C-w>k
tnoremap <C-h> <C-w>h
tnoremap <C-l> <C-w>l

Not the answer you're looking for? Browse other questions tagged or ask your own question.