autojump icon indicating copy to clipboard operation
autojump copied to clipboard

autojump not working in Ubuntu

Open loveencounterflow opened this issue 9 years ago • 7 comments

I did sudo apt-get install autojump which installed v21.7.1; however, it does not pick up directories that i cd into, as I can verify with j -s. There's a remark in the readme that warns people to mess around with $PROMPT_COMMAND, and, in fact, i had

export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

in my .bashrc. I've since out-commented that line, restarted and re-installed autojump to no avail.

1)—could the cause of autojump not working be something else?

2)—the readme isn't very clear of what a working $PROMPT_COMMAND line would have too look like; is export PROMPT_COMMAND="history -a" meant as an example for how to do it or for how not to do it (disclosure: I tried and sourced, to no avail)

3)—the readme doesn't give away a clear diagnostic to ascertain whether $PROMPT_COMMAND is or is not the culprit; IOW: what value/text should that variable have/contain to make autojump work properly?

loveencounterflow avatar Nov 10 '15 20:11 loveencounterflow

Update I added source /usr/share/autojump/autojump.bash to my .bashrc as recommended by http://askubuntu.com/a/185996. Now the autojump DB does pick up directories as I visit them.

However, now when I do j xxx I do get a suggested target path printed out, but autojump leaves it at that and does not cd into that directory.

I think the current issue is still valid, so I leave it open.

loveencounterflow avatar Nov 10 '15 21:11 loveencounterflow

Hrm, I just looked in autojump.bash and it does an awful lot more than the docs indicated.

I use PROMPT_COMMAND for something else, but the docs said autojump needs it for things, so I was careful to add 'history -a' as the docs indicated I'd need to do; but, of course, it still didn't pick up new directories.

Source diving on autojump.bash indicated I really needed to simply source autojump after I add my PROMPT_COMMAND or add 'autojump_add_to_database' (not history -a).

jettero avatar Feb 09 '16 14:02 jettero

:+1: on ubuntu autojump does not cd, only prints the path

mgcrea avatar Feb 24 '16 15:02 mgcrea

Is this still an issue?

r-barnes avatar Jul 30 '18 19:07 r-barnes

I barely remember the discussion... (2016?). It's solved on my end. I couldn't say if it's a problem for others, but the trouble for me was that I overuse my PROMPT_COMMAND and I have to really carefully inject autojump manually or it won't work.

jettero avatar Aug 10 '18 14:08 jettero

I'm still facing this issue. It's just printing the current path and not actually cd-ing.

himat avatar Nov 26 '20 01:11 himat

I had an issue after installing autojump it was not working. My configuration was Ubuntu 20.4 with bash-it installed. What I did was I placed the ". /usr/share/autojump/autojump.sh" before "HISTCONTROL" is set in my .bashrc file. I sourced the .bashrc file and it worked like a charm.

arnchkv avatar Jul 02 '21 13:07 arnchkv