Friday, May 6, 2011

vim — How can I search buffers?

I am looking for some command like:

:b1!g/something_here/

where I supposedly search for a word "something_here" in the buffer "b1". How can I do it?

From stackoverflow
  • Well, go to buffer b1 and

    :g/something here/
    

    For searching through all open buffers there are various plugins, for which I think would be best if you took a peak on www.vim.org

    Edit: like this one - buffergrep
    And my personal favorite for all kinds of searching: compview

  • I often do:

    :rew
    :bufdo 0
    :bufdo g/something here/
    :ls
    

    The last :ls allows me to see all the buffers that are not positioned on line 1

    Masi : Thank you. the command ":bufdo" is useful. +1
  • You can try something simple: :b0 |?somethingToSearch

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.