I have the following lines in my .bashrc
:
# C-Z shortcut can be used to take a suspended job to fg
stty susp undef
bind '"\C-z":" fg >/dev/null 2>&1 \015"'
The purpose of this was to make the binding C-Z
better suspend Vim (as it already does as default within Vim), and then use C-Z
in the bash command line interface to get back to Vim immediately.
This seems to be working perfectly except for one thing:
me:~$ vim ~/.bashrc
[1]+ Stopped vim ~/.bashrc
me:~$ fg >/dev/null 2>&1
me:~$ fg >/dev/null 2>&1
me:~$ fg >/dev/null 2>&1
me:~$ fg >/dev/null 2>&1
me:~$ fg >/dev/null 2>&1
me:~$
fg >/dev/null 2>&1
shows up every time. Is there any way to make this binding "silent" so that no output is shown at all? Many guides use zsh or fish to achieve this kind of behaviour, but I wish to stick to bash.
>/dev/null 2>&1
prevents any output to the terminal, since I want this to be as seamless as possible. The space beforefg
prevents bash from keeping this command in its history. Again, I want this operation to be as "invisible" possible. – herophant Oct 1 '20 at 13:42fg<Enter>
can easily go just fine in your muscle memory so that you are no slower than hitting ctrl-z. – Enlico Oct 15 '20 at 11:43