You are not logged in.

#26 2011-08-17 07:41:25

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

Just remove ~/.local/share/autojump/autojump_py*. I don't know what you mean by "safe", though. If you remove these files, autojump will forget everything, but should keep working normally.


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#27 2011-08-18 15:17:41

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

I deleted it but autojump completely stopped work for me.

$ cd /tmp
tmp $ cd ~
$ j tmp
$
$ pwd
/home/facade

$ ls -l ~/.local/share/autojump
total 0

Last edited by graysky (2011-08-18 15:19:41)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#28 2011-08-19 09:02:05

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

graysky wrote:

I deleted it but autojump completely stopped work for me.

Hum, weird. Can you post the output of your $PROMPT_COMMAND? Are you sure you are sourcing everything properly?


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#29 2011-08-19 10:11:20

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

SUre...

$ echo $PROMPT_COMMAND
history -a
$ head ~/.bashrc
echo -e "\x1B]2;$(whoami)@$(uname -n)\x07"; # set gnometerminal title

[ -f /etc/profile ] && . /etc/profile
[ -f /etc/bash_completion ] && . /etc/bash_completion

export EDITOR=vim
export VISUAL=vim
set -o vi
PS1='[\u@\h \W]\$ '

Last edited by graysky (2011-08-19 10:15:20)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#30 2011-08-20 09:33:22

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

The prompt command is your problem: it's supposed to contain autojump-related stuff. Something in your setup overwrites it (is your /etc/bashrc up to date?), so autojump won't work. Either find what the root problem is, or set it again at the end of your bashrc.


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#31 2011-08-20 10:01:16

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

@lardon - I don't have /etc/bashrc on my system apparently.

$ pacman -Qo /etc/bashrc
error: failed to read file '/etc/bashrc': No such file or directory

Here is my ~/.bashrc

As you can see, it does source /etc/profile as your script asks...

> You need to source /etc/profile in your ~/.bashrc for this to work
> only guaranteed to work with bash
Optional dependencies for autojump
    python2: needed for jumpapplet

EDIT: ok... I put a line in my ~/.bashrc to source /etc/profile.d/autojump.bash but why did I have to do this?  It worked fine prior to me deleting the database.  Your thoughts are appreciated.

Last edited by graysky (2011-08-20 14:59:40)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#32 2011-08-21 13:11:08

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

The problem is the following line in your .bashrc, that overwrites the PROMPT_COMMAND:

PROMPT_COMMAND='history -a'

The proper way to add stuff to the prompt command would be the following:

export PROMPT_COMMAND="new_command ; ${PROMPT_COMMAND:-:}"

Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#33 2011-08-21 15:05:40

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

<headsmack>
Made the change you recommended and removed the line I added to manually source autojump.bash.  Now autojump works again.  Thank you!


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#34 2011-11-15 00:58:40

veek
Member
Registered: 2006-03-10
Posts: 167

Re: autojump - the cd command that learns - new version

Hey lardon, very useful utility. I've only discovered it recently, and autojump has already saved me a gargantuan amount of typing.

Thanks for your contribution!

Last edited by veek (2011-11-15 00:58:54)

Offline

#35 2011-11-15 20:22:29

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

@veek: Thanks! I'm glad you like it!


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#36 2011-11-18 13:38:59

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

I've just uploaded version #18, which, apart from the usual bug fixes, uses a text format database. This change allows you to edit by hand the autojump database (in ~/.local/share/autojump) if you want to.


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#37 2011-11-18 14:21:54

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

@lardon - Very cool, thanks! So the idea is that users can edit ~/.local/share/autojump/autojump.txt and then autojump will translate that into~/.local/share/autojump/autojump_py so the application effectively uses the text file as the db?

For those who can't wait for pkg in [community] to get updated, apply this patch to the current PKGBUILD from ABS and build.

--- PKGBUILD	2011-11-18 00:08:24.000000000 -0500
+++ PKGBUILD	2011-11-18 09:24:58.549661550 -0500
@@ -5,7 +5,7 @@
 # Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
 
 pkgname=autojump
-pkgver=17
+pkgver=18
 pkgrel=1
 pkgdesc="A faster way to navigate your filesystem from the command line"
 arch=('any')
@@ -15,7 +15,7 @@
 optdepends=('python2: needed for jumpapplet')
 install=$pkgname.install
 source=(https://github.com/downloads/joelthelion/${pkgname}/${pkgname}_v${pkgver}.tar.gz)
-sha256sums=('21768224f69d4124cdd683fa6b678af5eac4dbfd392d61b4b1aad380cd185b78')
+sha256sums=('300c8bb001678946f627090f1afeeea277d1878baf153166182781245b03292d')
 
 package() {
   cd ${pkgname}_v${pkgver}

Last edited by graysky (2011-11-18 14:29:57)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#38 2011-11-18 16:19:00

vae77
Member
Registered: 2010-07-02
Posts: 75
Website

Re: autojump - the cd command that learns - new version

Amazing!

Offline

#39 2011-11-18 16:52:43

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

graysky wrote:

@lardon - Very cool, thanks! So the idea is that users can edit ~/.local/share/autojump/autojump.txt and then autojump will translate that into~/.local/share/autojump/autojump_py so the application effectively uses the text file as the db?

Actually, when you install the new version, autojump will convert autojump_py into autojump.txt (the old file will stay there just in case), and start using that one, which you can safely edit.

Thanks for posting the updated PKGBUILD!


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#40 2011-11-20 12:54:34

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

hmmm... autojump doesn't work on a new Arch install...

I am sourcing /etc/profile in my ~/.bashrc but ~/.local/share/autojump is empty.

$ which $SHELL
/bin/bash
$ j
$
$ cd /media/data
$ j
$
$ ls -l ~/.local/share/autojump/
total 0

Last edited by graysky (2011-11-20 12:54:59)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#41 2011-11-20 13:11:34

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

@graysky: can you post the value of $PROMPT_COMMAND?


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#42 2011-11-20 13:34:29

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

Sure... none of the autojump stuff is in there... why smile

$ echo $PROMPT_COMMAND
history -a ; echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"

Last edited by graysky (2011-11-20 13:36:38)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#43 2011-11-20 13:42:13

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

Either something is overwriting it, or /etc/profile is not sourcing autojump. Try sourcing /etc/profile.d/autojump.bash directly?


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#44 2011-11-20 13:48:50

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

That works... but wtf?

$ . /etc/profile.d/autojump.bash
$ echo $PROMPT_COMMAND
{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/.autojump_errors;} 2>/dev/null ; history -a ; echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"

Here is my ~/.bashrc which I use on all my machines.  This is only happening on one machine though so I doubt it's anything in there.

Last edited by graysky (2011-11-20 13:56:13)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#45 2011-11-20 14:26:01

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

Do you have /etc/profile.d/autojump.sh? You could check that it's there and that it does in fact source autojump.bash, because it's the file that is sourced by /etc/profile.


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#46 2011-11-20 14:27:49

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,604
Website

Re: autojump - the cd command that learns - new version

@lardon - yes:

$ cat /etc/profile.d/autojump.sh
# Source autojump on BASH or ZSH depending on the shell
#Copyright Joel Schaerer 2008, 2009
#This file is part of autojump

#autojump is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#autojump is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with autojump.  If not, see <http://www.gnu.org/licenses/>.
if [ "$BASH_VERSION" ] && [ -n "$PS1" ] && echo $SHELLOPTS | grep -v posix >>/dev/null; then
	. /etc/profile.d/autojump.bash
elif [ "$ZSH_VERSION" ] && [ -n "$PS1" ]; then
    . /etc/profile.d/autojump.zsh
fi

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#47 2011-11-21 14:37:35

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: autojump - the cd command that learns - new version

Just discovered this great little tool a few days ago, loving it already!

Thanks for this,
-jacky

Offline

#48 2011-11-29 16:45:54

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

I've just pushed a patch that allows autojump to be used with cp and mv. I'd be grateful if a couple people could test this and tell me what they think (you need to get the latest git version).

The idea is to add autojump functionality to "cp" and "mv". When you type something like:

cp data.txt dest__<Tab>

The "__" triggers autojump, which will attempt to complete "dest" like j would do it. That should be pretty useful when copying stuff from one place to a totally unrelated place.

Any thoughts? How could this be improved?


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#49 2011-11-29 20:57:36

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: autojump - the cd command that learns - new version

Just tried the new autocomplete quickly, nice. Could it work for other command as well, e.g. ls, vi, less, cat, etc?

Not really related, though it applies as well, but apparently autojump doesn't recognize parents of a visited folder. That is, see this:

[0][jjacky@arch ~]$ mkdir -p /tmp/one/two/three
[0][jjacky@arch ~]$ cd /tmp/one/two/three
[0][jjacky@arch three]$ cd -
/home/jjacky
[0][jjacky@arch ~]$ j two # will not work
[1][jjacky@arch ~]$ j three
/tmp/one/two/three
[0][jjacky@arch three]$

It seems because I never actually went to /tmp/one/two, though I did go to a subfolder, it isn't recognized by autojump. Could it be possible to change that, and have parents of visited path recognized as well?

Also, using the same path as above as example, apparently one cannot use e.g. "j ee/" to go to that folder (/tmp/one/two/three). Would be nice if it was possible, because it's useful in cases where the "j ee" jumps to something like "/foo/treepath" -- that is a (probably more visited) path that does have "ee" in its name, but not at the end of it.

Offline

#50 2011-11-30 09:40:05

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: autojump - the cd command that learns - new version

jjacky wrote:

Just tried the new autocomplete quickly, nice. Could it work for other command as well, e.g. ls, vi, less, cat, etc?

It would, but it would quickly become messy, because I would have to add a complete command for each of these commands. Fortunately, I don't think this is needed for unary commands (who take only one argument), since you can simply use j to go to the right folder and open the file from there. This is why I've restricted it to cp and mv for now.


jjacky wrote:

Not really related, though it applies as well, but apparently autojump doesn't recognize parents of a visited folder. That is, see this:

[0][jjacky@arch ~]$ mkdir -p /tmp/one/two/three
[0][jjacky@arch ~]$ cd /tmp/one/two/three
[0][jjacky@arch three]$ cd -
/home/jjacky
[0][jjacky@arch ~]$ j two # will not work
[1][jjacky@arch ~]$ j three
/tmp/one/two/three
[0][jjacky@arch three]$

It seems because I never actually went to /tmp/one/two, though I did go to a subfolder, it isn't recognized by autojump. Could it be possible to change that, and have parents of visited path recognized as well?

I see that as a feature, although of course it's very hard to cover all the possible use cases. If I added every parent automatically, j would often send you to places where you never go.

jjacky wrote:

Also, using the same path as above as example, apparently one cannot use e.g. "j ee/" to go to that folder (/tmp/one/two/three). Would be nice if it was possible, because it's useful in cases where the "j ee" jumps to something like "/foo/treepath" -- that is a (probably more visited) path that does have "ee" in its name, but not at the end of it.

That means /foo/treepath is used more and more recently than /tmp/one/two/three. So autojump thinks it's more likely you want to go there. In that case, you can use auto-completion, or a longer pattern.


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

Board footer

Powered by FluxBB