103 lines
4.1 KiB
Lua
103 lines
4.1 KiB
Lua
vim.notify = require("notify")
|
|
return {
|
|
"epwalsh/obsidian.nvim",
|
|
version = "*", -- recommended, use latest release instead of latest commit
|
|
lazy = true,
|
|
ft = "markdown",
|
|
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
|
-- event = {
|
|
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
|
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
|
|
-- -- refer to `:h file-pattern` for more examples
|
|
-- "BufReadPre path/to/my-vault/*.md",
|
|
-- "BufNewFile path/to/my-vault/*.md",
|
|
-- },
|
|
dependencies = {
|
|
-- Required.
|
|
"nvim-lua/plenary.nvim",
|
|
|
|
-- see below for full list of optional dependencies 👇
|
|
},
|
|
opts = {
|
|
workspaces = {
|
|
{
|
|
name = "vault",
|
|
path = "~/S/obsidian/Vault",
|
|
},
|
|
-- {
|
|
-- name = "work",
|
|
-- path = "~/vaults/work",
|
|
-- },
|
|
},
|
|
completion = {
|
|
-- Set to false to disable completion.
|
|
nvim_cmp = true,
|
|
-- Trigger completion at 2 chars.
|
|
min_chars = 2,
|
|
},
|
|
-- Optional, configure additional syntax highlighting / extmarks.
|
|
-- This requires you have `conceallevel` set to 1 or 2. See `:help conceallevel` for more details.
|
|
ui = {
|
|
enable = true, -- set to false to disable all additional syntax features
|
|
update_debounce = 200, -- update delay after a text change (in milliseconds)
|
|
max_file_length = 5000, -- disable UI features for files with more than this many lines
|
|
-- Define how various check-boxes are displayed
|
|
checkboxes = {
|
|
-- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below.
|
|
[" "] = { char = "", hl_group = "ObsidianTodo" },
|
|
["x"] = { char = "", hl_group = "ObsidianDone" },
|
|
[">"] = { char = "", hl_group = "ObsidianRightArrow" },
|
|
["~"] = { char = "", hl_group = "ObsidianTilde" },
|
|
["!"] = { char = "", hl_group = "ObsidianImportant" },
|
|
-- Replace the above with this if you don't have a patched font:
|
|
-- [" "] = { char = "☐", hl_group = "ObsidianTodo" },
|
|
-- ["x"] = { char = "✔", hl_group = "ObsidianDone" },
|
|
|
|
-- You can also add more custom ones...
|
|
},
|
|
},
|
|
attachments = {
|
|
-- The default folder to place images in via `:ObsidianPasteImg`.
|
|
-- If this is a relative path it will be interpreted as relative to the vault root.
|
|
-- You can always override this per image by passing a full path to the command instead of just a filename.
|
|
img_folder = "screenshots", -- This is the default
|
|
|
|
-- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`.
|
|
---@return string
|
|
img_name_func = function()
|
|
-- Prefix image names with timestamp.
|
|
return string.format("%s-", os.time())
|
|
end,
|
|
|
|
-- A function that determines the text to insert in the note when pasting an image.
|
|
-- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
|
|
-- This is the default implementation.
|
|
---@param client obsidian.Client
|
|
---@param path obsidian.Path the absolute path to the image file
|
|
---@return string
|
|
img_text_func = function(client, path)
|
|
path = client:vault_relative_path(path) or path
|
|
return string.format("", path.name, path)
|
|
end,
|
|
},
|
|
-- Optional, by default when you use `:ObsidianFollowLink` on a link to an external
|
|
-- URL it will be ignored but you can customize this behavior here.
|
|
---@param url string
|
|
follow_url_func = function(url)
|
|
-- Open the URL in the default web browser.
|
|
vim.fn.jobstart({ "open", url }) -- Mac OS
|
|
-- vim.fn.jobstart({"xdg-open", url}) -- linux
|
|
-- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows
|
|
-- vim.ui.open(url) -- need Neovim 0.10.0+
|
|
end,
|
|
-- Optional, by default when you use `:ObsidianFollowLink` on a link to an image
|
|
-- file it will be ignored but you can customize this behavior here.
|
|
---@param img string
|
|
follow_img_func = function(url)
|
|
-- vim.fn.jobstart({ "qlmanage", "-p", img }) -- Mac OS quick look preview
|
|
vim.fn.jobstart({ "xdg-open", url }) -- linux
|
|
-- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows
|
|
end,
|
|
},
|
|
}
|