From 5f34976cd45b60586848d5ae1caebd49951af47c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 11 Dec 2024 13:55:21 +0800 Subject: [PATCH] feat(zktagstree): support `` key --- .../vim-zettelkasten/ftplugin/zktagstree.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bundle/vim-zettelkasten/ftplugin/zktagstree.lua b/bundle/vim-zettelkasten/ftplugin/zktagstree.lua index 2f36b1d11..7c5386db7 100644 --- a/bundle/vim-zettelkasten/ftplugin/zktagstree.lua +++ b/bundle/vim-zettelkasten/ftplugin/zktagstree.lua @@ -36,3 +36,22 @@ vim.api.nvim_buf_set_keymap(0, 'n', '', '', { vim.api.nvim_set_option_value('modifiable', false, { buf = bufnr }) end, }) +vim.api.nvim_buf_set_keymap(0, 'n', '', '', { + noremap = true, + silent = true, + nowait = true, + callback = function() + local bufnr = vim.fn.bufnr('zk://browser') + if vim.api.nvim_buf_is_valid(bufnr) then + vim.api.nvim_set_option_value('modifiable', true, { buf = bufnr }) + vim.api.nvim_buf_set_lines( + bufnr, + 0, + -1, + false, + require('zettelkasten').get_note_browser_content({ tags = { vim.fn.getline('.') } }) + ) + end + vim.api.nvim_set_option_value('modifiable', false, { buf = bufnr }) + end, +})