LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Vim editor suspending/background process (https://www.linuxquestions.org/questions/linux-newbie-8/vim-editor-suspending-background-process-4175618974/)

goofygoober 12-04-2017 07:22 PM

Vim editor suspending/background process
 
Hey there! I'm looking for a command to background my VIM sessions.
I know about CTRL+Z.

Doing this then typing jobs gets me [1]+ Stopped
Is this suspended or in the background? i'm assuming suspended.

Using bg %1 gives me stoud of:
[1]+ vim hw8 &
but after typing jobs I still get:
[1]+ Stopped


TLDR; How can I suspend and then place a vim session into the background?

!j* 12-04-2017 07:36 PM

Vim editor suspending/background process
 
I think the reason is that VI is continuously reading your commands. So it doesn't make sense to put it in the background. I think it will just complain that it wants input. Better explanations will likely come along.

aragorn2101 12-06-2017 03:30 AM

Hi,

Normally, Ctrl+z will stop a job and bg %1 will put that job in the background.

Vim takes up a terminal/tab by default. Now, since vim is by default in the foreground, in this case Ctrl+z will stop it and automatically put it in the background in order to return control to the terminal to the user. So, in case of vim running in a terminal, Ctrl+z is analogous to Ctrl+z; bg %1.

Now, jobs will display all the tasks, running or stopped. That's why you get that output. Since vim is already in the background, you can bring it to the foreground by using fg %1, then put it in the background again using Ctrl+z.

I hope this helps.


All times are GMT -5. The time now is 05:56 PM.