Spacemacs can be interfaced with different search utilities like:
The search commands in Spacemacs are organized under the SPC s prefix with
the next key is the tool to use and the last key is the scope. For instance
SPC s a b will search in all opened buffers using ag.
If the last key (determining the scope) is uppercase then the current region
or symbol under point is used as default input for the search. For instance
SPC s a B will search with symbol under point (if there is no active region).
If the tool key is omitted then a default tool will be automatically
selected for the search. This tool corresponds to the first tool found on the
system of the list dotspacemacs-search-tools, the default order is ag,
pt, ack then grep. For instance SPC b b will search in the opened
buffers using pt if ag has not been found on the system.
The tool keys are:
| Tool | Key |
|---|---|
| ag | a |
| grep | g |
| ack | k |
| pt | t |
The available scopes and corresponding keys are:
| Scope | Key |
|---|---|
| opened buffers | b |
| files in a given directory | f |
| current project | p |
It is possible to search in the current file by double tapping the second key
of the sequence, for instance SPC s a a will search in the current
file with ag.
Notes
agandptare optimized to be used in a source control repository but they can be used in an arbitrary directory as well.- It is also possible to search in several directories at once by marking them in the helm buffer.
Beware if you use pt, TCL parser tools also install a command line tool
called pt.
| Key Binding | Description |
|---|---|
SPC h l | resume the last helm buffer |
F3 | in a helm buffer, convert a helm search buffer into a regular buffer |
SPC s L | focus the last converted search buffer |
| Prefix argument | will ask for file extensions |
| Key Binding | Description |
|---|---|
SPC s s | search with the first found tool |
SPC s S | search with the first found tool with default input |
SPC s a a | ag |
SPC s a A | ag with default input |
SPC s g g | grep |
SPC s g G | grep with default input |
| Key Binding | Description |
|---|---|
SPC s b | search with the first found tool |
SPC s B | search with the first found tool with default input |
SPC s a b | ag |
SPC s a B | ag with default text |
SPC s g b | grep |
SPC s g B | grep with default text |
SPC s k b | ack |
SPC s k B | ack with default text |
SPC s t b | pt |
SPC s t B | pt with default text |
| Key Binding | Description |
|---|---|
SPC s f | search with the first found tool |
SPC s F | search with the first found tool with default input |
SPC s a f | ag |
SPC s a F | ag with default text |
SPC s g f | grep |
SPC s g F | grep with default text |
SPC s k f | ack |
SPC s k F | ack with default text |
SPC s t f | pt |
SPC s t F | pt with default text |
| Key Binding | Description |
|---|---|
SPC / or SPC s p | search with the first found tool |
SPC ? or SPC s P | search with the first found tool with default input |
SPC s a p | ag |
SPC s a P | ag with default text |
SPC s g p | grep with default text |
SPC s k p | ack |
SPC s k P | ack with default text |
SPC s t p | pt |
SPC s t P | pt with default text |