1

When I navigate out of the quickfix list, the split I get put back in is not the same as the one I left.

For example:

  1. vim -u NONE
  2. :copen open quickfix list
  3. ^w w leave quickfix list
  4. :vsplit open a split
  5. ^w l go to right split
  6. ^w j go to quickfix list
  7. ^w k leave quickfix

I expect this to bring me back to the right split, since that's where I was when I entered the quickfix list, but instead it brings me to the left split. Is there any way to change that? Am I doing something wrong?

2

That depends on your cursor position in the previous window (prior to switching windows with ^wk or similar).

From :h ^wk (emphasis mine):

Move cursor to Nth window above current one. Uses the cursor position to select between alternatives.

So, if the cursor is on the right of the quickfix window, ^wk will bring you to the right split. Otherwise, the left split is chosen.

(A quick way to move to the far right of the window is $, or g$ if the line wraps around, though I think you know that already)

2

The window command p (as in <C-w>p or :wincmd p) takes you back to the previous window.

3
  • How did I not know about <C-w>p? Thank you! Do you happen to know the name of the option to change that? Or the help it's in?
    – Marcel
    Mar 27 at 0:33
  • Maybe :help botright or similar (you might need single quotes)? @Marcel
    – D. Ben Knoble
    Mar 27 at 1:49
  • afaik there is no such option. There is :botright, :belowright, 'splitbelow', and similar, but those are for creating splits, not moving between splits
    – husB
    Mar 27 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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