Single-key to access help/man for `current-cmd`
When I'm writing a command, sometimes I want to quickly check the help or man page of a command.
Keybind idea: Ctrl-Alt-h
How it could work
Based on current cmdline (after aliases expansion!), parse and find all commands. (Keep it simple first!)
For simple commands like mv, there's basically either:
-
some-cmd --help -
man some-cmd
NOTE: For complex commands like git there are more than one help/man pages, so we could try to guess if a sub command was used by looking at first param, see if it matches ^[a-z_-]$ and add
For man candidates, check the manpage exists (use man to determine this, don't guess!).
Once we have all candidates, open a choice selector (even if only 1?) to interactively choose the one I want, then run it without saving into shell history (auto-pipe in pager?).