News
10th September 2015 | By:

Basic VIM Tutorial part 1

VIM is a text editor which is available almost on any platform, it’s versatility and advanced features can be used to edit files on remote servers using SSH connection.

History

VIM is the IMproved version of the VI editor, these text editors have a lot of history, combined together they have 65 years of history! The original author of VIM is Bram Moolenaar, nowadays the list of the authors has grown exponentialy and it become a major open source project. The first version of VIM was released roughly 23 years ago.

Basic Usage

VIM is console/terminal based application and is almost available on all linux/bsd/mac operating systems as a preinstalled application or through packages. You can also find a windows version of VIM. The source code and more is available on the official website of vim: http://www.vim.org/

Invoking vim is as simple as typing:

vim

You will be greeted with the following:

vim

To start typing a text you will need to press the i (i for insert). Try and add some text, once you are done with your text, let’s save it into a new file called ‘tutorial.txt’. VIM uses special key combinations in order to activate certain features. In order to enter the mode where you can type special commands you will need to press 2 key combinations

ESC :

You should now see your cursor at the bottom of your terminal waiting to enter a command!

The following command will write the contents of your text into a file named “tutorial.txt”

:w tutorial.txt <enter>

and this one will simply come back to editing mode.

ESC i

A lot of people are having trouble to quit VIM, they try the typical ESCAPE key or Q or simply pressing ALT+F4, well in VIM in order to quit you simply need to enter the special mode as previously and type the following command:

:q <enter>

VIM is also capable of editing files, you can edit files by simply invoking vim with a path to the file to edit

vim /home/me/tutorial.txt

Stay tuned for the next tutorial where we will be discussing some of the neat features of vim such as text selection, duplication and find & replace!

 

References: Photo by carsonfire

Tags: ,

Leave a reply

Your email address will not be published. Not now, not ever. Required fields are marked *

Comments


You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Name
Email
Website