无法在 Bash/Zsh 中找到 Rubygem 的制表符补全
我没有在 Bash/Zsh 中找到 RubyGem 的制表符补全脚本。
哪里可以获取 Bahs/Zsh 中 RubyGem 的制表符补全脚本?
I have not found a tab-completion script for RubyGem in Bash/Zsh.
Where can you get the tab-completion script for RubyGem in Bahs/Zsh?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
可执行的 RubyGem 命令安装到 /usr/bin 或 /usr/local/bin 或 Ruby 所在的任何前缀中。 命令的制表符补全应该像 PATH 中的任何其他可执行文件一样工作。 如果它不起作用,请验证 RubyGems 安装命令的目录是否在您的 PATH 中。
目前还没有官方方法可以对这些命令的参数进行制表符补全。 如果您需要通过 RubyGems 安装的命令使用制表符补全,则需要自己编写和/或安装它。 有关详细信息,请参阅 Bash 参考手册。 您感兴趣的特定命令可能已经有一个完成系统,因此请务必通过 google 搜索它,但通过 RubyGems 安装的大多数命令都没有为其编写的任何自动完成功能。
Executable RubyGem commands are installed into /usr/bin or /usr/local/bin or whatever prefix Ruby is found under. Tab completion for commands should just work just like any other executable file in your PATH. If it's not working, verify that the directory RubyGems installs commands into is in your PATH.
There is currently no official method of doing tab completion for the parameters to any of these commands. If you need tab completion for a command installed via RubyGems, you'll need to write and/or install it yourself. See the Bash reference manual for details. There may already be a completion system for the specific command you're interested in, so be sure to google for it, but most commands installed via RubyGems do not have any auto-complete written for them.
尝试:
http://github.com/oggy/ruby-bash-completion
要安装它,只需将 gem 文件复制到 /etc/bash_completion.d/
我在尝试选项卡时遇到错误:
因为我在 .gem 目录中没有一些缓存文件。 所以我只是通过编辑gem文件来禁用它。 我更改了 _gem_all_names 函数:
Try:
http://github.com/oggy/ruby-bash-completion
To install it just copy gem file to /etc/bash_completion.d/
I had errors when trying to tab:
Because I didn't have some cache files in .gem directory. So I simply disabled it by editing gem file. I changed _gem_all_names function:
github 托管的 bash 补全现在是 Ubuntu Lucid Lynx 的一部分。 甜的! 如果您
apt-get install rubygems1.8
,那么补全(命令和选项!)应该可以正常工作。不幸的是,安装后,只有看到调用
gem1.8
,而不是更方便的gem
,它才会完成。 如果愿意,您可以手动修复此问题,方法是扩展/etc/bash_completion.d/gem1.8
的最后一行以将gem
包含为complete< 的一部分/code> 名单。 我确信有一种更干净的方法,但确实有效。
That github-hosted bash completion is now part of Ubuntu Lucid Lynx. Sweet! If you
apt-get install rubygems1.8
then the completion (commands and options!) should just work.Unfortunately, as installed, it will only complete if it sees invocation of
gem1.8
, and not the more conventientgem
. You can fix that manually if so inclined by extending the last line of/etc/bash_completion.d/gem1.8
to includegem
as part of thecomplete
name list. I'm sure there's a cleaner way, but that works.这已经晚了(几年)了,但是由于我对似乎在网上流传的各种 gem 完成脚本非常不满意,我决定编写自己的(在某种程度上)基于相当不错的脚本。
git-sh
中提供了git
完成脚本。https://github.com/pdkl95/rubygems-completion
This is (years) late, but as I was highly unsatisfied with the various completion scripts for
gem
that seem to be floating around the net, I decided to write my own based (somewhat) on the rather nicegit
completion script available ingit-sh
.https://github.com/pdkl95/rubygems-completion