Closed mickael-menu closed 2 years ago
Looks good overall. I have some thoughts, but have no time right now. I'll let you know in the evening.
@kabouzeid Do you want to address some stuff with this PR?
Some mappings, like for example ZkNotes
, ZkNew
, ZkTags
, ZkMatch
, are also very useful outside of a notebook context.
In my experience, many (most?) users just copy and paste from the README.
It might not be the best experience to have them all only available when the buffer is a zk
note.
Maybe first list the mappings, then below that, as a "pro tip", add that if one wants certain mappings to only be availabe in a zk
note buffer, one could move them to a ftplugin
and check for require("zk.util").notebook_root
?
In the case of ZkNew
, it wouldn't be a problem to overwrite with a more specific mapping when inside of a zk
note buffer.
--- in main config
vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts)
--- ~/.config/nvim/ftplugin/markdown.lua
if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then
-- overwrite with a more specific mapping
vim.api.nvim_buf_set_keymap(0, "n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
end
Some mappings, like for example
ZkNotes
,ZkNew
,ZkTags
,ZkMatch
, are also very useful outside of a notebook context.
You're perfectly right, I updated the README and fixed your other comments as well. Thanks!
lgtm :)
Clarify the key mappings example, including the basic LSP ones.
See https://github.com/mickael-menu/zk-nvim/discussions/17