0

Calling diffsplit {filename} opens the new file at the top and the current file at the bottom. Similarly, the vertical version opens the new file on the left and the current file on the right.

Is it possible to change this behavior such that the windows are always opened in the exact opposite order?

1 Answer 1

1
  • :h 'splitbelow'
  • :h 'splitright'

If you add

set splitbelow splitright

To your vimrc, it would be the opposite to default behavior. Note, it would affect all your splits, not only diffsplit.

2
  • Thank you for the answer. It works on diffsplit but moves the cursor to the new file. Any ideas about how I can keep the cursor on the current file? Additionally, do you know how I can extend this to also work with vim-fugitive, e.g., Gvdiffsplit? I was under the impression that vim-fugitive uses diffsplit, and this would automatically apply.
    – Matt
    Aug 17, 2022 at 18:22
  • 1
    Check fugitive help..., :Gdiffsplit! -- retain focus on the current window.
    – Maxim Kim
    Aug 17, 2022 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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