可以在zsh中使用Bash制表符完成脚本吗? [英] Can a Bash tab-completion script be used in zsh?

查看:100
本文介绍了可以在zsh中使用Bash制表符完成脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于Apache Hadoop的Bash制表符补全脚本.通常,我将zsh用作日常外壳.当我需要它时,它往往看上去很像bash,但是看起来它们之间的制表符完成系统根本不同.有没有一种简单的方法可以转换"现有的bash-tab-completion定义以使其在zsh中工作?我不想为此花很多时间,但是如果简单的话,我会省下很多精力.

I have a Bash tab-completion script for Apache's Hadoop. Normally, I use zsh as my day-to-day shell. It tends to be pretty bash-like when I need it to be, but it looks like the tab-completion systems are radically different between them. Is there a simple way to "convert" the existing bash-tab-completion definitions to work in zsh? I don't want to invest a ton of time in this, but if it's easy I'd save a moderate amount of effort.

推荐答案

来自此页面(日期为2010/01/05):

From this page (dated 2010/01/05):

Zsh可以处理bash补全功能. zsh的最新开发版本具有bashcompinit函数,该函数在运行时将允许zsh读取bash完成规范和函数.这在zshcompsys手册页中进行了介绍.要使用它,您需要做的就是在compinit之后的任何时间运行bashcompinit.它将定义与bash内置程序相对应的complete和compgen函数.

Zsh can handle bash completions functions. The latest development version of zsh has a function bashcompinit, that when run will allow zsh to read bash completion specifications and functions. This is documented in the zshcompsys man page. To use it all you need to do is run bashcompinit at any time after compinit. It will define complete and compgen functions corresponding to the bash builtins.

这篇关于可以在zsh中使用Bash制表符完成脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆