blob: 46e26d745b0a798cad1a598ab74b7e519a042610 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
-- Add the key mappings only for Markdown files in a zk notebook.
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 }
-- Open the link under the caret.
map('n', '<CR>', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
-- Open notes linking to the current buffer.
map('n', '<leader>zb', '<Cmd>ZkBacklinks<CR>', opts)
-- Open notes linked by the current buffer.
map('n', '<leader>zl', '<Cmd>ZkLinks<CR>', opts)
end
|