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
|
2024-02-10 14:02:40 +01:00
|
|
|
lazy = false,
|
2024-01-21 12:24:56 +01:00
|
|
|
dependencies = { "nvim-lua/plenary.nvim" },
|
|
|
|
opts = {
|
|
|
|
workspaces = {
|
|
|
|
{
|
|
|
|
name = "Lumentis",
|
2024-02-10 14:02:40 +01:00
|
|
|
path = "~/Workspace/DnD/Lumentis",
|
2024-01-21 12:24:56 +01:00
|
|
|
},
|
2024-01-25 18:20:36 +01:00
|
|
|
{
|
|
|
|
name = "Notes",
|
2024-02-10 14:02:40 +01:00
|
|
|
path = "~/Workspace/Notes",
|
2024-01-25 18:20:36 +01:00
|
|
|
},
|
|
|
|
{
|
2024-02-10 14:02:40 +01:00
|
|
|
name = "PhD-Notes",
|
|
|
|
path = "~/Workspace/University/PhD/Notes",
|
2024-01-25 18:20:36 +01:00
|
|
|
},
|
2024-02-10 14:02:40 +01:00
|
|
|
{
|
|
|
|
name = "DnD",
|
|
|
|
path = "~/Workspace/DnD",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "no-vault",
|
|
|
|
path = function()
|
|
|
|
-- alternatively use the CWD:
|
|
|
|
return assert(vim.fn.getcwd())
|
|
|
|
-- return assert(vim.fs.dirname(vim.api.nvim_buf_get_name(0)))
|
|
|
|
end,
|
|
|
|
overrides = {
|
|
|
|
notes_subdir = vim.NIL, -- have to use 'vim.NIL' instead of 'nil'
|
|
|
|
completion = {
|
|
|
|
new_notes_location = "current_dir",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
daily_notes = {
|
|
|
|
folder = "Daily",
|
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" },
|
2024-02-10 14:02:40 +01:00
|
|
|
{"<cr>", "<cmd>ObsidianLink<cr>", ft = "markdown", mode = "v"},
|
|
|
|
{"<leader>rn", "<cmd>ObsidianRename<cr>", ft = "markdown" },
|
2024-02-08 15:16:48 +01:00
|
|
|
{"<leader>l", "i- [ ] ", ft = "markdown"},
|
2024-02-11 23:58:36 +01:00
|
|
|
{"<leader>o", "o- [ ] ", ft = "markdown"},
|
2024-02-08 15:16:48 +01:00
|
|
|
{"<leader>l", "- [ ] ", ft = "markdown", mode = "i" },
|
2024-02-10 14:26:58 +01:00
|
|
|
{"<leader>jt", "<cmd>ObsidianToday<cr>"},
|
|
|
|
{"<leader>jy", "<cmd>ObsidianYesterday<cr>"},
|
|
|
|
{"<leader>ju", "<cmd>ObsidianTomorrow<cr>"},
|
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
|
|
|
},
|
2024-01-24 21:45:15 +01:00
|
|
|
config = function (_, opts)
|
|
|
|
require("obsidian").setup(opts)
|
|
|
|
end
|
2024-01-21 12:24:56 +01:00
|
|
|
}
|