wting / autojump Goto Github PK
View Code? Open in Web Editor NEWA cd command that learns - easily navigate directories from the command line
License: Other
A cd command that learns - easily navigate directories from the command line
License: Other
Only 3 files are listed in the uninstallation paragraph in README. It seems that the install script install more files.
Could you update README file ?
Hey,
I think it would be cool to write up an autojump installation script with homebrew, which a ton of people use to manage their macs, but this would require the ability to set the PREFIX= of autojump, so that it could be installed in a different location and symlinked to /usr/local/bin.
Would this be tricky to pull off? I could help out if necessary.
Thanks for the awesome work - I've been dying for something like this for a while.
Install script does not seem to go through all necessary steps in order to install autojump on OS X.
Problem is that .bashrc is not called when user starts Terminal.app. There is a really easy fix for it thou.
Add following lines into .bash_profile:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Hello,
I’ve update to the last version. But no more auto-completion scroll autojump
If I do a « j to » [enter] I jump to « toto », the first completion argument but
« j to » [tab] [tab] to cycle through diffrents possibilities, whatever I choose, I stay in the same directory.
zsh 4.3.10 from ubuntu lucid x64
Thank’s a lot for autojump.
Hi,
I heard of autojump from a friend, and it's a great software.
Now, I'm also ssh'ing into lots of remote systems, and I wonder if it would be doable to learn from those remote directories, with a per-host database ?
I'm not asking you to implement it, but rather if you think it's technically possible. If yes, do you have some hints like where I should look to make it?
Cheers
After mounting an FTP folder using Finder and cd'ing around in it, my autojump database appears to be corrupted. It keeps giving me the following error message.
$ cd
epall@Beast:~
$ Traceback (most recent call last):
File "/usr/bin/autojump", line 102, in <module>
path_dict=open_dic(dic_file)
File "/usr/bin/autojump", line 84, in open_dic
path_dict=cPickle.load(aj_file)
cPickle.UnpicklingError: invalid load key, '?'.
Hello
I use the following setting in /etc/fstab
/var/www /home/othree/www none bind 0 0
So I have a ~/www directory actually link to /var/www
But If I use this path.
cd ~/www
Database will not add this record.
Instead of the ~/www. It adds weight to "." .
Enviroment: Ubuntu 10.04 32bit
since I installed Lion on my mac I get this error if i start my terminal:
-bash: PROMPT_COMMAND: line 4: syntax error near unexpected token ;' -bash: PROMPT_COMMAND: line 4:
update_terminal_cwd; ; { [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/autojump_errors;} 2>/dev/null'
Once upon a time this worked. Then many months ago it stopped, but I didn't look into it. I probably changed related things but have since forgotten. Today I tried installing and this happens... please advise:
philip@water /tmp/autojump> ./install.sh
Installing to /usr ...
Your distribution does not have a /etc/profile.d directory, the default that we install one of the scripts to. Would you like us to copy it into your ~/.bashrc file to make it work? (If you have done this once before, delete the old version before doing it again.) [y/n]
y
You are using OSX and your .bash_profile doesn't seem to be sourcing .bashrc
Adding source ~/.bashrc to your bashrc
You need to source your ~/.bashrc (source ~/.bashrc) before you can start using autojump.
philip@water /tmp/autojump> source ~/.bashrc
philip@water /tmp/autojump> j foo
Traceback (most recent call last):
File "/usr/bin/autojump", line 236, in <module>
success=shell_utility()
File "/usr/bin/autojump", line 157, in shell_utility
path_dict = open_dic(dic_file)
File "/usr/bin/autojump", line 132, in open_dic
path_dict = pickle.load(aj_file)
TypeError: __import__() argument 1 must be string without null bytes, not str
philip@water /tmp/autojump> python --version
Python 2.6.1
I've attached a self-explainitory patch:
http://codepad.org/kwUYTUgU
Auto jump fails with either + or * in the dirspec (maybe others, I didn't test very thoroughly).
|laurie|¥ mkdir C++
|laurie|¥ cd C++
|C++|¥ cd ..
|laurie|¥ autojump C++
Traceback (most recent call last):
File "/usr/bin/autojump", line 146, in
find_matches(dirs,pattern,path_dict,results,re_flags=0,max_matches=9)
File "/usr/bin/autojump", line 81, in find_matches
if match(path,pattern,path_dict,re_flags):
File "/usr/bin/autojump", line 44, in match
if re.search(pattern,"/".join(path.split('/')[-1-pattern.count('/'):]),re_flags) is None:
File "/usr/lib/python2.6/re.py", line 142, in search
return _compile(pattern, flags).search(string)
File "/usr/lib/python2.6/re.py", line 245, in _compile
raise error, v # invalid expression
sre_constants.error: multiple repeat
From looking at the error message, maybe the dirspec needs some parsing and have any odd characters delimited?
Hi,
first, thanks for this wonderful utility. It saves me so many keystrokes.
This is more of a feature request, than a real issue. Is it possible to get autojump to store the symlinks, instead of the full path? For example, I have ~/zyz
which is a symlink to /proj/lab/abstract/zyz
. j zyz
gets me to /proj/lab/abstract/zyz
, and that is correct. However, since I have a zsh prompt which displays current directory, it gets hogged with /proj....zyz
instead of a simple ~/zyz
.
Also, jumpstat
gives me a list of the absolute path, which is ok, but I would really prefer to have some paths relative to my home directory (those which are symlinks).
Thanks,
Nikola
It would be great if autojump respond to "--version" argument and show the installed version.
autojump has been working fine for me, for a while.
I had originally installed it manually, on Mac OS X Snow Leopard, with zsh.
Somewhere between cleaning up my .zshrc (with the autojump setup lines in it), and removing autojump and installing via Homebrew
, I got errors like this when using j
and jumpstat
:
Traceback (most recent call last):
File "/usr/local/bin/autojump", line 131, in <module>
path_dict=open_dic(dic_file)
File "/usr/local/bin/autojump", line 109, in open_dic
path_dict=cPickle.load(aj_file)
TypeError: ('argument list must be a tuple', 0.23222531790590067, 'erence/CVqTG?\xcd\xb9\x8f(\xda\xc2\nU-/Users/Chris/Documents/')
I don't know what happened. What may be useful for others is that I removed ~/.local/share/autojump/autojump_py
, and now the commands work (and still know my cd
history).
Perhaps this is useful for others.
I've tried to use jumpapplet under both gnome3 (gnome-shell) and ldxe but in each case I don't see an icon appear anywhere.
$ jumpapplet
loading settings
no config file
<>
I haven't really looked into it, but it only seems to only hold a limited number of my cd commands in it's database -- based on how often i cd into one of my directories i would have expected it to be in the jumpstat, but it doesn't ever seem to get added:
jumpstat
1.0: /home/izaak/workspace/fmas-git/fmas/fmas/target
1.0: /home/izaak/bin
2.0: /home/izaak/bin/autojump
3.0: /home/izaak/downloads/joelthelion-autojump-51ae7c92935e24427929b8a5042d2925ea959d3a
3.0: /home/izaak/bin/apache-tomcat-6.0.16
4.0: /home/izaak/workspace/fmas-git/fmas/fmas/scripts
5.0: /home/izaak/workspace/fmas-git/fmas/fmas/target/warStagingArea
6.0: /home/izaak/workspace/fmas-git/fmas/fmas
7.0: /home/izaak/downloads
9.0: /home/izaak/downloads/autojump
14.0: /home/izaak/workspace/fmas-git/fmas
21.0: /home/izaak
Total key weight: 76
(fmas-1.0=71a9f0: ../) izaak@
I would have expected if i ran the command:
cd /home/izaak/workspace/fmas-git/fmas/fmas/scripts/db-scripts/ a bunch of times it'd show up in jumpstat
Some of the directories in jumpstat i hardly ever cd into. It seems like it was tracking cd commands for a bit then just stopped. Is there a process that watches them, or does it just track history file? I do have a modified .inputrc:
cat /home/izaak/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
Is there any way I could install autojump on a remote shared webhost? I have ssh but not root.
Instead of writing .autojump_errors
and .autojump.py
to $HOME
, it would be preferable to follow the XDG base directory specification. It helps keep $HOME
tidy with consistent locations.
I would suggest $XDG_CACHE_HOME/autojump/autojump_errors
for ~/.autojump_errors
and $XDG_DATA_HOME/autojump/autojump.py[.bak]
for ~/.autojump.py[.bak]
here's what i get (even after updating to current master:
-bash: PROMPT_COMMAND: line 1: syntax error near unexpected token `;'
-bash: PROMPT_COMMAND: line 1: `update_terminal_cwd; ; { [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/autojump_errors;} 2>/dev/null'
Seems that everytime I use the "j" command, an empty autojump_errors
file is created in my home directory. Looks a bit unsightly.
On OS X 10.7 Lion, but I saw this on Snow Leopard as well.
Maybe this could be a hidden dotfile instead?
I see that an applet is now disponible. Is there any documentation ? What does it do ? How can we use it ?
Hey there... so I have autojump installed, and I love it, except that I've noticed that if I go back through my command history, the commands have been modified. It looks like the first 10 characters of the second-to-last command is replaced with the first 10 characters of the last command, and then the commands before that are prepended with the first 10 characters. So the command history might look like this (latest to earliest):
cd ~/code/work/mandelbrot/advertiser
cd ~/code/lear
(originally clear
)cd ~/codekillall ruby
(orig. killall ruby
)cd ~/codent
(orig. nt
)cd ~/codej hardwarepedia
(orig. j hardwarepedia
)Now, I have several other things in my .bashrc file, but none of them affect the command history. I do notice this line in autojump.bash:
export PROMPT_COMMAND="${PROMPT_COMMAND:-:} ; $AUTOJUMP"
My thinking is that bash thinks I've called autojump hardwarepedia
instead of j hardwarepedia
. I don't really know though. Can you explain this behavior?
Hi.
I used autojump with no argument to jump directly to my favorite path.
By doing this the weight associed this path is decreased instead of increased !
I cannot ligthning jump to it anymore.
I can't possibly the first one that's run into this issue, but after I've installed autojump it overwrites my own prompt. I've gone ahead and just commented out lines 13-26 of /etc/profile and autojump works fine as usual.
I had to manually add '. /etc/profile.d/autojump.bash' to '~/.bashrc' for it to work. I am using Ubuntu 9.10 Karmic.
At least 50% of the issues concerning autojump are about the install scripts.
The reason is that these scripts are poorly written, and can't possibly work properly on the wide variety of distros and OSes that people use. This should be the job of the package manager.
To put an end to these problems, I'm thinking of rewriting the install script to install autojump on a per-user basis:
This would solve the problem of people who want to install autojump but are not root. I would keep the old script as a reference for people who want to create packages for their distro.
Comments? Suggestions?
Autojump expands symlinks, so if I have a symlink:
/home/ankit/src -> /home/ankit/Dropbox/Source
and I run:
cd /home/ankit/src
my jumpstat looks like this:
1.0: /home/ankit/Dropbox/Source
Total key weight: 1. Number of stored paths: 1
This means that I can't use:
j src
It seems that autojump has been updated in order to follow the XDG Base Directory Specification. In autojump.{bash,zsh}, there is one complex line that seems to implement this specification. However, it is commented out, and the next line implements something close, but not compliant given that it does not obey to the $XDG_DATA_HOME environment variable.
Two questions:
Also, jumpapplet has not been updated accordingly, so it simply fails with a recent autojump database. This has been the object of the Debian bug report #633889 http://bugs.debian.org/633889. But please do not take the attached patch as it is, because it is also an incomplete implementation of the specification. I shall provide a fix soon.
Just as an fyi, on archlinux an default install will only contain python2 inside of an default users path which breaks "j", i resolved this by running sudo ln -s /usr/bin/python /usr/bin/python2
When using j foo
, but there is nothing matched and autojump therefore remains in the current directory, a return value of e.g. 1 should get returned instead of 0.
This would allow scripting of autojump like with the following function, which would only list the current directory when "cd" or "j" were successful.
c() {
{ [[ -d "$@" ]] && cd "$@" || j "$@" } && ls
}
While the workaround here is to compare the initial and resulting directory, it makes sense for autojump to provide feedback about is work nonetheless.
Hello,
I have installed autojump (version 12) on my Debian Squeeze (zsh installation), but I have a bug when I want use vim.
If I tipe this :
vim /etc/
I have this massages :
_arguments:448: _vim_files: function definition file not found
If I use cat I don't have this problem.
I'm ready to help to fix this bug :)
I get the following error when running autojump:
Traceback (most recent call last):
File "/usr/bin/autojump", line 115, in <module>
path_dict=open_dic(dic_file)
File "/usr/bin/autojump", line 96, in open_dic
path_dict=cPickle.load(aj_file)
ImportError: Import by filename is not supported.
I can't quite figure out the pattern, but typing "j partofpath" doesn't usually autocomplete for me. For example:
% jumpstat
...
73.0: /Users/jay/src/merge_versions
% j merge_ver<TAB>
No matches: `file' or `corrections'
% j merge_ver<ENTER>
/Users/jay/src/merge_versions
I do have a few dozen completion-related lines in my .zshrc.d; autojump.zsh executes after these. (I tried commenting them all out, but then completion didn't work at all, and I don't remember enough zsh to recreate a normal environment.)
zstyle ':completion:*:messages' format %d
zstyle ':completion:*:warnings' format 'No matches: %d'
zstyle ':completion:*:descriptions' format %B%d%b
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' verbose yes
zstyle ':completion:*' list-separator '#'
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
zstyle ':completion:*:default' menu 'select=0'
zstyle ':completion:*:windows' menu on=0
zstyle ':completion:::::' completer _expand _complete _ignored _approximate
zstyle ':completion:*:expand:*' tag-order all-expansions
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
zstyle ':completion:*' group-name ''
It seems like this occurs everytime I want to use autojump after reboot:
j te
Problem with autojump database, trying to recover from backup...
Traceback (most recent call last):
File "/usr/bin/autojump", line 132, in
path_dict=open_dic(dic_file)
File "/usr/bin/autojump", line 117, in open_dic
shutil.copy(dic_file+".bak",dic_file)
File "/usr/lib/python2.6/shutil.py", line 88, in copy
copyfile(src, dst)
File "/usr/lib/python2.6/shutil.py", line 53, in copyfile
fdst = open(dst, 'wb')
IOError: [Errno 13] Permission denied: '/home/jostein/.local/share/autojump/autojump_py'
The output of "ls -l":
~/.local/share/autojump> ls -l
total 8
-rw------- 1 root root 1164 2010-10-22 18:13 autojump_py
-rw------- 1 jostein users 46 2010-10-21 19:28 autojump_py.bak
I get this error continually:
File "/usr/bin/autojump", line 160
print "\n".join(("%s__%d__%s" % (pattern,n+1,r) for n,r in enumerate(results[:8])))
^
SyntaxError: invalid syntax
I have just installed autojump.
cat /proc/version
Linux version 2.6.9-34.ELsmp ([email protected]) (gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)) #1 SMP Fri Feb 24 16:54:53 EST 2006
It could be nice to have an "ls -l" output from autojump by f.ex. doing "j -l dirspec". I know this can be achieved by doing "j dirspec && ls -l" but it could be nice to have as an option.
Is it possible to have autojump pass the directory path it finds, so it can be used as an argument in another command? Something like
open `j inbox`
Just something I noticed when I recently installed. I like to check out the stats and verify things are incrementing correctly, but doing so still seems to increment the count of the last jumped to directory. I would feel that using 'j' or 'cd' should be the only commands that alter the jump directory.
Perhaps my bash history would explain things:
http://gist.github.com/467546
Hi,
when i do a jumpstat i have:
xxxx
103.3: /home/developpement/project/mainline
165.1: /home/developpement/project/git-mainline
but when i try a completion with
j main[TAB]
autojump always complete with /home/developpement/project/git-mainline instead of showing me the 2 possibilities.
Best Regards,
JrCs
Arnaud-mac:~ AJG23$ j ITK File "/usr/bin/autojump", line 65
except OSError as ex:
^
SyntaxError: invalid syntax
File "/usr/bin/autojump", line 65
except OSError as ex:
^
SyntaxError: invalid syntax
I get a syntax error when starting jumpstat:
nico@pclinux:525:25:~$ jumpstat
File "/usr/bin/autojump", line 59
except OSError as e:
^
SyntaxError: invalid syntax
Tue Feb 22 - 21:41:58
I'm guessing my python version is too old:
nico@pclinux:524:24:~$ python
Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Any hints on the minimal needed version?
Cheers, Nico.
install.zsh wasn't installing autocompletion for me, and I couldn't figure out why... till I realized that it runs #!/bin/zsh, which has a different idea of what $fpath should be than the /opt/local/bin/zsh that I'm actually using!
The shebang should probably be #!/usr/bin/env zsh and #!/usr/bin/env bash everywhere. I think. I've never really been clear on that, though.
Hello,
I installed autojump in Ubuntu 11.04 from synaptic and I can't get it to work. I added source /etc/profile in my bashrc,
closed and opened my terminal again, and whenever I try to use jumpstat it says command not found.
I tried to train jumpstat by navigating a bit in my filesystem, but when I try j derp to go to a directory, it also says j: command not found.
Am I missing something?
It appears to me that autojump will only remember the resolved path (e.g. /foo/bar/baz), but not the actual current working dir (e.g. /a/b/c), where b
is a symlink to another directory.
I have not looked at the source, but I can never j b
.
Please consider adding both the resolved and unresolved path to the list of remembered directories, where the unresolved path should even get a higher priority.
Often it happens that I need to run a few commands as root, so I just
# sudo bash
Problem is that after that, the database is owned by root, and cannot be accessed using my own user.
I added a test for SUDO in the PROMPT_COMMAND, and it fixed it:
AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && [[ "$SUDO_USER"x == x ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/autojump_errors;} 2>/dev/null'
I'm not entirely positive, but I just got and error from jumpstat:
IOError: [Errno 13] Permission denied: '{$HOME}.local/share/autojump/autojump_py'
Sure enough, autojump_py was owned by root. Seems like a cd or something I ran with sudo wrote to the file as root (?) and chowning it back to me fixed the problem
Is it possible to edit the database from which autojump pulls? For example, I have changed some of my dirstructure such that a number of my j commands are no longer relevant.
Is my only option to remove and start fresh? (i.e. rm -f ~/.local/share/autojump)?
Hi.
I think you should set the prefix variable to /usr/local by default so it does not mess with distribution packages.
All right this is a really lousy issue but i thought I'd note it - if you want to close or delete it I don't blame you. Maybe you can give me some pointers as to where to look.
I grabbed this version: http://github.com/joelthelion/autojump/commit/790b52d31e187d473a8a431ac4b635e5ccb9216d
And noticed after reboot that my gnome and kde sessions wouldn't allow login Gnome failsafe did however. I went back to release-v7, and everything worked. I couldn't find any obvious logs in messages, X, gdm, dmesg (I'm a bit of nieve when it comes to Ubuntu). I'm not sure which logfile to look at.
I can't help but think that since v7 worked that this is basically a pebkac, but thought i'd make mention of it.
Hello,
Tab-completion is not working for me. I'm on a Mac running 10.6.4 with bash as my shell. Tab-completion works with cd but not with j.
In installed by downloading the zip file and running the ./install.sh script. I answered yes to the "Your distribution does not have a /etc/profile.d directory, the default that we install one of the scripts to. Would you like us to copy it into your ~/.bashrc file to make it work? (If you have done this once before, delete the old version before doing it again.) [y/n]" question.
I don't really know much about tab-completion so if you can tell me what files to check I'll gladly do it.
Thanks,
Jake
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.