zk-org / zk-nvim

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

Doc: ZkNotes match requires a dictionary to be passed in instead of a string #89

Closed ingram1107 closed 1 year ago

ingram1107 commented 1 year ago

In the section of Example Mappings from README.md and zk-nvim's vim help file:

-- Search for the notes matching a given query.
vim.api.nvim_set_keymap("n", "<leader>zf", "<Cmd>ZkNotes { sort = { 'modified' }, match = vim.fn.input('Search: ') }<CR>", opts)

However, with the above config, the LSP client will complain about failing to parse the arguments:

Error executing vim.schedule lua callback: ...cal/share/nvim/site/pack/packer/start/zk-nvim/lua/zk.lua:101: RPC[Error] code_name = InvalidRequest, message = "failed to parse
zk.tag.list args, got: map[match: select:[title absPath path] sort:[modified]]: json: cannot unmarshal string into Go struct field cmdListOpts.match of type []string"
stack traceback:
        [C]: in function 'assert'
        ...cal/share/nvim/site/pack/packer/start/zk-nvim/lua/zk.lua:101: in function 'handler'
        /usr/share/nvim/runtime/lua/vim/lsp.lua:1383: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Which is certainly caused by an api update on the upstream. The documentation should be updated as follows:

vim.api.nvim_set_keymap("n", "<leader>zf", "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>", opts)