wting / autojump

A cd command that learns - easily navigate directories from the command line
Other
16.3k stars 706 forks source link

autojump not working for my macOS Sierra #473

Open r0c opened 7 years ago

r0c commented 7 years ago

I have tried to install autojump via homebrew and manual steps, both not working. There are no errors reported during the installation stage, but no double-underscore are shown after I press tab twice.

Hope the following info can help the debugging.

shell version:

➜  ~ zsh --version
zsh --version
zsh 5.2 (x86_64-apple-darwin16.0)

autojump version:

➜  ~ j -v
autojump v22.5.1

where is autojump installed:

➜  ~ tail -n 1 ~/.zshrc
[[ -s /Users/enzow/.autojump/etc/profile.d/autojump.sh ]] && source /Users/enzow/.autojump/etc/profile.d/autojump.sh

what's the definition of j

➜  ~ which j
which j
j () {
    if [[ ${1} = -* ]] && [[ ${1} != "--" ]]
    then
        autojump ${@}
        return
    fi
    setopt localoptions noautonamedirs
    local output="$(autojump ${@})"
    if [[ -d "${output}" ]]
    then
        if [ -t 1 ]
        then
            echo -e "\\033[31m${output}\\033[0m"
        else
            echo -e "${output}"
        fi
        cd "${output}"
    else
        echo "autojump: directory '${@}' not found"
        echo "\n${output}\n"
        echo "Try \`autojump --help\` for more information."
        false
    fi
}

Please let me know if any info are missing here.

tennysondy commented 7 years ago

meet the same problem

fntneves commented 7 years ago

I'm experiencing the same issue

lararosekelley commented 7 years ago

Same issue for me, using Bash 4 on macOS 10.12. Autojump version is 22.5.1. My .bashrc is set up according to the recommendations and there were no installation issues. Whenever I change to another directory, it's not added to the autojump.txt file.

screen shot 2017-06-20 at 12 06 34 am

bendem commented 7 years ago

I have it working just fine so this has to be something specific to your environment. Make sure your user has the right to write to ~/Library/autojump/autojump.txt.

lararosekelley commented 7 years ago

Turns out the issue was with my PROMPT_COMMAND being set to something else; should have thought of this but I'd installed autojump well after setting my prompt command. I wonder if it'd be beneficial to not only have this warning in the manpage but also in the post-install text when installing via Homebrew?

bendem commented 7 years ago

That problem is specified in the man already (under Known issues). You could probably propose a pull request to homebrew (the file to change is https://github.com/Homebrew/homebrew-core/blob/b211145/Formula/autojump.rb#L26)

alexyalunin commented 2 years ago

This helped me https://github.com/wting/autojump/issues/511#issuecomment-362142038:

You have to cd <dirname> first than autojump will remember it for you the next time you call j <dirname>