Consult
tags :
Emacs package #
Consulting completing-read https://github.com/minad/consult
- Consult provides search and navigation commands based on the Emacs completion function completing-read.
- Completion allows you to quickly select an item from a list of candidates.
- Consult offers asynchronous and interactive consult-grep and consult-ripgrep commands, and the line-based search command consult-line.
- Furthermore Consult provides an advanced buffer switching command
consult-bufferto switch between buffers, recently opened files, bookmarks and buffer-like candidates from other sources.- Some of the Consult commands are enhanced versions of built-in Emacs commands. For example the command consult-imenu presents a flat list of the Imenu with live preview, grouping and narrowing. Please take a look at the full list of commands.
consult-buffer #
Press SPC to show ephemeral buffers. Supported narrowing keys:
- b Buffers
- SPC Hidden buffers
- “*” Modified buffers
- f Files (Requires recentf-mode)
- r File registers
- m Bookmarks
- p Project
Custom other sources configured in consult-buffer-sources.
Search #
consult-line #
Enter search string and select from matching lines. Supports live preview and recursive editing. The symbol at point and the recent Isearch string are added to the “future history” and can be accessed by pressing M-n. When consult-line is bound to the isearch-mode-map and is invoked during a running Isearch, it will use the current Isearch string.
consult-line-multi #
Search dynamically across multiple buffers.
- By default search across project buffers.
- If invoked with a prefix argument search across all buffers. The candidates are computed on demand based on the input. The command behaves like consult-grep, but operates on buffers instead of files.
Grep and Find #
consult-grep, consult-ripgrep, consult-git-grep #
consult-find, consult-fd, consult-locate #
Find file by matching the path against a regexp.
- Like for consult-grep, either the project root or the current directory is the root directory for
the search.
- The input string is treated similarly to consult-grep, where the first part is passed to find, and the second part is used for Emacs filtering. Prefix arguments to consult-find work just like those for the consult grep commands.
consult-dir #
Choose a directory and act on it.
C-x C-d
Calling it without context #
- -> by default it calls books when called directly
- bookmarks
- downloads
- projects etc
Calling it in consult context #
C-x C-d -> to select a directory or file to copy