zk-org / zk-nvim

Neovim extension for zk
https://github.com/zk-org/zk
GNU General Public License v3.0
530 stars 42 forks source link

Is :ZkNotes supposed to search notes contents as well as title? #71 #73

Closed jordelver closed 1 year ago

jordelver commented 2 years ago

I've started playing around with zk and zk.vim and I've found the behaviour of :ZkNotes confusing.

zk list --interactive seems to search both the titles of the notes and the content of the notes.

Using :ZkNotes only searches the titles.

I understand that zk is using fzf to achieve this, but I expected :ZkNotes to work the same way.

Is there any way to achieve the same behaviour or a reason to not do this?


(I opened a discussion, but it didn't any response so I'm hoping this is a better place to post 🙈)

mickael-menu commented 2 years ago

I don't think there's any reason to avoid this, but showing only the title in the :ZkNotes is cleaner. I'm not sure we can change the color to hide the body of the note like with fzf in command line.

However I agree this would be a useful addition, either as an option or a different command. This will need to be implemented for each picker (telescope, fzf).

jordelver commented 2 years ago

I don't think there's any reason to avoid this, but showing only the title in the :ZkNotes is cleaner.

That would work for me I think. It was more about the search. Do people typically only search notes by the title only?

However I agree this would be a useful addition, either as an option or a different command. This will need to be implemented for each picker (telescope, fzf).

Forgive my ignorance but does :ZkNotes search for notes using the LSP?

mickael-menu commented 2 years ago

Do people typically only search notes by the title only?

Personally I use junegunn/fzf.vim for content search from within Vim.

Forgive my ignorance but does :ZkNotes search for notes using the LSP?

You can provide a number of filtering options but these are not interactive. Once the picker is displayed, any interactive filtering is handled by Telescope or fzf.

zalegrala commented 2 years ago

Telescope can live grep too, if that is what you want.

dzintars commented 1 year ago

Live grep works pretty well for me.

local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "telescope | Live grep" })
Joelius300 commented 1 year ago

I've been using live grep too but I would love a way to emulate the search of zk list -i which is much faster (as far as I understand because it uses the index database) and displays the actual Zettel-title instead of the file name. Is there a built-in way to do this or has anyone built a solution for something like this? @mickael-menu are you using fzf.vim just like a normal live-grep without any of the extra stuff that zk list -i brings?

Edit: Forgot to mention but the snippet provided here doesn't work for me (nil values in entries etc.)