I have a terminal buffer with 10000 lines of previously executed output. In order to search for the particular sequence of words I have to go through all 10000 lines before getting to my last executed command's output. Which makes me so annoyed. Is the a way of clearing a terminal buffer without quiting the terminal and running it again (because I use ssh to remote server and it's painfull to execute all the commands all over again to establish the connection to it). (settings scroll back to 0 or whatever won't do a trick)
AFAIK, there's no "good" way to do it, but there is a "hacky" way. Suppose you want
<c-w><c-l> combination to clear vim internal buffer in both normal and terminal(insert) modes. The mappings in vimrc would look like this:
nmap <c-w><c-l> :set scrollback=1 \| sleep 100m \| set scrollback=10000<cr> tmap <c-w><c-l> <c-\><c-n><c-w><c-l>i<c-l>
This will "clear" the buffer, and return you to terminal "insert" mode if necessary. Extra
<c-l> at the end is to also clear the shell screen, feel free to remove if you wan't need that. Note the sleep, which is required for it to work. Maybe it's possible to use a lower value than 100m, I'm not sure.