2024-01-21 16:23:44 +01:00
|
|
|
local function handle_enter()
|
2024-01-21 12:24:56 +01:00
|
|
|
local util = require("obsidian.util")
|
|
|
|
if util.cursor_on_markdown_link(nil, nil, true) then
|
|
|
|
vim.cmd("ObsidianFollowLink")
|
|
|
|
else
|
2024-01-21 16:23:44 +01:00
|
|
|
local line = vim.api.nvim_get_current_line()
|
2024-01-25 18:20:36 +01:00
|
|
|
if string.match(line, "^%s*- %[[x ]%].*") then
|
2024-01-21 16:23:44 +01:00
|
|
|
util.toggle_checkbox()
|
|
|
|
else
|
|
|
|
vim.cmd("normal! viw:'<,'>ObsidianLink")
|
|
|
|
end
|
2024-01-21 12:24:56 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
"epwalsh/obsidian.nvim",
|
|
|
|
version = "*", -- recommended, use latest release instead of latest commit
|
|
|
|
ft = "markdown",
|
|
|
|
dependencies = { "nvim-lua/plenary.nvim" },
|
|
|
|
opts = {
|
|
|
|
workspaces = {
|
|
|
|
{
|
|
|
|
name = "Lumentis",
|
2024-01-24 21:45:15 +01:00
|
|
|
path = "~/Workspace/DnD/Lumentis/",
|
2024-01-21 12:24:56 +01:00
|
|
|
},
|
2024-01-25 18:20:36 +01:00
|
|
|
{
|
|
|
|
name = "Notes",
|
|
|
|
path = "~/Workspace/Notes/",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "PhD Notes",
|
|
|
|
path = "~/Workspace/University/PhD/Notes/",
|
|
|
|
},
|
2024-01-21 12:24:56 +01:00
|
|
|
},
|
2024-01-24 21:45:15 +01:00
|
|
|
disable_frontmatter = true,
|
|
|
|
ui = {
|
|
|
|
hl_groups = {
|
|
|
|
ObsidianRefText = { fg = "#61afef" },
|
|
|
|
}
|
|
|
|
}
|
2024-01-21 12:24:56 +01:00
|
|
|
},
|
|
|
|
keys = {
|
2024-01-21 16:23:44 +01:00
|
|
|
{"<cr>", handle_enter, ft = "markdown" },
|
|
|
|
{"<cr>", ":ObsidianLink<cr>", ft = "markdown", mode = "v"},
|
|
|
|
{"<leader>rn", ":ObsidianRename<cr>", ft = "markdown" },
|
2024-02-06 18:36:44 +01:00
|
|
|
{"<leader>-", "i- [ ] ", ft = "markdown"},
|
|
|
|
{"<leader>-", "- [ ] ", ft = "markdown", mode = "i" },
|
2024-01-21 16:23:44 +01:00
|
|
|
{"<tab>", ":set nohlsearch<cr>/\\[[^\\[\\]]*\\]([^()]*)<cr>:let @/ = \"\"<cr>:set hlsearch<cr>", ft = "markdown", silent = true },
|
2024-01-21 12:24:56 +01:00
|
|
|
},
|
|
|
|
detect_cwd = true,
|
2024-01-24 21:45:15 +01:00
|
|
|
config = function (_, opts)
|
|
|
|
require("obsidian").setup(opts)
|
|
|
|
end
|
2024-01-21 12:24:56 +01:00
|
|
|
}
|