aboutsummaryrefslogtreecommitdiff
path: root/nvim/.config/nvim/lua/plugins/zettelkasten.lua
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2024-05-23 14:15:03 +0200
committereug-vs <eugene@eug-vs.xyz>2024-05-23 14:19:14 +0200
commit80a4d36ead3d1329925e4692cfe46498aaf08467 (patch)
tree0a1476526fa335ffd763fb738988e720e1305ae7 /nvim/.config/nvim/lua/plugins/zettelkasten.lua
parentc3b4d29fb20e0d10ef792860e7fe7383e145ef9a (diff)
downloaddotfiles-80a4d36ead3d1329925e4692cfe46498aaf08467.tar.gz
feat(nvim): modernize configuration, all-in on lua
Major changes: - Switch from Packer to Lazy.nvim - Use Mason.nvim for LSP auto-install & management - Organize plugins into recommended structure Experimental changes: - Use oil.nvim instead of lua filetree - Remove startify.vim
Diffstat (limited to 'nvim/.config/nvim/lua/plugins/zettelkasten.lua')
-rw-r--r--nvim/.config/nvim/lua/plugins/zettelkasten.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/nvim/.config/nvim/lua/plugins/zettelkasten.lua b/nvim/.config/nvim/lua/plugins/zettelkasten.lua
new file mode 100644
index 0000000..bbbe0f1
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/zettelkasten.lua
@@ -0,0 +1,45 @@
+return {
+ "mickael-menu/zk-nvim",
+ init = function()
+ require("zk").setup({
+ picker = "telescope",
+
+ lsp = {
+ -- `config` is passed to `vim.lsp.start_client(config)`
+ config = {
+ cmd = { "zk", "lsp" },
+ name = "zk",
+ on_attach = on_attach,
+ flags = flags,
+ capabilities = capabilities,
+ -- etc, see `:h vim.lsp.start_client()`
+ },
+
+ -- automatically attach buffers in a zk notebook that match the given filetypes
+ 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>zz", "<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,
+}