Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:NV word doesn't search filenames for word #35

Closed
n8henrie opened this issue May 31, 2019 · 12 comments
Closed

:NV word doesn't search filenames for word #35

n8henrie opened this issue May 31, 2019 · 12 comments

Comments

@n8henrie
Copy link

n8henrie commented May 31, 2019

I have dozens of notes that contain the word bash. I want to filter by notes that are about bash (instead of simply containing the word); unfortunately, I can't filter for titles (#9) and all the other notes (esp those with multiple mentions of bash) end up taking all of the screen real estate (#22).

I've followed a convention of using # in my filenames to indicate a tag / subject, so I figured I could just use :NV #bash, but for some reason this gives me 0 results. If I instead do e.g. :NV bash -> (in fzf) #bash, I see 32 results.

I suspect this may be a bug in escaping somewhere, but not sure. :echo shellescape('#bash') works as intended.

@alok
Copy link
Owner

alok commented May 31, 2019

Try escaping the hash in the vim command line and tell me what happens

@n8henrie
Copy link
Author

n8henrie commented May 31, 2019

No change, :NV \#bash also shows no results, nor does :NV '#bash'

@alok
Copy link
Owner

alok commented May 31, 2019

Do you get the search bar to popup? If I run the search, I get E194: No alternate file name to substitute for '#', which is an issue with the vim command line, not this plugin.

@n8henrie
Copy link
Author

I get an empty FZF search bar (0 results).

@alok
Copy link
Owner

alok commented May 31, 2019 via email

@n8henrie
Copy link
Author

MacOS 10.14.5
NVIM v0.3.5
VIM - Vi IMproved 8.1 (2018 May 18, compiled May 27 2019 02:08:52)
both installed via homebrew

I see the same behavior in both.

@n8henrie
Copy link
Author

Oddly, :NV #b kind of works -- it correctly picks up notes with e.g. #bike, but for some reason does not show notes with #bash. :NV #bike also works, picking up the same notes. :NV #ba shows zero results.

I've again confirmed that I see plenty of notes with #bash when I do :NV and then enter #bash.

@alok
Copy link
Owner

alok commented May 31, 2019 via email

@n8henrie
Copy link
Author

n8henrie commented Jun 1, 2019

Do mean the latest release (0.3.7, 3d ago) since I was still on 0.3.5? Or really a build from source from master?

I am not particularly convinced this will help, since I'm seeing identical behavior on vim; updating nvim to 0.3.7 now.

Have you tried to reproduce locally with the word #bash?

@alok
Copy link
Owner

alok commented Jun 1, 2019

Build from source. I have in fact tried locally and gotten the error message I mentioned above.

@alok
Copy link
Owner

alok commented Jun 1, 2019

I think I figured it out. When :NV is passed an argument on Vim's command line, it passes that argument to ripgrep. Except that grep does not search file names, but their contents. Your file #bash does not contain the string #bash. That explains why searching #b works, since you have files with that string.

Most of the reason for allowing :NV arg is to make searches faster, so changing the behavior isn't a priority for me, but I will accept a PR.

However, I am working on a new version of this that addresses #22 and should fix up other issues as well, which may mitigate the issue sufficiently for you.

@n8henrie
Copy link
Author

n8henrie commented Jun 3, 2019

Thanks for your time and updates. I hadn't heart of skim before -- very interesting.

It seems like the current behavior fits your workflow. I may fork and see if I can get something similar working better for my own purposes. Thanks for providing this project.

EDIT: And let me know if you'd like me to close this issue or keep it open.

@n8henrie n8henrie changed the title :NV #bash gets no results (bug with hashtag?) :NV word doesn't search titles for word Jun 3, 2019
@n8henrie n8henrie changed the title :NV word doesn't search titles for word :NV word doesn't search filenames for word Jun 3, 2019
@alok alok closed this as completed Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants