I'd like to diff large files in vim using the scrollback limit set in my terminal (which is available memory), so I can, if necessary, find and review previously applied changes.

I use OS X's Terminal set to xterm-256color (modified, alternate screen is disabled).

I couldn't find any settings to make the initial windows the same size as the opened files.


A workaround for single files is using MouseTerm to enable mouse reporting, then add to your ~/.vimrc

if has("mouse")
    set mouse=a

In vimdiff this allows to easily scroll long files, but the text is not kept in the scrollback, although it does for single files.

  • So I take it that the main motivation is scrolling with your mouse instead of within vim? You could try :set mouse=a to scroll within vim with your mouse or use gvim/macvim. I know it's not exactly what you asked, but I figured I'd float the idea out there in case it meets your needs.
    – Matt Boehm
    Sep 9, 2015 at 23:23
  • @MattBoehm, as I said, the main motivation is to keep the changes on screen so I can review them if necessary.
    – 1.61803
    Sep 10, 2015 at 9:29

1 Answer 1


it might work using:

:set lines=1000 columns=100

where your line number is your scrollback limit.

Otherwise, you can "cheat" using screen, setting it to a way higher height than vim's default. I'm sure that there is a config option to set LINES and COLUMNS (as it does not use the env variables), but using a terminal to set it with a very small font, and opening it in another terminal using screen -x should work.


though, I do not really see why you'd want to abuse the scrollback, when vim can properly manage the mouse within the terminal. Just do :set mouse=a to have it take over full mouse control.

  • :set lines=1000 columns=100 just mixes up the layout (please, try it yourself), a little less if I only set the number of lines. Could you explain your approach with screen? It's been ages since I last used it.
    – 1.61803
    Sep 7, 2015 at 18:53
  • @zmo, I use the trackpad, not a mouse. I want to keep changes on-screen. That's why I mentioned I disabled alternate screen.
    – 1.61803
    Sep 10, 2015 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.