7

With my current workflow, I frequently use CTRL-z to suspend Vim so I can enter a quick few commands before resuming editing my code with fg (actually, it's CTRL-z again, thanks to the handy ZSH tip on this blog post). The issue is, my terminal ends up being cluttered with job suspension messages which is distracting from the output I wish to see.

Unwanted output:

[1]  + continued  vim

zsh: suspended  vim

The following screenshot shows what this can end up looking like in a standard session: enter image description here

So my question; is there a way to stop CTRL-z and fg printing any output?

  • 2
    I don't think so. You probably should consider using screen or tmux to avoid the problem altogether. – Otheus Jan 2 '16 at 2:12
  • “I could not find a solution, so I developed one on my own” ahem – Gilles 'SO- stop being evil' Jan 2 '16 at 3:14
  • 1
    Looking at the source, neither bash nor zsh seem to have a way to avoid these messages. – Gilles 'SO- stop being evil' Jan 2 '16 at 3:17
  • @Gilles That's unfortunate. Thanks anyway though, if you are sure then could you put this as an answer so I can mark it as solved? – JamoBox Jan 2 '16 at 9:47
  • 2
    why don't you run command from inside vim using :! your_command? – Jakuje Jan 2 '16 at 13:04
0

One way is to break the pipe. However, the progressing program cannot be called by fg anymore.

You can fist abandon the job to init by command disown -h JobID|PID after running bg JobID|PID. And then you can close the terminal.

The program won't stop. It will more like a daemon since then. However, it can't get anything from stdin and it's output to stdout and stderr will be neglect.

  • Although this didn't quite achieve what I wanted it does technically answer the question, so I'll mark this as correct. – JamoBox Dec 9 '17 at 13:49
1

I am not sure if messages for interactive sessions can be easily changed. But your problem can be solved as Jakuje suggests with a subshell from Vim. Instead of running your command, just :!zsh or :!bash and when you're done exit.

  • Of course you could map this in Vim to make it even easier than C-z and use C-d to exit the shell and return to Vim. – cxed Dec 4 '17 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.