On Thu, Oct 15, 2009 at 3:12 AM, the jimmybot <[email protected]> wrote:
> a very nifty bookmarking feature for creating
> shortcuts to directories that you use often.

I solved this problem by creating a Fish function called "nd" (named directroy):

function nd -d "go to named directory; +NAME stores pwd as NAME"
  set -l dirs ~/.fish/functions/nd
  mkdir -p $dirs

  if test $argv
    for arg in $argv
      if echo $arg | grep -q '^+'
        set -l file $dirs/(echo $arg | sed 's,^+,,')

        pwd > $file
      else
        set -l file $dirs/*$arg*

        if test -f $file
          cd (cat $file)
        end
      end
    end
  else
    # print list of known dirs
    for d in $dirs/*
      echo (basename $d)' = '(cat $d)
    end
  end
end

Here's an example of its usage:

s...@yantram ~> nd
blog = ~/var/blog
nd = ~/.config/fish/functions/nd
rec = ~/src/recur
vpi = ~/src/ruby-vpi

s...@yantram ~> nd vpi

s...@yantram ~/s/ruby-vpi> pwd
~/src/ruby-vpi

Cheers.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to