When I'm coding, and sometimes when I'm writing, I like to see a lot of code. Usually I just maximize my window vertically, which gives me around 51 lines, and to the side of it I have a couple of windows I can use for a Python shell, regular shell, or another editing session. Sometimes I just want to see more code… Read on for a nifty trick I found in vim.
I had an idea that I might like to run with a vim window in full screen mode, split into two long windows side by side. I did a quick help search in vim and found the “scrollbind” option, which causes multiple windows to scroll together. This is how the “vimdiff” scrolling works.
So, you can have two windows side-by-side with one page continuing onto the next, like with a book.
To try it out, open up vim on /etc/services (for example), preferably with your window as big as you can make it, then do the following:
Now, you can scroll in the window to on the left (or the right window even), and the other window moves with it.
If I reduce the size of my window font a little bit, I can even get 3 side-by-side and do my editing in the middle window, with additional page before and after on either side. With this smaller font, I get 75 lines in each window, 3 across. That's a lot of context.
Not sure if I'll find it useful, but it's worth trying.comments powered by Disqus