Live data from Hacker News

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

github.com

41–50 of 54 posts

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

#41
post #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...

I have the following in my .bashrc:

    alias .='dot_func'
    alias ..='cd ../..'
    alias ...='cd ../../..'
    alias ....='cd ../../../..'
    alias .....='cd ../../../../..'

    dot_func ()
    {
       if [ $# -eq 0 ]; then
          cd ..
       else
          source "$@"
       fi
    }
It’s usually enough. :)

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

#44

Nice. While I prefer a combination of these tools fzf zoxide fd Small helpers are always good to have. Thanks for sharing

I use Yazi with all of those - it also has ripgrep integrated

Between all of those it's hard to think of a better experience navigating a filesystem.

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

#45

Nice. While I prefer a combination of these tools fzf zoxide fd Small helpers are always good to have. Thanks for sharing

I use Yazi with all of those - it also has ripgrep integrated Between all of those it's hard to think of a better experience navigating a filesystem.

I also use

  yazi
along with kitty. Unfortunately I did not find an (acceptable) way to simulate the behaviour of

  ddterm 
GNOME extension with kitty or alacritty. A dropdown Terminal with image protocol for file preview would be very cool.

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

#46
post #8

I have a utility called ZSH Autosuggestions, and it's probably one of the most useful things on my computer. It shows you a sort of preview of the most recent command you typed that matches the prefix of the current command you are typing. It's basically an automatic tool that bookmarks commands based on usage. I think the best bookmark systems are ones which simply track your entire history and suggest relevant page…

This is essentially a fish built-in. I used to use zsh before, but since changing to fish I've never looked back. Auto completion, abbreviations, better syntax, and especially the auto complete is like magic. It also seems to "know" in which working directories some commands work and won't suggest them if they arent.

I really wanted to like fish but it is so difficult to get it configured the way I would want to use it. I tried so many different ways and the barriers were just so high. It should not be so difficult to make a tool work the way I wanted to work.

So I too went back to zsh.

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

#47

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 use something similar: .. , .2 , .3 , etc.

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

#48

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.

[deleted]

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

#49
post #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)'

This is certainly a viable alternative to requiring a project-specific environment variable. The downside is it can only succeed if $PWD is within the local git repo.

If this is the preferred approach, however, an alternative zsh definition for devhome could be:

  devhome () {
    cd $(git rev-parse --show-toplevel) && cd ./${~1}(/)
  }

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

#50
post #41
post #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...

I have the following in my .bashrc: alias .='dot_func' alias ..='cd ../..' alias ...='cd ../../..' alias ....='cd ../../../..' alias .....='cd ../../../../..' dot_func () { if [ $# -eq 0 ]; then cd .. else source "$@" fi } It’s usually enough. :)

I had an alias ... for years and noticed I never really used it.

`cd ..` coupled with `cd ~` seems to be good enough, really.

Post reply on HN