> Hello,
>
> I'm wondering if anyone knows of a way to edit the same file in two
> windows in the same Vim session, where the file within the two windows
> stays in sync with eachother.
If you really just want two windows (with no other windows), it's
particularly easy:
:sp | windo se scb crb
:sp[lit] splits the current buffer
'|' (<bar>) separates two commands
:windo does something over every window
:se[t] sets a variable in each of those windows
'scb' is short for 'scrollbind'
'crb' is short for 'cursorbind'
More info on each at:
:help :split
:help :bar
:help :windo
:help :set
:help 'scrollbind'
:help 'cursorbind'
For two arbitrary windows, with possibly many other windows open, it's
only slightly more complex, possibly with a better way to do it.
:se scb crb | sp | se crb
The second :se[t] command is necessary because the 'cursorbind' setting
isn't copied through the :sp[lit].
If you want vertical rather than horizontal splits, change the :sp[lit]
commands to :vs[plit]'s:
e.g.
:se scb crb | vs | se crb
:help :vsplit
--
Best,
Ben
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment