diff options
Diffstat (limited to 'plugins/python')
| -rw-r--r-- | plugins/python/README.md | 16 | ||||
| -rw-r--r-- | plugins/python/_python | 54 | ||||
| -rw-r--r-- | plugins/python/python.plugin.zsh | 3 | 
3 files changed, 18 insertions, 55 deletions
| diff --git a/plugins/python/README.md b/plugins/python/README.md new file mode 100644 index 000000000..2d955c5cb --- /dev/null +++ b/plugins/python/README.md @@ -0,0 +1,16 @@ +# python plugin + +The plugin adds several aliases for useful [python](https://www.python.org/) commands. + +To use it, add `python` to the plugins array of your zshrc file: +``` +plugins=(... python) +``` + +## Aliases + +| Command          | Description                                                                     | +|------------------|---------------------------------------------------------------------------------| +| `pyfind`         | Finds .py files recursively in the current directory                            | +| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one | +| `pygrep <text>`  | Looks for `text` in .py files                                                   | diff --git a/plugins/python/_python b/plugins/python/_python deleted file mode 100644 index f517d4806..000000000 --- a/plugins/python/_python +++ /dev/null @@ -1,54 +0,0 @@ -#compdef python - -# Python 2.6 -# Python 3.0 - -local curcontext="$curcontext" state line expl -typeset -A opt_args - -local -a args - -if _pick_variant python3=Python\ 3 python2 --version; then -  args=( -    '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' -    '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' -  ) -else -  args=( -    '-Q+[division options]:division option:(old warn warnall new)' -    '(-tt)-t[issue warnings about inconsistent tab usage]' -    '(-t)-tt[issue errors about inconsistent tab usage]' -    '-3[warn about Python 3.x incompatibilities]' -  ) -fi - -_arguments -C -s -S "$args[@]" \ -  "-B[don't write .py\[co\] files on import]" \ -  '(1 -)-c+[program passed in as string (terminates option list)]:python command:' \ -  '-d[debug output from parser]' \ -  '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \ -  '(1 * -)-h[display help information]' \ -  '-i[inspect interactively after running script]' \ -  '(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \ -  '-O[optimize generated bytecode slightly]' \ -  '-OO[remove doc-strings in addition to the -O optimizations]' \ -  "-s[don't add user site directory to sys.path]" \ -  "-S[don't imply 'import site' on initialization]" \ -  '-u[unbuffered binary stdout and stderr]' \ -  '-v[verbose (trace import statements)]' \ -  '(1 * -)'{-V,--version}'[display version information]' \ -  '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \ -  '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \ -  '(-)1:script file:_files -g "*.py(|c|o)(-.)"' \ -  '*::script argument: _normal' && return - -if [[ "$state" = modules ]]; then -  local -a modules -  modules=( -    ${${=${(f)"$(_call_program modules $words[1] -c \ -      'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)} -  ) -  _wanted modules expl module compadd -a modules && return -fi - -return 1 diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index a10c06fd3..f754ea261 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -1,12 +1,13 @@  # Find python file  alias pyfind='find . -name "*.py"' -# Remove python compiled byte-code in either current directory or in a +# Remove python compiled byte-code and mypy cache in either current directory or in a  # list of specified directories  function pyclean() {      ZSH_PYCLEAN_PLACES=${*:-'.'}      find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete      find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete +    find ${ZSH_PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete  }  # Grep among .py files | 
