Autojump: 显示最常访问的目录但不运行`cd`

创建于 2013-06-10  ·  3评论  ·  资料来源: wting/autojump

通常, j something切换工作目录。 但这不是必须的。 在某些情况下,我们只需要将目录打印到标准输出。 例如

open `j --no-cd something`

这可以在 OS X 上为目标目录启动 Finder。

我不知道破解这个功能是否很难,但感谢任何方式的伟大工具!

最有用的评论

我更喜欢 fasd,我写这个是为了给我一个 :j 命令。 你可能会
使其适应自动跳转。

把它放在 .config/ranger/commands.py 中:

from ranger.api.commands import *
import subprocess

class j(Command):
    """:j

    Uses fasd to set the current directory.
    """

    def execute(self):
        directory = subprocess.check_output(["fasd", "-dl1", self.arg(1)])
        directory = directory.decode("utf-8", "ignore")
        directory = directory.rstrip('\n')
        self.fm.execute_console("cd " + directory)

所有3条评论

jo <dir>打开操作系统特定的文件浏览器。

autojump <dir>打印第一个匹配项。 如果没有传递任何参数,自动跳转会打印最常用的目录。

如果您需要更多信息,请使用autojump --stats和 awk / sed / tr / 等的任意组合。

我更喜欢 fasd,我写这个是为了给我一个 :j 命令。 你可能会
使其适应自动跳转。

把它放在 .config/ranger/commands.py 中:

from ranger.api.commands import *
import subprocess

class j(Command):
    """:j

    Uses fasd to set the current directory.
    """

    def execute(self):
        directory = subprocess.check_output(["fasd", "-dl1", self.arg(1)])
        directory = directory.decode("utf-8", "ignore")
        directory = directory.rstrip('\n')
        self.fm.execute_console("cd " + directory)
此页面是否有帮助?
0 / 5 - 0 等级