Diff
1diff --git a/plugins/alias-finder/README.md b/plugins/alias-finder/README.md
2index a9bbd08387de8cf04dcc0b198191e1353eb6623f..b24f8d4acc8b401d52119ed31400716f2d0ae54e 100644
3--- a/plugins/alias-finder/README.md
4+++ b/plugins/alias-finder/README.md
5@@ -11,6 +11,8 @@ plugins=(... alias-finder)
6
7 To enable it for every single command, set zstyle in your `~/.zshrc`.
8
9+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.
10+
11 ```zsh
12 # ~/.zshrc
13
14@@ -28,7 +30,7 @@ When you execute a command alias finder will look at your defined aliases and su
15
16 Running the un-aliased `git status` command:
17 ```sh
18-╭─tim@fox ~/repo/gitopolis ‹main›
19+╭─tim@fox ~/repo/gitopolis ‹main›
20 ╰─$ git status
21
22 gst='git status' # <=== shorter suggestion from alias-finder
23@@ -40,7 +42,7 @@ nothing to commit, working tree clean
24
25 Running a shorter `git st` alias from `.gitconfig` that it suggested :
26 ```sh
27-╭─tim@fox ~/repo/gitopolis ‹main›
28+╭─tim@fox ~/repo/gitopolis ‹main›
29 ╰─$ git st
30 gs='git st' # <=== shorter suggestion from alias-finder
31 ## main...origin/main
32@@ -48,7 +50,7 @@ gs='git st' # <=== shorter suggestion from alias-finder
33
34 Running the shortest `gs` shell alias that it found:
35 ```sh
36-╭─tim@fox ~/repo/gitopolis ‹main›
37+╭─tim@fox ~/repo/gitopolis ‹main›
38 ╰─$ gs
39 # <=== no suggestions alias-finder because this is the shortest
40 ## main...origin/main
41diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh
42index 2351a439e046c994b81ca3b28b047058f7f456a9..6f24c7089cb13c6bfedaf5fd10c98a6a348ce45f 100644
43--- a/plugins/alias-finder/alias-finder.plugin.zsh
44+++ b/plugins/alias-finder/alias-finder.plugin.zsh
45@@ -43,7 +43,11 @@ alias-finder() {
46 filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
47 fi
48
49- alias | grep -E "$filter" | grep -E "=$finder"
50+ if (( $+commands[rg] )); then
51+ alias | rg "$filter" | rg "=$finder"
52+ else
53+ alias | grep -E "$filter" | grep -E "=$finder"
54+ fi
55
56 if [[ $exact == true ]]; then
57 break # because exact case is only one