refactor(telekasten): use better keybindings
parent
b6b76a0e7d
commit
70a8d999bd
|
@ -269,33 +269,13 @@ with builtins;
|
|||
plugin = telekasten-nvim;
|
||||
dependencies = [
|
||||
{ plugin = telescope-nvim; }
|
||||
{ plugin = which-key-nvim; }
|
||||
];
|
||||
cmd = [ "Telekasten" ];
|
||||
keys = [
|
||||
{ key = "<leader>z"; cmd = "<cmd>Telekasten<cr>"; desc = "zettelkasten"; }
|
||||
];
|
||||
conf = ''
|
||||
require("telekasten").setup({
|
||||
home = vim.fn.expand("~/Nextcloud/Notes/zettelkasten"),
|
||||
auto_set_filetype = false,
|
||||
image_subdir = "assets",
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
|
||||
pattern = "*/zettelkasten/*",
|
||||
callback = function(event)
|
||||
vim.api.nvim_buf_set_keymap(0, "n", "<CR>", "", {
|
||||
callback = function()
|
||||
local current_word = vim.fn.expand("<cWORD>")
|
||||
if vim.fn.match(current_word, "[[") == 0 then
|
||||
require("telekasten").follow_link()
|
||||
else
|
||||
require("telekasten").toggle_todo()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
'';
|
||||
conf = builtins.readFile ./zettelkasten-nvim.lua;
|
||||
}
|
||||
{
|
||||
plugin = markdown-preview-nvim;
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
local telekasten = require("telekasten")
|
||||
telekasten.setup({
|
||||
home = vim.fn.expand("~/Nextcloud/Notes/zettelkasten"),
|
||||
auto_set_filetype = false,
|
||||
image_subdir = "assets",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
|
||||
pattern = "*/zettelkasten/*",
|
||||
callback = function(_)
|
||||
require("which-key").register({
|
||||
g = {
|
||||
f = { telekasten.follow_link, "Follow link" },
|
||||
r = { telekasten.show_backlinks, "Show backlinks" },
|
||||
},
|
||||
["<leader>"] = {
|
||||
f = {
|
||||
f = { telekasten.find_notes, "Find note" },
|
||||
n = { telekasten.new_note, "New note" },
|
||||
},
|
||||
s = {
|
||||
g = { telekasten.search_note, "Grep notes" },
|
||||
},
|
||||
},
|
||||
}, { buffer = vim.fn.bufnr("%") })
|
||||
end,
|
||||
})
|
Loading…
Reference in New Issue