You are not logged in.

#1 2009-04-10 11:29:40

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

Autojump: some news!

Hi all,

You might remember autojump, which is a little tool I made which is a cd command that "learns" from your usage of the CLI. There's been significant progress since the last post:

1) We now support zsh completely, including autocompletion. I think this should please a number of people, give the number of zsh zealots in these forums smile

2) A user contributed a little applet which displays an icon in the notification area. The icon allows you to quickly open a terminal or file browser in the most used directories.

3) Performance has been improved by running the prompt command in the background.

The package is not up to date yet because I don't feel the features have been tested enough for a big release, but if you want to test and report bugs to the autojump forum (http://n2.nabble.com/autojump-f2340094.html), that would help a lot.

Github page for the project: http://wiki.github.com/joelthelion/autojump


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

Offline

#2 2009-04-12 11:36:39

X/ax
Member
From: Oost vlaanderen, Belgium
Registered: 2008-01-13
Posts: 275
Website

Re: Autojump: some news!

I just read this now. Looking for zsh compatibility with autojump... THANKS
For now all I can say is: WHOO it works tongue


My coding blog (or an attempt at it)
Archer start page (or an attempt at it)

Offline

#3 2009-04-14 19:57:18

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

Re: Autojump: some news!

X/ax wrote:

I just read this now. Looking for zsh compatibility with autojump... THANKS
For now all I can say is: WHOO it works tongue

Great! Thanks for testing!


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

Offline

#4 2009-04-16 13:34:04

ElCerdo
Member
Registered: 2008-07-16
Posts: 3

Re: Autojump: some news!

i may have a biased point of view but i must say that autojump changed my life!!! especially the applet wink

Offline

#5 2009-04-17 20:36:39

webframp
Member
Registered: 2008-11-15
Posts: 35
Website

Re: Autojump: some news!

lardon wrote:

The package is not up to date yet because I don't feel the features have been tested enough for a big release, ...

Why not upload an autojump-git pkg then?

Offline

#6 2009-04-19 19:37:19

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

Re: Autojump: some news!

webframp wrote:
lardon wrote:

The package is not up to date yet because I don't feel the features have been tested enough for a big release, ...

Why not upload an autojump-git pkg then?

I hope the official package will be updated soon. There is also a simple install script that works very well for people who don't want to wait. Anyways, if someone updates a git package, I will vote for it smile


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

Offline

#7 2009-04-21 20:59:10

webframp
Member
Registered: 2008-11-15
Posts: 35
Website

Re: Autojump: some news!

Here you go, feel free to take over and post the files somewhere under your ownership.

PKBUILD:

# Contributor: Sean Escriva <sean.escrivaATgmail.com>

pkgname=autojump-git
pkgver=20090421
pkgrel=1
pkgdesc="A cd command that learns"
url="http://github.com/joelthelion/autojump/tree/master"
arch=('i686' 'x86_64')
license=('GPL')
depends=('bash' 'python')
makedepends=('git')
conflicts=('autojump')
provides=('autojump')
replaces=()
backup=()
source=()
install=(${pkgname}.install)
md5sums=('')

_gitroot="git://github.com/joelthelion/autojump.git"
_gitname="autojump"

build() {
  cd ${srcdir}
  msg "Connecting to github.com GIT server...."

  if [ -d ${srcdir}/$_gitname ] ; then
  cd $_gitname && git pull origin
  msg "The local files are updated."
  else
  git clone $_gitroot
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting script install..."

  git clone $_gitname $_gitname-build
  cd ${srcdir}/$_gitname-build

  install -Dm 755 autojump "$pkgdir"/usr/bin/autojump
  install -Dm 755 jumpapplet "$pkgdir"/usr/bin/jumpapplet
  install -Dm 755 autojump.sh "$pkgdir"/etc/profile.d/autojump.sh
  install -Dm 755 autojump.zsh "$pkgdir"/etc/profile.d/autojump.zsh
  gzip -f autojump.1
  install -Dm 644 autojump.1.gz "$pkgdir"/usr/share/man/man1/autojump.1.gz
  install -Dm 644 icon.png "$pkgdir"/usr/share/autojump/icon.png
}
# vim:set ts=2 sw=2 et:

autojump-git.install:

#This code is licensed under the GPL, version 3.
#A full copy of the license can be obtained at http://www.gnu.org/licenses/gpl-3.0.html

# arg 1:  the new package version
post_install() {
  echo " > You need to source /etc/profile in your ~/.bashrc or ~/.zshrc for autojump  to work"
  echo " > man autojump for instructions."
  /bin/true
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
  post_install $1
  /bin/true
}

op=$1
shift
$op $*
# vim:set ts=2 sw=2 et:

Offline

#8 2009-04-22 07:24:01

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

Re: Autojump: some news!

Thanks for the contibution! Please post the PKGBUILD to AUR.


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

Offline

#9 2009-04-22 08:56:57

robmaloy
Member
From: Germany
Registered: 2008-05-14
Posts: 263

Re: Autojump: some news!

imho the dictionary should be saved after deleting dead directories

and maybe exclude /tmp/* as this will likely produce dead directories. but that's up to you.



great program! love it

Last edited by robmaloy (2009-04-22 08:59:08)


☃ Snowman ☃

Offline

#10 2009-04-22 21:20:46

webframp
Member
Registered: 2008-11-15
Posts: 35
Website

Re: Autojump: some news!

lardon wrote:

Thanks for the contibution! Please post the PKGBUILD to AUR.

here you go: http://aur.archlinux.org/packages.php?ID=25870

Offline

#11 2009-04-23 08:45:15

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

Re: Autojump: some news!

webframp wrote:
lardon wrote:

Thanks for the contibution! Please post the PKGBUILD to AUR.

here you go: http://aur.archlinux.org/packages.php?ID=25870

Great, thanks!


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

Offline

#12 2009-04-23 08:46:19

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

Re: Autojump: some news!

robmaloy wrote:

imho the dictionary should be saved after deleting dead directories

That's definitely a bug... I don't really know how to fix it though. I will try to take a more in-depth look at it this week-end. Thanks for reporting!


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

Offline

#13 2009-04-25 12:59:23

robmaloy
Member
From: Germany
Registered: 2008-05-14
Posts: 263

Re: Autojump: some news!

just add the bold line


def match(path,pattern,path_dict,re_flags=0):
    import re
    if os.path.realpath(os.curdir)==path : return False
    if re.search(pattern,"/".join(path.split('/')[-1-pattern.count('/'):]),re_flags) is None:
        return False
    else:
        if os.path.exists(path) : return True
        else: #clean up dead directories
            del path_dict[path]
            save(path_dict, dic_file)
            return False


☃ Snowman ☃

Offline

#14 2009-04-25 13:46:28

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

Re: Autojump: some news!

robmaloy wrote:

just add the bold line


def match(path,pattern,path_dict,re_flags=0):
    import re
    if os.path.realpath(os.curdir)==path : return False
    if re.search(pattern,"/".join(path.split('/')[-1-pattern.count('/'):]),re_flags) is None:
        return False
    else:
        if os.path.exists(path) : return True
        else: #clean up dead directories
            del path_dict[path]
            save(path_dict, dic_file)
            return False

Well of course, that will work, but it will sync the file for every path it doesn't find..


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

Offline

#15 2009-04-25 14:06:07

robmaloy
Member
From: Germany
Registered: 2008-05-14
Posts: 263

Re: Autojump: some news!

lardon wrote:
robmaloy wrote:

just add the bold line


def match(path,pattern,path_dict,re_flags=0):
    import re
    if os.path.realpath(os.curdir)==path : return False
    if re.search(pattern,"/".join(path.split('/')[-1-pattern.count('/'):]),re_flags) is None:
        return False
    else:
        if os.path.exists(path) : return True
        else: #clean up dead directories
            del path_dict[path]
            save(path_dict, dic_file)
            return False

Well of course, that will work, but it will sync the file for every path it doesn't find..

right, that would be quite inefficient


☃ Snowman ☃

Offline

#16 2009-04-26 17:45:40

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

Re: Autojump: some news!

I've added a fix, it's not the most elegant code, but it should work and be efficient:

diff --git a/autojump b/autojump
index 6b67b9f..43e8393 100755
--- a/autojump
+++ b/autojump
@@ -8,6 +8,7 @@ from sys import argv,exit
 import os
 import signal
 max_keyweight=1000
+dead_dirs=False #global variable (evil ;-) to know if we should save the dict at the end
 
 def signal_handler(arg1,arg2):
     print "Received SIGINT, trying to continue"
@@ -29,6 +30,7 @@ def match(path,pattern,path_dict,re_flags=0):
         if os.path.exists(path) : return True
         else: #clean up dead directories
             del path_dict[path]
+            dead_dirs=True
             return False
 
 def save(path_dict,dic_file):
@@ -118,6 +120,8 @@ else:
         dirs.sort(key=lambda e:e[1],reverse=True)
         if completion or not results: #if not found, try ignoring case. On completion always show all results
             find_matches(dirs,pattern,path_dict,results,re_flags=re.IGNORECASE,max_matches=9) 
+        if dead_dirs: #save the dict if there were some non-existent directories in the database
+            save(path_dict,dic_file)
 
         if userchoice!=-1:

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

Offline

#17 2009-04-27 13:46:16

robmaloy
Member
From: Germany
Registered: 2008-05-14
Posts: 263

Re: Autojump: some news!

you could  also define constants, i.e.
MATCH_FOUND = 0
MATCH_NOTFOUND = 1
MATCH_DEADDIR = 2

which can be returned by match()

or when you stick to the global var, you have to add:

global dead_dirs

before CHANGING the value of dead_dirs in match()


☃ Snowman ☃

Offline

#18 2009-05-13 09:51:06

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

Re: Autojump: some news!

robmaloy wrote:

or when you stick to the global var, you have to add:

global dead_dirs

before CHANGING the value of dead_dirs in match()

Thanks, I really suck at writing python :-D It should be fixed now.


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

Offline

Board footer

Powered by FluxBB