silverbullet-grep
is a Plug for SilverBullet to search notes in your space using git grep
command.
If you run SilverBullet using Docker, Git is already included. Otherwise install Git from your system's package manager, or following Git documentation.
Open your PLUGS
note in SilverBullet and add this plug to the list:
- ghr:Maarrk/silverbullet-grep
Then run the {[Plugs: Update]} command and off you go!
The plug provides the following commands:
- {[Grep: Version]}
- {[Grep: Search Literal Text]}
- {[Grep: Search Regex Pattern]}
- {[Grep: Literal Text Inside Current Folder]}
- {[Grep: Regex Pattern Inside Current Folder]}
You may want to set Shortcuts for them.
This plug can be configured with Space Config, these are the default values and their usage:
grep:
# ignore case when search pattern is all lowercase
smartCase: true
# by default shows results in a virtual page, like the built-in search
saveResults: false
# visually distinguish >>>matched part<<< in shown context
surround:
left: ">>>"
right: "<<<"
# or disable with
# surround: false
Note that surround markers may appear in different parts of page text depending on your query, so it's advised not to use markdown syntax there.
Yes.
- Exclude files matching the
spaceIgnore
setting - Settings or commands for including meta and hidden pages
- Commands for searching pages by name
- Optionally include filename matches in the regular search based on a setting
If you find bugs, report them on the issue tracker on GitHub. I doubt I will implement more features, Pull Requests are preferred.
To build this plug, make sure you have SilverBullet installed. Then, build the plug with:
deno task build
Or to watch for changes and rebuild automatically
deno task watch
Then, copy the resulting .plug.js
file into your space's _plug
folder. Or build and copy in one command:
deno task build && cp *.plug.js /my/space/_plug/
SilverBullet will automatically sync and load the new version of the plug (or speed up this process by running the {[Sync: Now]} command).
MIT, following SilverBullet