I am writing a plugin which needs to have two windows displayed at the same time:
_______ | | | | A | B | |___|___|
I need to keep in memory a reference to those windows as I execute my plugin. This is because I need to be able to jump between the two windows automaticaly.
I use the
winnr() function that returns the current window number, which I can use later like so:
let s:winA = winnr() new let s:winB = winnr() " stuff " go to window A execute s:winA . "wincmd w"
But in this case, both variables will have the value
1, this is because the
winnr() return the position of the current window in the tab display.
I tried to use the
bufnr('%') which return the buffer number for the current buffer. This is great, but when I do:
let s:bufA = bufnr('%') new let s:bufB = bufnr('%') " stuff " go to buffer A execute 'buffer '. s:bufA
The current window load the buffer, and the cursor will not jump to the existing window containing the buffer.
Here is my question:
How to store permanent information about windows so the cursor can jump on it later?