XPlatformer
XPlatformer

Reputation: 1248

in vim: "mark" current window, so I can jump to it

I have several windows open at a time. Some of them with the same buffer.

Is there a way I can "mark" the current window, so I can jump to it later? And if the marked window has been closed, how can I detect that?

By 'Window', I mean I have done :split several times.

Upvotes: 1

Views: 495

Answers (2)

XPlatformer
XPlatformer

Reputation: 1248

In Vim8 this is very simple. See :win_getid() and :win_gotoid()

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172768

If you have so many concurrent windows that you lose track, I'd change the workflow. Do you really need that many buffers visible at the same time?

Vim supports marking files (via the uppercase marks), but not windows. How about including the window number in the statusline:

:set statusline+=\ %{winnr()}

Then, you can mentally take note of the number and use a command like [N]<C-W><C-W> to jump back to window number [N].

Upvotes: 3

Related Questions