ddf673b36dd43e5ca60189a117c25ad6f55457e7
- Author
- MikuHatsune39 <32179075+MikuHatsune39@users.noreply.github.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
fix(python): set `py` alias if `py` is not installed (#12059)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diff
1diff --git a/plugins/python/README.md b/plugins/python/README.md
2index 97c1a34ee66e97c5e04d925bd618196523f5813d..7bf1b34acc3ab174109b19b69a597d579ef771ee 100644
3--- a/plugins/python/README.md
4+++ b/plugins/python/README.md
5@@ -12,7 +12,7 @@ plugins=(... python)
6
7 | Command | Description |
8 | ---------------- | -------------------------------------------------------------------------------------- |
9-| `py` | Runs `python3` |
10+| `py` | Runs `python3`. Only set if `py` is not installed. |
11 | `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
12 | `pyfind` | Finds .py files recursively in the current directory |
13 | `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
14diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
15index 2fbb59577409caa7c89b8b68ced6d2243c0fa08d..3d7ca55c94ae319a8ecfd150eac8377172ccb4f8 100644
16--- a/plugins/python/python.plugin.zsh
17+++ b/plugins/python/python.plugin.zsh
18@@ -1,5 +1,5 @@
19-# python command
20-alias py='python3'
21+# set python command if 'py' not installed
22+builtin which py > /dev/null || alias py='python3'
23
24 # Find python file
25 alias pyfind='find . -name "*.py"'