-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(obsidian-nvim): added obsidian.nvim config and changed the readme (…
…#378) * added obsidian.nvim config and changed the readme * added vim.env.HOME to the config * fix(obsidian-nvim): os agnostic link opening * fix(obsidian-nvim): proper key nesting * refactor(obsidian-nvim): return to opts table from function * fix(obsidian-nvim): remove default values the removed opts are already set to the same values by default, see here: https://github.com/epwalsh/obsidian.nvim/blob/main/lua/obsidian/config.lua * feat(obsidian-nvim): add Windows support for URLs Co-authored-by: Uzair Aftab <[email protected]> * fix(obsidian-nvim): remove empty line * fix(obsidian-nvim): Use astronvim utils or native vim api's to open file Co-authored-by: Micah Halter <[email protected]> --------- Co-authored-by: mortang2410 <[email protected]> Co-authored-by: Olivier Wittek <[email protected]> Co-authored-by: Uzair Aftab <[email protected]> Co-authored-by: Micah Halter <[email protected]>
- Loading branch information
1 parent
74393f5
commit 3234929
Showing
2 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,54 @@ | ||
return { | ||
"epwalsh/obsidian.nvim", | ||
cmd = { | ||
"ObsdianBacklinks", | ||
"ObsidianToday", | ||
"ObsidianYesterday", | ||
"ObsidianOpen", | ||
"ObsidianNew", | ||
"ObsidianSearch", | ||
"ObsidianQuickSwitch", | ||
"ObsidianLink", | ||
"ObsidianLinkNew", | ||
"ObsidianFollowLink", | ||
"ObsidianTemplate", | ||
-- the obsidian vault in this default config ~/obsidian-vault | ||
-- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand': | ||
-- event = { "bufreadpre " .. vim.fn.expand "~" .. "/my-vault/**.md" }, | ||
event = { "BufReadPre */obsidian-vault/*.md" }, | ||
keys = { | ||
{ | ||
"gf", | ||
function() | ||
if require("obsidian").util.cursor_on_markdown_link() then | ||
return "<cmd>ObsidianFollowLink<CR>" | ||
else | ||
return "gf" | ||
end | ||
end, | ||
noremap = false, | ||
expr = true, | ||
}, | ||
}, | ||
dependencies = { | ||
"nvim-lua/plenary.nvim", | ||
"hrsh7th/nvim-cmp", | ||
"nvim-telescope/telescope.nvim", | ||
}, | ||
opts = { | ||
dir = vim.env.HOME .. "/obsidian-vault", -- specify the vault location. no need to call 'vim.fn.expand' here | ||
use_advanced_uri = true, | ||
finder = "telescope.nvim", | ||
|
||
templates = { | ||
subdir = "templates", | ||
date_format = "%Y-%m-%d-%a", | ||
time_format = "%H:%M", | ||
}, | ||
|
||
note_frontmatter_func = function(note) | ||
-- This is equivalent to the default frontmatter function. | ||
local out = { id = note.id, aliases = note.aliases, tags = note.tags } | ||
-- `note.metadata` contains any manually added fields in the frontmatter. | ||
-- So here we just make sure those fields are kept in the frontmatter. | ||
if note.metadata ~= nil and require("obsidian").util.table_length(note.metadata) > 0 then | ||
for k, v in pairs(note.metadata) do | ||
out[k] = v | ||
end | ||
end | ||
return out | ||
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. | ||
follow_url_func = vim.ui.open or require("astronvim.utils").system_open, | ||
}, | ||
opts = { completion = { nvim_cmp = true } }, | ||
} |