Skip to content

Make :Ag not match file names, only the file content #346

@max-baz

Description

@max-baz
  • Category
    • Question
    • Bug
    • Suggestion
  • OS
    • Linux
    • macOS
    • Windows
    • Etc.
  • Vim
    • Vim
    • Neovim

Since there is a command :Files that can search files by name, I'd like to configure :Ag to only look at the file contents, not at the file names.

I'll demostrate my case below, my question is: can this be achieved today, maybe with some configuration?


To see why this is an annoying issue, create a file called demo.txt, put 20 lines each having a random number, and on the 21st line write demo. Then use :Ag demo to search for this string.

Expected: you find only one occurrence.
Actual: you also find 20 irrelevant occurrences.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions