This plugin allows more powerful search operators, searches to be saved and refreshed with a single click, and to replace text across multiple notes.
NotePlan can search over your notes, but it is currently not very flexible or easy to use; in particular it's difficult to navigate between the search results and any of the actual notes it shows. This plugin adds some extra power and usability to searching. It:

/flexiSearch presents a dialog box which allows you to select all available options, without needing to know which of the following specific commands to call.
Note: when /flexiSearch is run on iPhone or iPad you will need to close the dialog box by pressing the X in the top right-hand corner after the search has run. (I'm trying to find a way around this limitation.)
/quickSearch searches across all notes (both calendar and regular notes), saving to a pre-set 'Quick Search Results' note. (Alias: /qs.)
/search searches across all notes (both calendar and regular notes). (Alias: /ss.)
/searchOpenTasks searches just across open tasks in all notes.
/searchOverNotes searches across all regular (non-calendar) notes.
/searchOverCalendar searches across all calendar notes.
/searchInPeriod: searches over the calendar (daily, weekly etc.) notes of the time period you select:
The results are always saved to a note with the search terms as its title in a "Saved Searches" folder (which is created if necessary). If the same search terms are used again they will update the same note. You also are given the option of saving to the current note, or to the plugin console. The exception is /quickSearch, which always saves to the same "Quick Search Results" note.
As the results are saved to a note, the following sorts of uses are then possible:
@person -- as live tasks that can be ticked off@wins or clever #ideas you noted downGratitude: for in your daily journalThere are two display styles:
There are further display options you can set:
[[2022-06-30]])@2022-06-30)>2022-06-30).Each results note has a [π Refresh results for ...] pseudo-button under the title of the note. Clicking that runs the search again, and replaces the earlier set of results:

A saved search can be automatically refreshed when opening it. To enable this, run "/add trigger" on the saved search note, and select "π Search Extensions: 'refreshSavedSearch'" from the list. To turn this off again, just remove the line starting triggers: onOpen from the note's properties.
+ and - search operator on the front of terms that must appear, and must not appear, respectively. For example +must may could -cannot" has 4 search terms, the first must be present, the last mustn't be present, and the middle two (may, could) can be.+must_have_me !no_way_jose. (thanks @dwertheimer for this suggestion)"Holy Spirit")SPIRIT will match spirit or Spirit as well as SPIRIT). However, you can select "Case Sensitive searching" option in settings and the FlexiSearch dialog.wind matches Windings and unwind). This is what the search in NotePlan does. However, you set the "Match only on full words?" option in settings and the FlexiSearch dialog.* in a term means "match any number of characters (including none)" -- e.g. pos*e matches "possible", "posie" and "pose".? in a term means "match any single character" -- e.g. poli?e matches "polite" and "police".v2.0 adds the following commands:
All of them first show the number of occurrences found (and writes the details of each to the Plugin console log), and checks that you wish to proceed. Note: Please use this carefully, as there is no way (with the current API) to easily undo a replace operation. You would have to use the Versions menu item in each note to roll it back.
To change the default settings on macOS click the gear button on the 'Search Extensions' line in the Plugin Preferences panel to configure this plugin. Each setting has an explanation.
On iOS run the command "/Search: update plugin settings" which provides a multi-step equivalent to the more convenient macOS settings window.
To see highlighting of matching terms in Simplified-style output, you'll need to be using a theme that highlights lines using ==this syntax==. The build-in themes now include this, but you can customise an existing theme by adding something like:
{
...
"highlighted": {
"regex": "(==)([^\\s].+)(==)",
"backgroundColor": "#55D2D21B",
"order": 35,
"matchPosition": 2,
"isRevealOnCursorRange": true
},
"highlighted-left-marker": {
"regex": "(==)([^\\s].+)(==)",
"color": "#AA45A2E5",
"backgroundColor": "#7745A2E5",
"isMarkdownCharacter": true,
"isHiddenWithoutCursor": true,
"isRevealOnCursorRange": true,
"matchPosition": 1
},
"highlighted-right-marker": {
"regex": "(==)([^\\s].+)(==)",
"color": "#AA45A2E5",
"backgroundColor": "#7745A2E5",
"isMarkdownCharacter": true,
"isHiddenWithoutCursor": true,
"isRevealOnCursorRange": true,
"matchPosition": 3
},
...
}
Note: I have reported a small layout bug with this highlighting that was introduced about v3.9.9.
It's possible to call these commands from outside NotePlan using the x-callback mechanism. The URL calls all take the same form:
noteplan://x-callback-url/runPlugin?pluginID=jgclark.SearchExtensions&command=<encoded command name>&arg0=<encoded string>&arg1=<encoded string>
Notes:
calendar, notes or both.quick (Quick Search note), newnote (note specific to this search), current (to currently open note), or log (just send to console log).| Command | encoded command name | arg0 | arg1 | arg2 | arg3 | arg4 |
|---|---|---|---|---|---|---|
| /replace over ... | replace | search term | replacement text | note types (see above) | paragraph types (see above) | |
| /flexiSearch | flexiSearch (this takes no args: use this just to display the dialog box) | |||||
| /quickSearch | quickSearch | search term(s) ΒΆ | note types | paragraph types (see above) | ||
| /search | searchOverAll | search term(s) | paragraph types (see above) | destination (see above) | ||
| /searchOverCalendar | searchOverCalendar | search term(s) | paragraph types (see above) | destination (see above) | ||
| /searchOverNotes | searchOverNotes | search term(s) | paragraph types (see above) | destination (see above) | ||
| /searchOpenTasks | searchOpenTasks | search term(s) | note types (see above) | destination (see above) | ||
| /searchInPeriod | searchInPeriod | search term(s) | note types (see above) | paragraph types (see above) | destination (see above) | start date to search over (YYYYMMDD or YYYY-MM-DD format). If not given, then defaults to 3 months ago. |
ΒΆ Note: /quickSearch can be called without any parameters (noteplan://x-callback-url/runPlugin?pluginID=jgclark.SearchExtensions&command=quickSearch); run this way it will prompt for search terms.
When commands are called this way, then it all works in the background without user interaction, except for the 'quickSearch' call, or when the destination type is 'quick'.
If you find an issue with this plugin, or would like to suggest new features for it, please raise a Bug or Feature 'Issue' in GitHub. Note that it's particularly difficult to test, so please give as much context as possible.
I have spent at least 3.5 weeks of my time off on this plugin. If you would like to support my late-night work extending NotePlan through writing these plugins, you can through
Thanks!
Please see the CHANGELOG.