我应该如何在zsh中使用argcomplete? [英] How should I use argcomplete in zsh?
问题描述
我正在使用 argcomplete
在Bash中完成 Tab
argcomplete
为bash
提供全局补全,但不为zsh
提供全局补全.
argcomplete
offers global completion for bash
, but doesn't for zsh
.
我想创建一个文件~/.zsh_completion
,以包含要完成的文件.如果该文件来自~/.zshrc
,则应为这些文件生成自动补全.
I would like to create a file ~/.zsh_completion
, to contain the to be completed files. This file should generate autocompletion for those files when it's sourced from ~/.zshrc
.
我该怎么做?
推荐答案
好的,有一种方法可以实现,但这并不是我真正想要的.
Alright there is a way to do it, but it's not the way I really wanted it to be.
无论如何,这里去:
-
安装
argcomplete
:
$ pip install argcomplete
激活argcompolete
:
$ activate-global-python-argcomplete --user
将此添加到~/.zshrc
:
autoload bashcompinit
bashcompinit
source ~/.bash_completion.d/python-argcomplete.sh
eval "$(register-python-argcomplete /path/to/the/to/be/completed/file1)"
eval "$(register-python-argcomplete /path/to/the/to/be/completed/file2)"
eval "$(register-python-argcomplete /path/to/the/to/be/completed/file3)"
可能存在一种从另一个文件中读取待完成文件的解决方案,但我不知道该怎么做.
There's probably a solution to read out the to be completed files from another file, but I don't know how to do that.
这篇关于我应该如何在zsh中使用argcomplete?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!