Because Obsidian’s “Find/Replace in current file” doesn’t quite meet my needs. So I decided to write a plug-in to improve my experience.
The plug-in is still in the development stage, but some basic functions have been completed, such as: find, replace, highlight, display the number of matches, support regular expressions, case sensitivity…
I think the appearance of the plug-in is also OK.
There should be no obvious problems in use at present, you can try it.
(via Google translate)
Cool! Are you planning on global search/replace? That’s really the only reason I still have to use VScode sometimes. I’d love to get that function in Obsidian
I tried that one but it broke some notes. It deleted more than the regex should have, though it worked in vscode. So i deleted that plugin. I hope @hafuhafu won’t do that haha
Thanks for the suggestion.
At this stage, I mainly want to improve the “in the current file” feature.
Global search/replace currently does not seem to provide an available API in Obsidian.
But it seems that it can be implemented in some special way. Maybe I will start exploring it after the main features are stable .
If I understand correctly: if you need to match a line break, use shift+enter to make the text wrap, and typing \n in the input box will only match the text \n.
Sorry, I used Google Translate to do this conversation so it might be a little confusing.
All the input in the Replace field, except for the regular expression related $1, $2…, will be treated as text (string).
If you want to use line breaks on PC, you can use shift+enter to do it.
I tried typing a line break on my phone and it worked just by pressing enter.
Thanks.
The strong suit of your plugin compared to the built-in find (and replace) is support for case sensitivity and regex. I was focusing on the regex capabilities, of course.
Maybe it’s because I modified isDesktopOnly and it needs to be restarted to take effect? I’m not sure.
I tried many times and can’t reproduce it yet.
Okay, so the modal works until I load a workspace. After that, I cannot invoke the modal.
Probably this is the problem I hit before but didn’t know how to reproduce it. I was able to reproduce it by loading different workspaces now.