What's new
There's a lot of new features and improvements here that I'm really excited about 🥳 They've improved my workflow a ton and I hope they do for you too. To highlight the 3 biggest additions:
-
🔗 Full support for header anchor links and block links! That means both for following links and completion of links. Various forms of anchor/block links are support. Here are a few examples:
- Typical Obsidian-style wiki links, e.g.
[[My note#Heading 1]]
,[[My note#Heading 1#Sub heading]]
,[[My note#^block-123]]
. - Wiki links with a label, e.g.
[[my-note#heading-1|Heading 1 in My Note]]
. - Markdown links, e.g.
[Heading 1 in My Note](my-note.md#heading-1)
.
We also support links to headers within the same note, like for a table of contents, e.g.
[[#Heading 1]]
,[[#heading-1|Heading]]
,[[#^block-1]]
. - Typical Obsidian-style wiki links, e.g.
-
📲 A basic callback system to let you easily customize obisidian.nvim's behavior even more. There are currently 5 events:
post_setup
,enter_note
,leave_note
,pre_write_note
, andpost_set_workspace
. You can define a function for each of these in your config. -
🔭 Improved picker integrations (especially for telescope), particular for the
:ObsidianTags
command. See #450 for a demo.
Full changelog below 👇
Added 🎉
-
Added a configurable callback system to further customize obsidian.nvim's behavior. Callbacks are defined through the
callbacks
field in the config:callbacks = { -- Runs at the end of `require("obsidian").setup()`. ---@param client obsidian.Client post_setup = function(client) end, -- Runs anytime you enter the buffer for a note. ---@param client obsidian.Client ---@param note obsidian.Note enter_note = function(client, note) end, -- Runs anytime you leave the buffer for a note. ---@param client obsidian.Client ---@param note obsidian.Note leave_note = function(client, note) end, -- Runs right before writing the buffer for a note. ---@param client obsidian.Client ---@param note obsidian.Note pre_write_note = function(client, note) end, -- Runs anytime the workspace is set/changed. ---@param client obsidian.Client ---@param workspace obsidian.Workspace post_set_workspace = function(client, workspace) end, }
-
Added configuration option
note_path_func(spec): obsidian.Path
for customizing how file names for new notes are generated. This takes a single argument, a table that looks like{ id: string, dir: obsidian.Path, title: string|? }
, and returns anobsidian.Path
object. The default behavior is equivalent to this:---@param spec { id: string, dir: obsidian.Path, title: string|? } ---@return string|obsidian.Path The full path to the new note. note_path_func = function(spec) local path = spec.dir / tostring(spec.id) return path:with_suffix(".md") end
-
Added config option
picker.tag_mappings
, analogous topicker.note_mappings
. -
Added
log
field toobsidian.Client
for easier access to the logger. -
Added ability to follow anchor and block links.
-
Added completion support for anchor and block links. Note that this requires you to update your
wiki_link_func
andmarkdown_link_func
in your config to handle anchors and blocks. See the configuration example in the README. -
You can set
wiki_link_func
to a one of the following strings to use a builtin function:"use_alias_only"
, e.g.[[Foo Bar]]
"prepend_note_id"
, e.g.[[foo-bar|Foo Bar]]
"prepend_note_path"
, e.g.[[foo-bar.md|Foo Bar]]
"use_path_only"
, e.g.[[foo-bar.md]]
-
Added command
:ObsidianDailies
for opening a picker list of daily notes.
Changed ⚠️
- Renamed config option
picker.mappings
topicker.note_mappings
.
Fixed ✅
- Fixed consistency in frontmatter between opening daily notes with or without a template
- Fixed issue with
:ObsidianOpen
on windows. - Respect telescope.nvim themes configured by user.
- Make tags completion more efficient (less CPU time!).
- Added file/directory completion to image name prompt from
:ObsidianPasteImg
. - Handle prompt cancellation gracefully.
- Fix lua diagnostic warnings about missing fields in the configuration.
- Made
Client:resolve_note()
more robust to when the search term is a file name.
Commits
6888c76 chore(release): bump version to v3.7.0 for release
d0d699c Update picker titles
43abaa3 Use header under cursor when collecting backlinks
4c5a1b0 Use block ID under cursor for backlinks
eb5706e chore(docs): auto generate docs
ad0d6bb Add leave-note
callback event
ba116f3 chore(docs): auto generate docs
554b0d6 Add template
option to Client:create_note()
656313b Show sub tags
3fd4877 chore(docs): auto generate docs
1c2921e support anchors/blocks in backlinks
598cc7d Fix #478
52f94d0 chore(docs): auto generate docs
e69b824 Support datetime macros with cmp_obsidian_new
51bc688 Make nvim-cmp
completion more robust to different link formats
3393e3b Make Client:resolve_note
robust to file name searches.
497d605 Allow '+' in URLs for detection
81c560a Error when templates fail instead of log
0cde098 Fix some type hints (#474)
86468d7 chore(docs): auto generate docs
7b27902 Add ext marks for block IDs
3704c5e Clean up
02971d2 provide consistency between daily notes frontmatter with/without template (#472)
2814bd2 chore(docs): auto generate docs
1f31e2b Add more context to cmp entry documentation
aa4312f chore(docs): auto generate docs
f1f106e add support for block links
207bdea Clean up unnecessary diagnostic comments
62c845f fix: handle timer nil value in async.throttle function (#468)
169f3ef Handle prompt cancellation gracefully
28ddc4c Fix bug with log.log_once()
3158718 Fix lint
cb309f2 chore(docs): auto generate docs
8d3fbb2 Handle blocks links
a29d178 Ensure line and col are in picker entry
4e53636 Consolidate code that falls back to picker
0e5e062 Use picker when we can't resolve to a single note
57c14b7 Ignore case in backlinks search
ae0c95f Ensure daily note is given title
0a4f7d3 Sort :ObsidianLinks
entries by lnum
8101f72 Add :ObsidianDailies
command
099ef3d Add file/dir completion to image name prompt
656d9c2 Add more details to CHANGELOG
fe7464d Catch single char anchors for completion
42c8d1a chore(docs): auto generate docs
06c1ee7 minor improvements
ab6877f minor improvement to tags and new cmp sources
89672ca chore(docs): auto generate docs
47ccca2 Handle nested anchor links, improve completion (#460)
977e621 Fix open cmd on windows (#459)
c57b248 Respect user's telescope.nvim themes
b14c882 chore(docs): auto generate docs
225f80d Add completion for header anchors (#457)
2746f79 chore(docs): auto generate docs
38abaa1 Merge pull request #455 from epwalsh/epwalsh/lua-api-improvements
60432d3 Add a safety check for note_id_func
6eb6707 chore(docs): auto generate docs
f615466 CHANGELOG
4648518 :ObsidianFollowLink
will now attempt to resolve anchor
1e0b4ce chore(docs): auto generate docs
8879320 Add basic callbacks system (#451)
4c521b9 Make util.get_visual_selection()
more robust
7734811 Fix bug with getting viz selection for tags command
bbc553f Don't use telescope previewer for string values
35f27e2 chore(docs): auto generate docs
9ff9f34 Added note_path_func
option to customize how note fname are generated (#445)
c7812ab chore(docs): auto generate docs
cc4efa1 Picker improvements (#447)
a6af03b add more info to debug output
3cfbf14 Make util.strip_comments()
more robust
f60660b make logging more robust