How can I make Bash (or Zsh) run a particular command before each entered command?
- by Peeja
I'd like to configure Bash to run a particular command before running each command line I enter at the prompt. Specifically, I'd like to tell Vim (which is running in another terminal) to write all open buffers, because in my workflow if anything's unsaved when I leave Vim it's a mistake.
Is there an option for this in Bash? If not, is there an option in Zsh?
(There is a readline-based solution that somewhat fits this problem on another question, but it feels a bit hacky. It'll take it as a last resort.)