I find myself using bash more often than not on remote machines even though fish
is my preferred shell. Fish has small, but nice feature that when you hit Ctrl+C something like this happens:
if command running
send SIGINT
else
clear line (don't start a new one)
It would be nice to be able to do this in bash too.
I imagine it would involve trapping SIGINT, which comes from stty
being configured to send it once Ctrl+C is hit, but I haven't found out how to execute the pseudo-code above.
What I've tried
trap 'tput dl1' SIGINT
which clears the line, but still continues to start a new line/prompt (it's like hitting enter on an empty prompt) and does so only if I've not navigated in history :\