Hi all, as modern LCDs are wider than it is needed for a usual text editing, a colleague of mine made the following function to show the file in two windows beside, to see more lines of a file. 'scrollbind' is used to keep both windows synchronized (windows have an offset of a window height):
:e some_file_longer_than_window :function SplitAndJoin() :vsplit :wincmd l :normal L :normal z+ :wincmd h :windo set scrollbind :windo set number :endfunction :call SplitAndJoin() While using this for a while, we found some caveats. One of them is that commands changing the number of lines (inserting more than one line, lines deletition etc.) don't update the second window. The workaround is to move a text in a window then, the easiest way is to press CTRL-Y or CTRL-E. example: press "d4k" in the left window - lines disappear but right window isn't synchronized (only line numbers are). continue with typing CTRL-E : text in the left window moves off by one line and right window synchronizes. The expected behaviour is that other window with 'scrollbind' set are synchronized automaticaly every time the number of lines between windows changes. The second problem are wrapped lines - they take space for several screen lines so the synchronization of windows is broken than (the offset is wrong, there are some lines between windows which you can't see). So my idea is to solve both issues at once: make a new suboption to scrollopt: offsettype. With values "top-top" and "bottom-top" according to lines which you want to count an offset of. "top-top" will be used in cases like vimdiff (top-top offset 0) and bottom-top in case of continuous windows (bottom-top offset 0). I must say I tried to find a fix myself, but unsuccessful. I even can't understand why pressing CTRL-E help with windows synchronization, there is nothing about scrollbind in functions handling CTRL-E... Can anyone help, please? Milan -- Milan Vancura, Prague, Czech Republic, Europe --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---