Ubuntu: Working with text editor (vim)

19 Mar

If you are following my blog, you will find my last few articles are on Ubuntu.

Yeah, that’s where I am working now.

I’ve installed Ubuntu and working to have some knowledge, coz I’m going to develop my own extension for php in next few weeks.

Before going to get my hands dirty with extension development, I will need to get a bit used to the Ubuntu. I have already learnt some commands like how to install and update apache, php and other stuff. However until now I was unable to write something using any text editor. Thought I tried to use text editor by going to Application/Accessories/Text editor, however I was unable to create document other than my home directory. So I decided to use vim. I is never an easy job to work with vim if you are newbie.

Let’s tell you what I have learnt so for.

  1. To open a file you will need to write the following command in you shell terminal.

$ sudo vim /etc/resolv.conf

The above command will open if file already exist or will create new one.

  1. To make changes to the file you will need to press “Insert” key of your keyboard.
  2. You can use arrow keys to move left, right, up and down. You can use h, j, k, l for this purpose too.
  3. Once you write something in the file. Press “escape” key. This will take you to the command mode. Its necessary to go to the command mode for saving the document.
  4. After pressing the “escape” key, press colon(:). This will take you to the end of the file.
  5. write :wq for save and quite. And press enter at the end.
  6. you can you use i for going to “insert” mode and a for append mode.

That’s it for now. Hopefully I’ll learn more next time and will share with you too.

5 Responses to “Ubuntu: Working with text editor (vim)”

  1. Pablo Morales March 19, 2009 at 6:42 pm #

    You can replace the key combination :wq for😡

    Cheer

  2. Pablo Morales March 19, 2009 at 6:44 pm #

    You can replace the key combination :wq for : x

    Cheers

  3. Ahsan Shahzad April 13, 2009 at 11:32 am #

    Great to know that you are going to build PHP extension. Definitely it will be a great plus for your career🙂.
    Best of Luck!

  4. Allen Li June 22, 2009 at 11:00 pm #

    You only need sudo if you’re editing a restricted file that needs root permission. Most of the time, vim alone will do the trick.

  5. Uniq information August 19, 2009 at 2:50 am #

    Why there are people posting this kind of data (it’s not information).

    You search things usefull and fall in places with stupid duplicated data

    please

    run vimtutor and don’t publish every page.

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

%d bloggers like this: