11 comments

  • sudahtigabulan 6 hours ago
    Aliases as a feature are meant to save you typing in the first place.

    The more you use aliases, the more you save in typing, over time.

    If you can't remember a particular alias, that means you have a use for it very rarely (spaced repetition and all that), and the benefit of having it around is very low anyway.

    I generally try to prune my bashrc from aliases that turned out not as useful as I thought. I have about 50 atm, and don't feel the need for a helper tool.

    Maybe if one's aliases skew towards a particular pattern this tool could be useful, I don't know.

    • drcongo 1 hour ago
      I keep those rarely used ones in there as a useful record of the syntax that I created the alias to get around in the first place. Fish shell's abbreviations are even more useful in this respect as they expand to the full command.
  • flexagoon 5 hours ago
    Fish shell has abbreviations, which expand into the full command, support regex patterns, and can expand arguments to a different command

    https://fishshell.com/docs/current/cmds/abbr.html#examples

  • hk__2 3 hours ago
    I used to have a lot of aliases, but in the end I pruned most of them because the more you rely on aliases the more time you lose each time you open a terminal on a server. 99% of my usage is `g` for Git, `l` for `ls -lh` and the `autocd` option in Bash.
  • tomoviktor 8 hours ago
    > When you have a lot of aliases it can be difficult to remember how was the one you need named especially if you do not use it very often.

    I use tmux and I use this small keybind to launch a place where I can search my aliases: bind-key a run-shell 'tmux neww -n "aliases" "source ~/.zshrc && alias | fzf"'

    I like this workflow because it's quick. I always thought that if I want to shorten something I will just make and learn and alias for it and that's it.

  • hbogert 2 hours ago
    i am somewhere different in my search for something like this. I'd like this idea for a single command. More like a command builder.

    I've started to make one for kubectl. Sure, the standard completion for kubectl is okay, but it could be so much better if not confined to the restrictions and archaic zsh-fuu to make it interesting.

    For example, the default completion does not allow completion for a pod in a different namespace, unless you choose the namespace first. Why not tab complete all pods in all namespaces with a fuzzy finder? Why not allow completion for labels? Why not tab complete more complex outputs with custom columns? Etc etc.

    • skydhash 1 hour ago
      Yesterday I was checking out Transient in Emacs and it looked like what you’re describing (Transient is what makes magit possible). But I’m not sure the UX is a boost over expansive tab-completion. It may be interesting to explore, though
  • piranha 6 hours ago
    That's a fantastic idea! I've made it a bit simpler for myself — basically just `source file`, so that I don't need to press enter to execute it, but also added one cute detail in the loop:

        if [[ -f "$target/.exec" ]]; then
            zsh "$target/.exec"
        fi
  • mrlambchop 6 hours ago
    I don't know about anyone else, but when transitioning back to a shell, I HAVE to hit a bunch of enters on any prompt to clear the last output away a few lines before I can summon up the powers to enter a new command - blow away the cobwebs and all that. I love the empty enter command line :)
    • samf 2 hours ago
      I'm the same way, and "clear" or ^L isn't what I'm after. I want the history to still be on my screen, but I want the vertical separation too.
    • AlecSchueler 4 hours ago
      Sounds like a good use case for `clear`.
      • hk__2 3 hours ago
        Or ^L, faster.
  • jinnko 4 hours ago
    I've been using https://github.com/denisidoro/navi for this kind of scenario.
  • laktak 6 hours ago
    I think there are a lot of different takes on this. Mine uses playbooks, if you are interested https://github.com/laktak/tome
  • gitroom 4 hours ago
    Tbh having tons of aliases always messes me up, half the time I forget them and just end up typing full commands anyway lol
  • pseudo_meta 8 hours ago
    Is it possible to trigger the expander differently?

    I already have zsh-magic-dashboard running on empty enter.

    • waszabi 6 hours ago
      Yes, when you configure the expander based on the readme change the ^M (enter key) on the following line to any key you wish:

      bindkey "^M" empty-enter-expander

      ^E represents Ctrl + E M-e represents Alt + E ...