I recently discovered the option
switchbuf and tried to use it but I can't say if I don't understand how it should work or if it actually doesn't work on my Vim.
About the different possible values, the doc says:
useopen If included, jump to the first open window that
contains the specified buffer (if there is one).
usetab Like "useopen", but also consider windows in other tab pages.
I have then used
set switchbuf=useopen,usetab and the following commands in a new vim instance:
- Open a first buffer
- Split the screen
- Open a second buffer
- Go back to the first buffer
:e file1(I have also used
The last commands to go to the first buffer open it in the second split. From what I understand from the doc the commands should place the cursor to the first split where the buffer is already open thanks to
useopen. Also the behavior is the same when I try the same commands with tabs instead of splits.
- Is this behavior the expected one?
- If so could you explain what this option should do?
- If not I know that I'll have to debug my
.vimrcbut maybe is there a common setting known to interfere with