Search code examples
vimvim-plugin

GVIM: auto scroll of a global command


Let me start with the scenario: I am using GVIM on windows-

  1. I do have a huge file say 3 GB size.
  2. Search something using global command which has lot of occurrence in the file.
  3. I have redirected this output of global command to a new file.

Problem: I need to scroll the out put pressing spacebar or other keys to get this output to a new file.

Is there anyway I may skip scrolling without loosing results?


Solution

  • As others have said, filtering is done more easily outside of Vim with tools like grep, but if you must...

    • If you use :redir, you can use :silent global/... to suppress the output within GVIM. It will still be captured by :redir.
    • If you basically use :g/<pattern>/p to filter matching lines, you could alternatively use :vglobal/<pattern>/d to delete non-matching lines, then persist what remains via :w another-filename.