Live data from Hacker News

Shunpo: Minimalist bash tool to make directory navigation a little bit faster

github.com

31–40 of 54 posts

Re: Shunpo: Minimalist bash tool to make directory navigation a little bit faster

#31

A project-specific zsh[0] function I find quite handy is: devhome () { cd $DEV_HOME/${~1}(/) } This assumes an environment variable DEV_HOME is assigned to be the location of the top-level directory for a given project. An example of its use is: devhome mod*/foo/src/**/some-dir 0 - https://www.zsh.org/

i mostly use this to go from inside a repo up to the root:

  alias rr='cd $(git rev-parse --show-toplevel)'

Re: Shunpo: Minimalist bash tool to make directory navigation a little bit faster

#34
Seems like as good a time as any to show off this cursed thing I keep in my dotfiles:

    # Allow .. through ........... (yup!) to cd up some number of directories.
    for i in {1..10}; do
        spaces=$(printf "%${i}s")
        alias "${spaces// /.}."="cd ${spaces// /../}"
    done
Going into it, I thought it would be something I'd use all the time. In practice all I ever use is `..` and not nearly as much as I originally imagined I would.

Re: Shunpo: Minimalist bash tool to make directory navigation a little bit faster

#35

Seems like as good a time as any to show off this cursed thing I keep in my dotfiles: # Allow .. through ........... (yup!) to cd up some number of directories. for i in {1..10}; do spaces=$(printf "%${i}s") alias "${spaces// /.}."="cd ${spaces// /../}" done Going into it, I thought it would be something I'd use all the time. In practice all I ever use is `..` and not nearly as much as I originally imagined I would.

I have something similar (though less elegant). I find the best use case to be hitting .......... to get to root (in conjunction with zsh auto_cd option), rather than typing `cd /`.

Re: Shunpo: Minimalist bash tool to make directory navigation a little bit faster

#37
You can use `ranger` to interactively navigate to and select a directory:

  cdranger() {
      local tmpfile="$(mktemp)"
      local cdto
      ranger --show-only-dirs --choosedir="$tmpfile" "$@"
      cdto="$(cat $tmpfile)"
      rm -f "$tmpfile"
      if [ "$cdto" ]; then
          cd "$cdto"
      fi
  }

Re: Shunpo: Minimalist bash tool to make directory navigation a little bit faster

#38
I guess I'll share what I built for myself.

https://gist.github.com/chanux/1119556 (bash) https://gist.github.com/chanux/9411092 (fish)

That's `za ` to go back n directories up. It's a decade old and I still use this everyday.

I experimented with jumping up directory path by name with `xs`. But I don't use it that often (at all).

https://gist.github.com/chanux/08c6f53472190a02b33bd49100163...

Re: Shunpo: Minimalist bash tool to make directory navigation a little bit faster

#40
An alternative is to use CDPATH [0], and possibly a directory containing symlinks as bookmarks. That way you can also switch between different sets of bookmarks by changing CDPATH. Add some shell aliases for managing that setup.

[0] https://www.gnu.org/software/bash/manual/html_node/Variable-...

Post reply on HN