为Mercurial启用bash选项卡完成(hg)

Vin*_*eib 8 bash ubuntu mercurial tab-completion

我在ubuntu上安装了Mercurial(1.4.3-1),默认情况下它没有在bash中完成tab.启用此功能的最简单方法是什么?

Mar*_*ler 13

你需要

  • 为Mercurial安装最新的软件包,请参阅Mercurial PPA.这将为您提供一个/etc/bash_completion.d/mercurial包含Mercurial完成代码的文件.您可以直接获取此文件以启用Mercurial的完成支持.

您还可以为所有程序启用完成支持:

  • 安装bash-completion包:aptitude install bash-completion.

  • /etc/bash_completion~/.bashrc 文件中的来源:

    # Use bash-completion, if available
    if [ -f /etc/bash_completion ]; then
      . /etc/bash_completion
    fi
    
    Run Code Online (Sandbox Code Playgroud)

    这将启用所有命令的完成,包括Mercurial.


sam*_*tav 5

curl https://www.mercurial-scm.org/repo/hg/raw-file/tip/contrib/bash_completion -o ~/.hg-completion.bash && source ~/.hg-completion.bash
Run Code Online (Sandbox Code Playgroud)

Mercurial 自动完成脚本似乎保存在此处:

https://www.mercurial-scm.org/repo/hg/file/tip/contrib/bash_completion

source这个脚本在你的.bashrc或同等的


Tro*_*ydm 0

在您的 Linux 中安装bash-completion软件包(取决于您使用的 Linux 发行版)。

然后/etc/bash_completion.d/创建一个名为 的文件hg ,并将该脚本的内容(如下)放入创建的hg文件中。

http://fts.ifac.cnr.it/cgi-bin/dwww/usr/share/doc/bash/completion-contrib/hg

  • 不幸的是,上面的链接似乎不再起作用 - 结果是 403。 (2认同)