2 ms·
> One thing I'm considering as a key-binding option is to exec a command. This would be pretty awesome. I definitely would love to have that as a feature, assu
by saghm 10y ago
> One thing I'm considering as a key-binding option is to exec a command.
This would be pretty awesome. I definitely would love to have that as a feature, assuming it's not excessively difficult to implement.
- pdkl95 10y agoYou don't need to implement this in the terminal. You can bind macros to keys in anything that uses readline. Search for "inputrc" and the READLINE section in bash(1). While this is usually used for binding builtin functions (i.e. editing, history), you can simply provide the literal expansion. # in ~/.inputrc $if Bash # <f12> - find this with "<Control-v>{KEY}" "\e[24~": "sh \"${HOME}\"/path/to/swap_config.sh " # (the newline is included, which is # usually bound to accept-line) $endif The string indicating the key to binding to (left of the ":") can change depending on the environment (terminal, os, etc), so use <Control-v> to investigate what is actually being sent by the terminal into readline.
- saghm 10y agoThanks! Unfortunately I use zsh, and from a quick Google, it looks like it doesn't use inputrc.