I use fzf in this very way and could have written this article if I weren’t lazy lol. However, I can add two other use cases:
1. I use i3wm at home (haven’t yet made the jump into Sway/Wayland), and don’t want to change my screen resolution by opening an app, clicking with my mouse, and then waiting. So I use fzf for quick resolution changes using xrandr:
2. At work I switch between multiple Kubernetes contexts during the day. To make the switch fast without typing a sentence, I will use this helper function:
I found this to be better than tab-completion because with tab completion I only get the name of the context, and not the cluster/user/namespace fields that make it easier to select the right one.
Use the above at your own risk, as they are fast hack-ups and could be far more clear (my sed skills are prone to error and overly verbose).
I would highly recommend looking at something like kubectx [0] to manage switching between kubernetes contexts! I've been using this for a while now and have it aliased to kx. It supports tab completion, as well as fzf integration if you have it installed [1]. There's also kubens in there which does the same for namespaces!
Just a heads up that the quotes used in the kc function appear to be "smart quotes" and will likely throw an error if copied verbatim into your shell config
1. I use i3wm at home (haven’t yet made the jump into Sway/Wayland), and don’t want to change my screen resolution by opening an app, clicking with my mouse, and then waiting. So I use fzf for quick resolution changes using xrandr:
2. At work I switch between multiple Kubernetes contexts during the day. To make the switch fast without typing a sentence, I will use this helper function: I found this to be better than tab-completion because with tab completion I only get the name of the context, and not the cluster/user/namespace fields that make it easier to select the right one.Use the above at your own risk, as they are fast hack-ups and could be far more clear (my sed skills are prone to error and overly verbose).
—Edited for HN formatting