-
Notifications
You must be signed in to change notification settings - Fork 63
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
avoid showing the same note multiple times #22
Comments
Not easily. The way that this plugin works is by printing every line from
all files and then filtering them by your query, hence the duplication. I
personally like the feature since I use it to immediately jump to the
correct line.
You can pass a query to it directly like `:NV query` and that won't be
unique but it'll reduce the number of lines to filter from the outset.
|
i do like the direct jumping to the correct line! that is awesome. but when i search for a note name, i would like it to be unique. ill keep trying it out and see if i can figure out something. thank you :) |
This isn't meant for searching notes just by name. That's another command,
and that's `:Files` from the fzf plugin. It can take a specific directory as
an argument.
|
I agree it shouldn't search just by name, it should definitely also search contents. In the OP's example any other files matching "broad" will never show up (or at least be "below the fold"). I would also really like it if it shows a line per match, but now I'm getting every line, regardless of match, in case the title matches... |
I've been thinking about this, and I don't see a clean way to do it with fzf. However, |
You could probably use folding (similar to what nou.vim and other folding plugin does). |
Very glad this is still being considered. Skim seems like the right direction. If I run the NV as is for a simple query, the list is too large to be manageable: But if I use skim in interactive mode, and tell ripgrep to only print the paths with at least one match via the -l flag:
I'm able to actually scan the list easily and use the preview window to quickly scan my entries. This seems to be more in line with the original functionality of Notational Velocity. That said, one of the ironic things is about this method is that it doesn't seem to search the actual filename, so you can miss entries if you search a term that is in the filename but not within the note itself. I couldn't find a way around this other than including the filename within the note itself. In the context of the plugin you just automate the inclusion of the filename during note creation. Something like So I'm not sure how to integrate this into the plugin. I've been playing around with it just passing the |
Ok, here's a solution that searches both the filename and the file contents, and avoids showing the same note multiple times:
Skim seems to be a drop in replacement for fzf, so I changed the |
Here is my final solution for a notational velocity clone in a single command, just run it in the directory with your notes.
It searches filenames and the file contents, avoids showing the same note multiple times, shows previews using the fzf preview script, opens notes in vim and ctrl+x creates and opens a new note in vim with the search query. |
This is beautiful. I made a slight change to:
|
Great idea @zrwitter re jumping to the line containing the search query! I've been using this NV clone for the past month and a half and it's been painless. The one feature I still want to integrate is a way to score the results by the date the files were edited. I saw the --tiebreak function in skim but there didn't seem to be a criteria for it there. Ideally, all things being equal, I'd like the first search results to be the most recently edited file since usually you're working on a project and using the same files again and again. This was how notational velocity worked I believe. I contacted the author of skim to inquire if he had any ideas but never heard back. If anyone has a spark of inspiration on an approach, would love to see possible solutions. |
This is great thanks @zrwitter @dclift. Out of curiosity, is there a way to replicate the "highlighting" of the search term in the preview window? I.e. left side you can see where "Fruitional View" is highlighted in the file that contains the term. Also, it seems like the jump to the line containing search query functionality is case sensitive. So while it'll find the file with fruitional view, when you enter the file it'll display an error "E486: Pattern not found: fruitional view" before opening the file and starting at the top, since in the text the term is actually Fruitional View. |
when what i typed matches the name of a note, that note appears multiple times as a result.
it would make sense to only appear once.
is there a way to configure that that im missing?
thank you.
The text was updated successfully, but these errors were encountered: