This commit is contained in:
2023-12-01 20:57:55 +01:00
parent 943f29a165
commit 9af61291c3
3 changed files with 26 additions and 5 deletions

View File

@ -1,8 +1,9 @@
-- Add the key mappings only for Markdown files in a zk notebook.
if require('zk.util').notebook_root(vim.fn.expand('%:p')) ~= nil then
-- if require('zk.util').notebook_root(vim.fn.expand('%:p')) ~= nil then
local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end
local opts = { noremap = true, silent = false }
map("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
-- Create a new note after asking for its title.
-- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
vim.keymap.set('n', '<leader>zn', "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>",
@ -25,4 +26,4 @@ if require('zk.util').notebook_root(vim.fn.expand('%:p')) ~= nil then
map('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
-- Open the code actions for a visual selection.
map('v', '<leader>za', ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
end
-- end