If I do this from the shell:$ sleep 100I can make it go to the background by doing:^Z$ bgAnd then continue using my shell. You can get the same effect by adding a & to the end of the command, but I often forget this.In Vim, I often do::!sleep 100And here also, I often forget to add the &. Can I put this process in the background and continue using Vim like in the shell?
Put a process started with ! in the background
external command;unix
Note: This answer only seems to work with the tcsh and fish shells. I also tried bash, dash, mksh, and zsh, and it doesn't work there; I'm not sure why, because if I do the same actions from these shells without Vim, it does work as expected... (:! commands are executed though the shell).I happen to use tcsh, so it works for me...You can use :set shell=/bin/tcsh to set your shell; this is global, though. So only use it if you think this is a very important feature :-)^Z send a SIGTSTP signal, you can send this signal with kill, and then use SIGCONT to continue (resume) the process. This will detach the process from Vim.Because it's difficult to show with this sleep (how do you know it has continued execution?), I'll use gitk as an example (but any GUI program will do):For example in Vim::!gitk %And then in another terminal:$ ps ax | grep gitk30105 pts/10   S+     0:00 -bin/tcsh -c gitk30108 pts/10   Sl+    0:00 wish /sbin/gitk --$ kill -TSTP 30108$ kill -CONT 30108You can of course also use killall, or pkill; for example:$ killall -TSTP wish$ killall -CONST wishYou do need to open another terminal for this, which is not ideal, but it will allow you to continue using both your Vim and your external process.