Live data from Hacker News

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

github.com

1–10 of 54 posts

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

#2
Interesting approach. Since I've converted entirely to nushell, I'm using zoxide to solve this navigation friction. https://github.com/ajeetdsouza/zoxide

The only thing I'm missing from zsh is path aware auto completion... supposedly this works if you enable the sqlite history for nushell but iirc it was buggy.

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

#3
I really like "jump" which I have aliased to "j". It auto learns and you can also pin shortcut names so I don't have to fuss configuring it but also can control certain ones. Great trade off between usability and configurability. Can't find the repo but "brew install jump" works :)

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

#4
I made this helper function to navigate my projects, recursively, it will list them if there are more than one, but defaults to the first one unless you give it a number.

syntax:

  projects  
alias:

  function projects() {
    if [ -z "$1" ]; then
      echo "please provide a project name"
      return
    fi

    local allMatches=$(find ~/Documents/projects -maxdepth 2 -type d -name "*$1*" -print)
    local firstMatch=$(echo "$allMatches" | head -n ${2:-1} | tail -n 1)

    if [ -z "$firstMatch" ]; then
      echo "no matches found"
      return
    else
      if [ $(echo "$allMatches" | wc -l) -gt 1 ]; then
        echo "matches found:"
        echo "$allMatches" | awk '{print NR ") " $0}'
      fi
      cd "$firstMatch"
    fi
  }

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

#5
post #3

I really like "jump" which I have aliased to "j". It auto learns and you can also pin shortcut names so I don't have to fuss configuring it but also can control certain ones. Great trade off between usability and configurability. Can't find the repo but "brew install jump" works :)

https://github.com/gsamokovarov/jump>

Personally, I've been using z (https://github.com/rupa/z>) for ages and never really needed more.

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

#7
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/

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

#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 pages based on it. That way the process of bookmark creation is automatic and you don't have to predict what you will need to access frequently.

https://github.com/zsh-users/zsh-autosuggestions?tab=readme-...

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

#9
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.

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

#10
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 have to concur, fish is simply an amazing shell for interactive sessions. I've been using it for so long, I just take some things for granted, like the incredible autocomplete. As far as I understand, it looks at paths in history entries and won't suggest them if those aren't valid in the current directory. Then you also have the "shadow suggestion" described by GP, the Alt+arrows to just complete part of a history entry, the really good Ctrl+s (which also works for commands that implement fish suggestions, not just history), and so on.

Extremely useful on a daily basis.

Post reply on HN