Put vim to background

Everybody that uses vim knows that you sometimes will want to execute a couple of commands while you are editing a file. Maybe it’s to check certain things that you are writing about or someone else is bothering you in the process of writing some mastercode…
Whatever the case is you don’t just want to quit vim. Otherwise you might need to reload all those files into vim and reposition your windows again, etc.

luckily linux can be very handy in this case. When you are in command mode just press Ctrl+z and the job (vim) put the current job on halt. You can now start doing some magic in linux, and once you are finished use the folowing command.

$fg 1

The “1″ indicates the number of the job-process that was assigned to vim. If vim is the only job in the background it will be 1 but else you might want to check using:

$jobs

And that’s all for today. It’s not much but it saves a hell lot of time. You can use this for all of the jobs you run on your commandline. While I don’t use it that frequently as I can use multiple sessions with putty it might come in handy when you are working on a server terminal directly. For instance when you have network problems you run some netstat commands to analyse the network connections at the same time and let them all run in the background. In this case I do recommend you to redirect the output to different files as it would otherwise get scrambled through each other on your terminal. You will also have to indicate that these jobs need to run in the background using:

$bg 1

Where 1 is the id of the job that you needs to run in the background.
A message will always be send to the terminal indicating when a job was finished and it also mentions the id of the job and the command that invoked the job.

I’m still working on part 4 of perl and I don’t have lots of time in the weekend but once it will arrive. In the mean time I’ve become more accustomed to vim in general. I’ve found a great site explaining a lot about vim and it really pays of watching his movies.

About these ads

3 responses to “Put vim to background”

  1. Nele says :

    Great blog! I wish I had someone at work who knew so much about Linux commands as you do!! ;)
    Serious for a second, this is an inspiring post. :) Makes me want to try that right away.

    • shinryuu21 says :

      Thank you.
      Your reply inspires me to continue my blog again.
      Creating a user base that wants to read your work is very hard.

      • Nele says :

        Believe me, I know! I have like regular visitor and lately I think even he doesn’t visit my blog anymore.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: