Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
malko42 authored Jun 18, 2024
2 parents 21b8494 + 7e087da commit c60374e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added relative to root markdown links as search pattern for backlinks.
- Added `ObsidianNewFromTemplate` command. This command will create a new note from a template.

### Fixed

- Searching for notes by file name is case insensitive.

## [v3.7.14](https://github.com/epwalsh/obsidian.nvim/releases/tag/v3.7.14) - 2024-06-04

### Added
Expand Down
16 changes: 15 additions & 1 deletion lua/obsidian/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,13 @@ Client._search_iter_async = function(self, term, search_opts, find_opts)
on_exit
)

search.find_async(self.dir, term, self:_prepare_search_opts(find_opts), on_find_match, on_exit)
search.find_async(
self.dir,
term,
self:_prepare_search_opts(find_opts, { ignore_case = true }),
on_find_match,
on_exit
)

return function()
while cmds_done < 2 do
Expand Down Expand Up @@ -1297,22 +1303,30 @@ Client.find_backlinks_async = function(self, note, callback, opts)
search_terms[#search_terms + 1] = string.format("[[%s|", ref)
-- Markdown link without anchor/block.
search_terms[#search_terms + 1] = string.format("(%s)", ref)
-- Markdown link without anchor/block and is relative to root.
search_terms[#search_terms + 1] = string.format("(/%s)", ref)
-- Wiki links with anchor/block.
search_terms[#search_terms + 1] = string.format("[[%s#", ref)
-- Markdown link with anchor/block.
search_terms[#search_terms + 1] = string.format("(%s#", ref)
-- Markdown link with anchor/block and is relative to root.
search_terms[#search_terms + 1] = string.format("(/%s#", ref)
elseif anchor then
-- Note: Obsidian allow a lot of different forms of anchor links, so we can't assume
-- it's the standardized form here.
-- Wiki links with anchor.
search_terms[#search_terms + 1] = string.format("[[%s#", ref)
-- Markdown link with anchor.
search_terms[#search_terms + 1] = string.format("(%s#", ref)
-- Markdown link with anchor and is relative to root.
search_terms[#search_terms + 1] = string.format("(/%s#", ref)
elseif block then
-- Wiki links with block.
search_terms[#search_terms + 1] = string.format("[[%s#%s", ref, block)
-- Markdown link with block.
search_terms[#search_terms + 1] = string.format("(%s#%s", ref, block)
-- Markdown link with block and is relative to root.
search_terms[#search_terms + 1] = string.format("(/%s#%s", ref, block)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions lua/obsidian/search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ M.build_find_cmd = function(path, term, opts)
additional_opts[#additional_opts + 1] = term
end

if opts.ignore_case then
additional_opts[#additional_opts + 1] = "--glob-case-insensitive"
end

if path ~= nil and path ~= "." then
if opts.escape_path then
path = assert(vim.fn.fnameescape(tostring(path)))
Expand Down

0 comments on commit c60374e

Please sign in to comment.