summaryrefslogtreecommitdiff
path: root/lua/config/plugins/notes.lua
diff options
context:
space:
mode:
authorMarcelo <setanta@gmail.com>2025-03-03 21:05:55 -0300
committerMarcelo Lira <setanta@gmail.com>2025-03-07 02:15:25 -0300
commitc78361a6155dd53cd1098f7fdf33acfea20dc903 (patch)
treee13b8065c4a1180f3b1d483676b55af4cba2ee4c /lua/config/plugins/notes.lua
Initial commit.
Diffstat (limited to 'lua/config/plugins/notes.lua')
-rw-r--r--lua/config/plugins/notes.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/lua/config/plugins/notes.lua b/lua/config/plugins/notes.lua
new file mode 100644
index 0000000..c374e94
--- /dev/null
+++ b/lua/config/plugins/notes.lua
@@ -0,0 +1,35 @@
+return {
+ {
+ "zk-org/zk-nvim",
+ config = function()
+ require("zk").setup({
+ picker = "telescope",
+ lsp = {
+ config = {
+ cmd = { "zk", "lsp" },
+ name = "zk",
+ },
+ auto_attach = {
+ enabled = true,
+ filetypes = { "markdown" },
+ },
+ },
+ })
+
+ local opts = { noremap = true, silent = false }
+
+ -- Create a new note after asking for its title.
+ vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts)
+
+ -- Open notes.
+ vim.api.nvim_set_keymap("n", "<leader>zo", "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", opts)
+ -- Open notes associated with the selected tags.
+ vim.api.nvim_set_keymap("n", "<leader>zt", "<Cmd>ZkTags<CR>", opts)
+
+ -- 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)
+ -- Search for the notes matching the current visual selection.
+ vim.api.nvim_set_keymap("v", "<leader>zf", ":'<,'>ZkMatch<CR>", opts)
+ end
+ }
+}