mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-06 15:30:40 +01:00
feat(alias-finder): use ripgrep if possible (#13043)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
@@ -11,6 +11,8 @@ plugins=(... alias-finder)
|
||||
|
||||
To enable it for every single command, set zstyle in your `~/.zshrc`.
|
||||
|
||||
If the user has installed `rg`([ripgrep](https://github.com/BurntSushi/ripgrep)), it will be used because it's faster. Otherwise, it will use the `grep` command.
|
||||
|
||||
```zsh
|
||||
# ~/.zshrc
|
||||
|
||||
|
||||
@@ -43,7 +43,11 @@ alias-finder() {
|
||||
filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
|
||||
fi
|
||||
|
||||
if (( $+commands[rg] )); then
|
||||
alias | rg "$filter" | rg "=$finder"
|
||||
else
|
||||
alias | grep -E "$filter" | grep -E "=$finder"
|
||||
fi
|
||||
|
||||
if [[ $exact == true ]]; then
|
||||
break # because exact case is only one
|
||||
|
||||
Reference in New Issue
Block a user