···330330 nnoremap <leader>gc :G commit -v -q %:p<CR>
331331332332 " kitaab
333333- map <leader>cz :VimwikiIndex<CR>:ZettelNew
334334- map <leader>zs :ZettelSearch<CR>
335335- map <leader>zn :ZettelNew<CR>
336336- map <leader>zo :ZettelOpen<CR>
337337- map <leader>zf :Telescope oldfiles only_cwd=true<CR>
338338- map <leader>wt :VimwikiMakeTomorrowDiaryNote
339339- map <leader>wd :VimwikiMakeYesterdayDiaryNote
340340- map <leader>zm :ZenMode<CR>:setlocal nospell<CR>
333333+ "map <leader>cz :VimwikiIndex<CR>:ZettelNew
334334+ "map <leader>zs :ZettelSearch<CR>
335335+ "map <leader>zn :ZettelNew<CR>
336336+ "map <leader>zo :ZettelOpen<CR>
337337+ "map <leader>zf :Telescope oldfiles only_cwd=true<CR>
338338+ "map <leader>wt :VimwikiMakeTomorrowDiaryNote
339339+ "map <leader>wd :VimwikiMakeYesterdayDiaryNote
340340+ "map <leader>zm :ZenMode<CR>:setlocal nospell<CR>
341341 let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 1 }]
342342 let g:sync_taskwarrior = 0
343343 let g:zettel_format = "%y%m%d-%H%M"
···802802803803 -- zk
804804 require("zk").setup()
805805+ vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts)
806806+807807+ -- Open notes.
808808+ vim.api.nvim_set_keymap("n", "<leader>zo", "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", opts)
809809+ -- Open notes associated with the selected tags.
810810+ vim.api.nvim_set_keymap("n", "<leader>zt", "<Cmd>ZkTags<CR>", opts)
811811+812812+ local map = vim.api.nvim_set_keymap
813813+ -- Search for the notes matching a given query.
814814+ vim.api.nvim_set_keymap("n", "<leader>zf", "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>", opts)
815815+ -- Search for the notes matching the current visual selection.
816816+ vim.api.nvim_set_keymap("v", "<leader>zf", ":'<,'>ZkMatch<CR>", opts)
817817+ map("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
818818+819819+ -- Create a new note after asking for its title.
820820+ -- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
821821+ map("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
822822+ -- Create a new note in the same directory as the current buffer, using the current selection for title.
823823+ map("v", "<leader>znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>", opts)
824824+ -- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title.
825825+ map("v", "<leader>znc", ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
826826+827827+ -- Open notes linking to the current buffer.
828828+ map("n", "<leader>zb", "<Cmd>ZkBacklinks<CR>", opts)
829829+ -- Alternative for backlinks using pure LSP and showing the source context.
830830+ --map('n', '<leader>zb', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
831831+ -- Open notes linked by the current buffer.
832832+ map("n", "<leader>zl", "<Cmd>ZkLinks<CR>", opts)
833833+834834+ -- Preview a linked note.
835835+ map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
836836+ -- Open the code actions for a visual selection.
837837+ map("v", "<leader>za", ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
805838806839 -- zen mode
807840 require('zen-mode').setup{