Skip to content

Commit 89cab28

Browse files
ibashepwalsh
andauthored
Make searching for notes by filename case insensitive (#620)
* Make searching for notes by filename case insensitive I have a note named "Rob Snyder.md". When I tried to link to it with cmp like "[[rob " the note wasn't found. After this change the note is found. Note that `ignore_case` will set the `--ignore-case` flag in the rg command. However that flag is ignored and instead `--glob-case-insensitive` is what affects results. * Update CHANGELOG.md --------- Co-authored-by: Pete <epwalsh10@gmail.com>
1 parent c6bd6d9 commit 89cab28

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Fixed
11+
12+
- Searching for notes by file name is case insensitive.
13+
1014
## [v3.7.14](https://github.com/epwalsh/obsidian.nvim/releases/tag/v3.7.14) - 2024-06-04
1115

1216
### Added

lua/obsidian/client.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,13 @@ Client._search_iter_async = function(self, term, search_opts, find_opts)
421421
on_exit
422422
)
423423

424-
search.find_async(self.dir, term, self:_prepare_search_opts(find_opts), on_find_match, on_exit)
424+
search.find_async(
425+
self.dir,
426+
term,
427+
self:_prepare_search_opts(find_opts, { ignore_case = true }),
428+
on_find_match,
429+
on_exit
430+
)
425431

426432
return function()
427433
while cmds_done < 2 do

lua/obsidian/search.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ M.build_find_cmd = function(path, term, opts)
407407
additional_opts[#additional_opts + 1] = term
408408
end
409409

410+
if opts.ignore_case then
411+
additional_opts[#additional_opts + 1] = "--glob-case-insensitive"
412+
end
413+
410414
if path ~= nil and path ~= "." then
411415
if opts.escape_path then
412416
path = assert(vim.fn.fnameescape(tostring(path)))

0 commit comments

Comments
 (0)