zk.lua (881B)
1 if not pcall(require, 'zk') then 2 return 3 end 4 5 vim.keymap.set('n', '<leader>zc', '<cmd>ZkNew<cr>') 6 vim.keymap.set('x', '<leader>zc', '<cmd>ZkNewFromTitleSelection<cr>') 7 vim.keymap.set('n', '<space>zn', '<cmd>ZkNotes<cr>') 8 vim.keymap.set('n', '<space>zt', '<cmd>ZkTags<cr>') 9 vim.keymap.set('n', '<space>zl', '<cmd>ZkLinks<cr>') 10 vim.keymap.set('n', '<space>zo', '<cmd>ZkNotes {orphan = true}<cr>') 11 12 -- local make_lsp_location = function() 13 -- local params = vim.lsp.util.make_range_params() 14 -- params.uri = params.textDocument.uri 15 -- params.textDocument = nil 16 -- return params 17 -- end 18 19 -- M.new_link = function() 20 -- vim.ui.input('title', function(title) 21 -- local location = make_lsp_location() 22 -- require('zk').new(nil, {insertLinkAtLocation = location, title = title}) 23 -- end) 24 -- end 25 26 -- LSP 27 local has_zk, zk = pcall(require, 'zk') 28 if has_zk then 29 zk.setup() 30 end