I have two buffers open in vim using a vertical split which are linked using :set scrollbind.
Is there a way to switch between the windows so that the cursor remains on the same (relative) row when I do switch between them using the ctrl+w commands?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A mapping will do what you need
Do this in the left window:
and do this in the right window:
Then you can use the left and right arrows to switch between the windows and the cursor will go to the same line in the other window.
Edit:
I didn’t read your question carefully (shame on me!:).
Here’s how to get exactly what you wanted:
On the left window:
and on the right:
Have fun!