Shoeman
Shoeman

Reputation: 73

Vim windows navigation inside vim inside vim-terminal not working as expected

Vim windows navigation breaks for me once I perform these steps:

from (bash in my case) terminal open vim (8.1) in terminal mode

>vim -c ":term ++curwin"

then from the vim-terminal open vim

>vim

From inside vim, open a new split window

:sp

try navigating

<C-w><C-w>

and it doesn't work

Upvotes: 0

Views: 1005

Answers (1)

romainl
romainl

Reputation: 196546

Using Vim as a terminal emulator and Vim again inside of it, I see. Are you trying to create a black hole?

Anyway, if the built-in terminal allowed this it would function as a keyboard trap, effectively making it impossible to move the focus to another (host) Vim window.

It's really a classic case of the host capturing a keystroke and preventing the hosted program to receive it. Pretty much like screen using <C-a> as leader and thus preventing you from incrementing the number under the cursor in Vim.

And just like screen that lets you do <C-a>a to send an actual <C-a> to the hosted program, Vim's built-in terminal lets you do <C-w>. to send an actual <C-w>.

Therefore, you can do <C-w>.<C-w>. to achieve your goal (however misguided it might be).

See :help terminal-typing.

Upvotes: 4

Related Questions