I open a terminal window inside of a vim session and leave it there for weeks, use it for compilation, running and debugging my code. After couple of days the length of the terminal buffer grows over many millions of lines, which is not a problem at all. The problematic part is: these millions of lines (junk mostly) are scanned for key words when I use word completion (^P) in any other buffer.

The question is: is there any way to explicitly exclude terminal buffers from scanning for ^P/^N completion?


1 Answer 1


I could not find a way to exclude terminal buffers from completion. But you can reduce termwinscroll value, which sets the number of scrollback lines to keep. Since the lines evicted from the scrollback are unloaded from memory, they will not be used for completion.

To see what's your current value, issue :se twsl?. To have a maximum of 1000 lines in the scrollback, use

:se twsl=1000
  • The value 'termwinscroll=1000000' works fine. Thanks! a good workaround.
    – ilya
    Oct 8, 2020 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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