小编Jus*_*n C的帖子

如何结合 zsh 自动完成包装函数参数和现有命令

我主要在 gvim 和许多终端上工作。最初,我更喜欢在单个 vim 实例中打开所有文件。为此,我使用别名从当前“vim 服务器”中的终端打开文件。

alias rv="gvim --remote-silent"
Run Code Online (Sandbox Code Playgroud)

但是在单个 vim 实例中打开来自多个项目的许多文件会影响我的工作效率,因此我将别名升级为一个函数。

# main function
rv() {
    local args options server

    options=$(getopt -o hils:t: -l "help,info,list,set:,target:" -- "$@")

    if [[ $? -ne 0 ]]; then
        echo "Failed to parse options."
        return 1
    fi

    # a little magic, necessary when using getopt
    eval set -- "$options"

    # go through the options with a case and use shift to analyze one option at a time.
    while true; do
        case "$1" in
            -h|--help) …
Run Code Online (Sandbox Code Playgroud)

zsh autocomplete

40
推荐指数
1
解决办法
3040
查看次数

标签 统计

autocomplete ×1

zsh ×1