You are not logged in.
One of the finest, handiest tools I have discovered in the last few months. It's simple but extremely useful. Thanks a lot!
Offline
I haven't tried this yet, but does someone know, in the new bash 4.0, there is the feature to do something with failed commands, if you can use that for autojump?
E.g.
You set `command_not_found()` to autojump (not really sure what the function is called)
Although it would probably be
function command_not_found() { j $1; }
You type 'd' (which fails)
Bash runs `autojump d`
Offline
I haven't tried this yet, but does someone know, in the new bash 4.0, there is the feature to do something with failed commands, if you can use that for autojump?
E.g.
You set `command_not_found()` to autojump (not really sure what the function is called)
Although it would probably be
function command_not_found() { j $1; }You type 'd' (which fails)
Bash runs `autojump d`
I'm not sure I understand your comment. Are sure you understand what autojump is?
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
Procyon wrote:I haven't tried this yet, but does someone know, in the new bash 4.0, there is the feature to do something with failed commands, if you can use that for autojump?
E.g.
You set `command_not_found()` to autojump (not really sure what the function is called)
Although it would probably be
function command_not_found() { j $1; }You type 'd' (which fails)
Bash runs `autojump d`
I'm not sure I understand your comment. Are sure you understand what autojump is?
He basically wants to use autojump without the "j" in front of the directory. If he types the name of a directory without the "j" in front of it, bash usually reports "command not found". By remapping this "command not found" function(?) to do "j <directory>", it'd be possible to jump to a directory without putting "j" in front of it.
Tbh, this doesn't seem like a practical solution to me. What if you want to browse, say, packages in /var/lib/pacman? Since the command to execute a package is very often the same as its name, you might get yourself into trouble. It probably won't work with spaces either, but that shouldn't be a big deal.
Offline
Thanks for explaining! Sounds like a cool idea, but I'm not sure how well it would work in practice. I'm not sure I would appreciate being brought to a random place when I mistype a command
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
I added the following to my .bashrc . I think this makes it a better drop-in for cd since I can still use "cd -" and cd to relative paths. Also I like that it uses the normal tab-completion for cd.
better_cd(){
builtin cd "$@" 2> /dev/null && return 0
# fallback to autojump if cd fails
new_path="$(autojump $@)"
if [ -n "$new_path" ]
then builtin cd "$new_path"
else echo cannot cd to "$@"
fi
}
alias cd="better_cd"
PS- anybody know a good way to do something like "if not builtin cd foo" in bash without spawing a subshell (which defeats the point of cd)?
Offline
Wow!!! This utility is really amazing. Thank you very much, lardon. This improves a lot my bash experience.
Keep up the good work !!!
Offline
I tried disintstalling it but something must have gone incomplete. It is like if it tried to execute autojump every time I press the enter button:
[dandus@democrito ~]$
bash: autojump: command not found
[dandus@democrito ~]$
Any ideas?
Last edited by dandus (2009-03-29 20:13:42)
Offline
you need to unset the PROMPT_COMMAND environment variable. Thanks for the report, we probably need to do something about it.
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
Thankyou! How do I do that in a permanent manner? I would add
unset PROMPT_COMMAND
to my .bashrc, but I believe there is a way involving good programming too for doing it.
Offline
Normaly, the problem should go away if you reboot, or at least log out and log in again. If this is not the case, can you give me the output of
1) cat ~/.bashrc
2) ls /etc/profile.d
?
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
does it work on zsh ?
Offline
How do I completely uninstall? I keep getting various messages (or, the same, but it varies as I remove different pieces) in the terminal every single time I press enter.
Could you be more specific on the error messages? Did you install using the official arch package? This is clearly an area we have to work on, but it's difficult to advance without clear descriptions of the problems.
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
does it work on zsh ?
I'm working on a port, it should be available in a few days. I will keep you updated
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
Nevermind, I solved that. Rebooting was just enough, I didn't notice because I added "unset PROMT_COMMAND" to my ~/.bashrc
Thankyou very much for your help.
Last edited by dandus (2009-03-31 18:52:34)
Offline
looks similar to cdargs (http://debaday.debian.net/2009/04/05/cd … er-for-cd/)
Too bad the users prompt command gets overridden. I would like to keep my personal one. Maybe there is a cleaner way to "append" logic to the prompt command instead of overriding.
eg instead of:
export PROMPT_COMMAND='autojump -a "$(pwd -P)"'
Something like:
if [[ $foo != *'autojump -a'* ]]
then
[ -n "$PROMPT_COMMAND" ] && export PROMPT_COMMAND="$PROMPT_COMMAND ; autojump -a \"$(pwd -P)\""
[ -z "$PROMPT_COMMAND" ] && export PROMPT_COMMAND='autojump -a "$(pwd -P)"'
fi
Also I don't understand why you must source /etc/profile from your .bashrc.
As far as I know /etc/profile contains all base settings and gets sourced on each login, and customisations on top of that get sourced through .bashrc and .bash_profile files in $HOME. So I think re-sourcing the global /etc/profile is against "how it should work" and could even reset specific customisations a user wants.
Last edited by Dieter@be (2009-04-05 11:21:28)
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
looks similar to cdargs (http://debaday.debian.net/2009/04/05/cd … er-for-cd/)
Too bad the users prompt command gets overridden. I would like to keep my personal one. Maybe there is a cleaner way to "append" logic to the prompt command instead of overriding.
eg instead of:export PROMPT_COMMAND='autojump -a "$(pwd -P)"'
Something like:
if [[ $foo != *'autojump -a'* ]] then [ -n "$PROMPT_COMMAND" ] && export PROMPT_COMMAND="$PROMPT_COMMAND ; autojump -a \"$(pwd -P)\"" [ -z "$PROMPT_COMMAND" ] && export PROMPT_COMMAND='autojump -a "$(pwd -P)"' fi
Also I don't understand why you must source /etc/profile from your .bashrc.
As far as I know /etc/profile contains all base settings and gets sourced on each login, and customisations on top of that get sourced through .bashrc and .bash_profile files in $HOME. So I think re-sourcing the global /etc/profile is against "how it should work" and could even reset specific customisations a user wants.
I just saw your message, and I'd just like to say that the latest version (it's not been packaged for arch yet) doesn't override the prompt command anymore.
About /etc/profile, i don't think it gets sourced by default on arch, because otherwise autojump would work without re-sourcing it, right? But I don't really know how to check that.
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
About /etc/profile, i don't think it gets sourced by default on arch, because otherwise autojump would work without re-sourcing it, right? But I don't really know how to check that.
Ah sorry, I keep forgetting there are people who do not login through bash but use graphical login managers.
The logic I explained only counts for login shells.
here is an interesting read: http://www.linuxquestions.org/questions … rc-273992/
I think you should use /etc/bashrc instead of /etc/profile , and source /etc/bashrc from the users .bashrc.
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
Hey! It looks really nice! i tried it out in bash but what happened with the zsh version? i didn't understand how to use Vyazovoi version:/
Offline
Hey! It looks really nice! i tried it out in bash but what happened with the zsh version? i didn't understand how to use Vyazovoi version:/
No need to use Vyazovoi's version, there is good zsh support in the mainstream code. Just use the zsh installer provided with the code (unfortunately the arch package is very outdated because the maintainer doesn't seem to be active anymore).
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
Woho thanks a lot! Didn't look in the git, works great know:)
Offline
this just saved me a buttload of aliassing, thanks!
Last edited by stefanwilkens (2009-05-26 19:25:14)
Arch i686 on Phenom X4 | GTX760
Offline
looks similar to cdargs (http://debaday.debian.net/2009/04/05/cd … er-for-cd/)
Too bad the users prompt command gets overridden. I would like to keep my personal one. Maybe there is a cleaner way to "append" logic to the prompt command instead of overriding.
For me it was enough to put
source /etc/profile
at top of my .bashrc, this fixed the prompt handling.
I have a question though: When I jump into a folder and type ls, this folder gets 3 point added each time I use ls.
Is this a feature?
If so, is there a way to turn it off?
For me autojump would be much nicer if it really counts how often I "cd" into a folder, not how active I am in it.
Nevertheless, great little program
Last edited by TheGrudge (2009-07-18 08:42:32)
digiKam developer - www.digikam.org
Offline
I have a question though: When I jump into a folder and type ls, this folder gets 3 point added each time I use ls.
Is this a feature?
If so, is there a way to turn it off?
For me autojump would be much nicer if it really counts how often I "cd" into a folder, not how active I am in it.Nevertheless, great little program
It should add only one point each time you use ls... Can you post your PROMPT_COMMAND?
Anyways, adding each time you do something in a directory is a feature, or at least a design decision. When creating autojump, I tried both options and liked the current one best. Of course, your experience may differ, and you may want to change it. One way you could do it is to get rid of the PROMPT_COMMAND entirely, and rebind the cd builtin to add the directory to autojump. Shouldn't be too hard
Autojump, the fastest way to navigate your filesystem from the command line!
Offline
This tool is amazing, sweet etc., I didn't even realize how miserable I was without it.
In fact, if I had known how inefficient cd-ing really was (which I couldn't have known, since I haven't had used j back then), I would do something drastic. Fortunately, this is not Terminator 3 and I'm not my own son sent to the past by my father to have a kid with my mother (or something like that), and the knowledge of inefficiency of cd came _after_ using j for the first time, I'm not angry at myself at all.
Anyway it is a must-have for any Archer! Why not include it in here?
This is my signature. If you want to read it, first you need to agree to the EULA.
Offline