10th September 2015 by aegeuana_sjp_admin
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.
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.
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:
You will be greeted with the following:
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
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.
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:
VIM is also capable of editing files, you can edit files by simply invoking vim with a path to the file to edit
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