←back to thread

41 points waszabi | 2 comments | | HN request time: 0.42s | source

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. You can also have files stored in a bin folder and look there to find the name. Another trick is to prepend your commands with a comma then type the comma and hit the Tab key to see only your own commands. There is an article about it somewhere on the Internet.

I needed something lightweight to always show me the available commands. Something to run with a few keystrokes. Something that stores commands in files and folder structures.

The idea was born at the time of using Linux Debian with the dwm (dynamic window manager). The first version was implemented in bash and it could do three things: start an application, expand text from a template and do a predefined automation on the selected application.

It was launched by a keyboard shortcut and opened the list of commands in a new terminal window. The commands were stored in nested folders and it was able to switch between the three modes (launcher, expander, automator). It also required only few keystrokes to do the desired action.

For instance, I was in the terminal and hit Ctrl+P. It opened a new terminal and listed applications to launch. I hit the Space to switch to the expander mode. Then I hit the g to enter the Git folder and s for the status. The result was that it put the git status to the terminal I was in before. This expander could be used in any application. It could insert the email template into the browser.

Then I migrated to macOS and really missed that tool. So I quickly wrote a zsh vesrion that consists only the expander mode and supports only the terminal. It is activated by hitting Enter on empty command and then it inserts the desired command right into the prompt. For example, when you hit Enter, g and s you will get the git status command to the prompt and you can then execute it with Enter. Of course, those commands and keys are defined by you. There are various and lenghty commands that I use on a daily basis like this and it saves a lot of typing.

The tool is called Empty Enter Expander. It is implemented for the zsh as of now. Please check it out at https://github.com/waszabi/empty-enter-expander and let me know what you like or dislike about it.

1. hbogert ◴[] No.43802521[source]
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.

replies(1): >>43802805 #
2. skydhash ◴[] No.43802805[source]
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