Hacker News new | past | comments | ask | show | jobs | submit login

I keep all my projects and other repos that I clone under `~/src` e.g. `~/src/github.com/rails/rails` for the rails project. I then have the following fish function to navigate to a project:

  function c
    set -l directory (fd -d 5 --prune -a -H -t d -g '.git' ~/src ~/b -x dirname {} | fzf --tiebreak=length,begin,end)
    if test -n "$directory"
      and test -d $directory
      cd $directory
    end
  end
I just type 'c' and then 'rails' and I'm in the rails project. I really like diving into code and this makes it much faster.

I also have this one to clone or cd a project from github like `gc rails/rails`

  function gc --argument repo
    set -l dir $HOME/src/github.com/$repo
    if not test -d $dir
      if test -d $HOME/go/src/github.com/$repo
        set dir $HOME/go/src/github.com/$repo
      else
        mkdir -p $dir
        if not git clone "git@github.com:$repo.git" $dir
          set -l git_status $status
          rmdir $dir 2>/dev/null
          return $git_status
        end
      end
    end
    cd $dir
  end
And this function:

  function list_after_cd --on-variable PWD
    ls
  end
Runs ls every time I change directory, which you basically always want anyways



Reminds me of z / zoxide / fasd, I use zoxide personally




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: