Autojump: 使用 Homebrew 安装后,要在 macOS 上使用什么资源?

创建于 2017-11-27  ·  13评论  ·  资料来源: wting/autojump

我无法让它工作。

始终收到此消息:

Please source the correct autojump file in your shell's
startup file. For more information, please reinstall autojump
and read the post installation instructions.

感谢您的任何帮助。

最有用的评论

您可以使用命令再次看到警告

brew info autojump

它会给你输出

autojump: stable 22.5.1 (bottled), HEAD
Shell extension to jump to frequently used directories
https://github.com/wting/autojump
/usr/local/Cellar/autojump/22.5.1 (24 files, 253.9KB) *
  Poured from bottle on 2017-11-28 at 13:37:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/autojump.rb
==> Caveats
Add the following line to your ~/.bash_profile or ~/.zshrc file (and remember
to source the file to update your current session):
  [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

If you use the Fish shell then add the following line to your ~/.config/fish/config.fish:
  [ -f /usr/local/share/autojump/autojump.fish ]; and source /usr/local/share/autojump/autojump.fish

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

所有13条评论

您是否尝试过“阅读安装后说明”的部分?

https://github.com/wting/autojump#installation

我有。 对于 macOS,它只说brew install它就是这样。

并且 brew install 会在安装后向您显示说明。 它的存在是有原因的。

https://github.com/Homebrew/homebrew-core/blob/b6b9f36c8744c2259b74f12850163c676ae49396/Formula/autojump.rb#L27 -L35

您可以使用命令再次看到警告

brew info autojump

它会给你输出

autojump: stable 22.5.1 (bottled), HEAD
Shell extension to jump to frequently used directories
https://github.com/wting/autojump
/usr/local/Cellar/autojump/22.5.1 (24 files, 253.9KB) *
  Poured from bottle on 2017-11-28 at 13:37:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/autojump.rb
==> Caveats
Add the following line to your ~/.bash_profile or ~/.zshrc file (and remember
to source the file to update your current session):
  [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

If you use the Fish shell then add the following line to your ~/.config/fish/config.fish:
  [ -f /usr/local/share/autojump/autojump.fish ]; and source /usr/local/share/autojump/autojump.fish

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

即使在添加[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh并获取文件之后仍然对我不起作用。

我做了j <dirname>并留在我当前的目录中,而不是更改目录。

您必须先cd <dirname> ,下次您调用j <dirname>跳转会为您记住它

啊,明白了,我误解了目的,所以自动跳转更多的是记住你去过哪里,这样你就可以快速回到那里,而不是从你当前的位置找到一个嵌套很深的子目录?

是的,从 README.md 中引用

它通过维护您从命令行最常使用的目录的数据库来工作。

_必须先访问目录才能跳转到。_

我也遇到了这个问题。
通过 Homebrew 安装后,我将其添加到我的 .bash_profile 中:
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
我还确保添加:
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -a"

进入几个目录后, j -s没有条目。 我必须在当前会话中手动运行 .bash_profile 行。 这是我的 .bash_profile 的配置问题吗?

与@helenes-r7 有同样的问题

通过 Homebrew 安装后,我将其添加到我的 .bash_profile 中:
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

cd 到几个目录后, j -s 没有条目。

是的,我做了source ~/.bash_profile来重新加载会话

@helenes-r7 @l-gothberg 您可以在此处阅读有关该问题的信息https://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically

感谢@bendem@aphe加入。

Autojump 是独一无二的,因为它需要安装后设置,因为每个用户都使用不同的 shell 和可能定制的设置,并且某些包分发不允许安装后配置(例如 Debian)。

我计划改进 #323 中的安装后步骤,因此请在此处重定向反馈。

在自述文件中有这个会很棒:

[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

我没有阅读安装后的说明(抱歉!),我只是认为它可以开箱即用。
也许这也可以添加到“阅读安装后说明”旁边/而不是“阅读安装后说明”

此页面是否有帮助?
0 / 5 - 0 等级