btw i use nix
1
2local function find_vault_path()
3 local cwd = vim.loop.cwd()
4 local path = cwd
5 while path ~= "/" do
6 if vim.fs.basename(path) == "vault" then
7 return path
8 end
9 path = vim.fs.dirname(path)
10 end
11 return nil
12end
13
14local vault_path = find_vault_path()
15
16if vault_path ~= nil then
17 require("obsidian").setup({
18 workspaces = {
19 {
20 name = "vault",
21 path = vault_path,
22 },
23 },
24 completion = {
25 nvim_cmp = true,
26 min_chars = 2,
27 },
28 mappings = {
29 -- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
30 ["gf"] = {
31 action = function()
32 return require("obsidian").util.gf_passthrough()
33 end,
34 opts = { noremap = false, expr = true, buffer = true },
35 },
36 -- Toggle check-boxes.
37 ["<leader>ch"] = {
38 action = function()
39 return require("obsidian").util.toggle_checkbox()
40 end,
41 opts = { buffer = true },
42 },
43 -- Smart action depending on context, either follow link or toggle checkbox.
44 ["<cr>"] = {
45 action = function()
46 return require("obsidian").util.smart_action()
47 end,
48 opts = { buffer = true, expr = true },
49 }
50 },
51 ui = {
52 enable = false,
53 },
54 disable_frontmatter = true,
55 wiki_link_func = "use_path_only",
56 })
57end