tags:

views:

163

answers:

2

In vim, if you swap buffers with :bn and :bp, the cursor stays on the same line, but not on the same column. Is there a way to keep it on the same column as well ?

+3  A: 

Off the top of my head I don't think so. But Vim sets the mark " as the last position when exiting a buffer. So typing `" will get you back to that spot. You could try creating an auto-command to jump to that mark automatically on entering a buffer. Try something like

:au BufEnter  * :normal `"
Steve K
it works! thanks! you changed my life.
Stefano Borini
+1  A: 
:set nostartofline

from the help: "In case of buffer changing commands the cursor is placed at the column where it was the last time the buffer was edited."

rpilkey