mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-19 02:02:32 +01:00
feat(alias-finder): Use ripgrep if possible
- basic grep is too slow for very long command. ripgrep can easily remediate this issue.
This commit is contained in:
parent
f81259fb34
commit
25b2c9f37e
2 changed files with 10 additions and 4 deletions
|
|
@ -43,7 +43,11 @@ alias-finder() {
|
|||
filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
|
||||
fi
|
||||
|
||||
alias | grep -E "$filter" | grep -E "=$finder"
|
||||
if command -v rg >/dev/null 2>&1; 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue