summaryrefslogtreecommitdiff
path: root/plugins/aliases
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2022-01-01 02:26:11 -0600
committerTuowen Zhao <ztuowen@gmail.com>2022-01-01 02:26:11 -0600
commit49edbf438ed690c76e6b2af80368c59404cf0167 (patch)
tree129b3adb2f5f39a1329a426a3b7d51ed2c2290c1 /plugins/aliases
parent1bc186dabe12b3d01b2257e82f3a104c48b8b3c7 (diff)
parent78c91ccbf99c77bd4d9cdb74279a40776721f66d (diff)
downloadzsh-49edbf438ed690c76e6b2af80368c59404cf0167.tar.gz
zsh-49edbf438ed690c76e6b2af80368c59404cf0167.tar.bz2
zsh-49edbf438ed690c76e6b2af80368c59404cf0167.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins/aliases')
-rw-r--r--plugins/aliases/.gitignore1
-rw-r--r--plugins/aliases/README.md21
-rw-r--r--plugins/aliases/aliases.plugin.zsh9
3 files changed, 17 insertions, 14 deletions
diff --git a/plugins/aliases/.gitignore b/plugins/aliases/.gitignore
new file mode 100644
index 000000000..bee8a64b7
--- /dev/null
+++ b/plugins/aliases/.gitignore
@@ -0,0 +1 @@
+__pycache__
diff --git a/plugins/aliases/README.md b/plugins/aliases/README.md
index 481c1bd4e..bfb6ab8c4 100644
--- a/plugins/aliases/README.md
+++ b/plugins/aliases/README.md
@@ -1,21 +1,22 @@
-## Aliases Cheatsheet
+# Aliases cheatsheet
**Maintainer:** [@hqingyi](https://github.com/hqingyi)
With lots of 3rd-party amazing aliases installed, this plugin helps list the shortcuts
that are currently available based on the plugins you have enabled.
-Enable this plugin by adding it to your `plugins` definition in `~/.zshrc`.
+To use it, add `aliases` to the plugins array in your zshrc file:
- ```
- plugins=(aliases)
- ```
+```zsh
+plugins=(aliases)
+```
Requirements: Python needs to be installed.
-### Usage
+## Usage
-```
- acs: group all alias
- acs $keywordquickly filter alias & highlight
-```
+- `acs`: show all aliases by group.
+
+- `acs <keyword>`: filter aliases by `<keyword>` and highlight.
+
+ ![screenshot](https://cloud.githubusercontent.com/assets/3602957/11581913/cb54fb8a-9a82-11e5-846b-5a67f67ad9ad.png)
diff --git a/plugins/aliases/aliases.plugin.zsh b/plugins/aliases/aliases.plugin.zsh
index 28d8fba24..b3d9340f0 100644
--- a/plugins/aliases/aliases.plugin.zsh
+++ b/plugins/aliases/aliases.plugin.zsh
@@ -2,9 +2,10 @@
#
# - acs: alias cheatsheet
# group alias by command, pass addition argv to grep.
-ALIASES_PLUGIN_ROOT=$(cd `dirname $0` && pwd)
function acs(){
- which python >>/dev/null
- [[ $? -eq 1 ]] && echo "[error]no python executable detected!" && return
- alias | python $ALIASES_PLUGIN_ROOT/cheatsheet.py $@
+ (( $+commands[python] )) || {
+ echo "[error] No python executable detected"
+ return
+ }
+ alias | python ${functions_source[$0]:h}/cheatsheet.py $@
}