realLifeinfo

working with text files in linux system vim editor

Nerd, Solutions 

We can easily edit text files in a Linux system by using one of these editors that are shipped with many Linux Distros. In this article i am going to talk about what you can do with VIM editor. This article will act as the basic introduction to VIM editor.

Sponsored

Starting Up With VIM text editor

VIM a text editor that is found in many Linux distros. We can use VIM to edit simple text file in Linux, to start VIM we use the command:

This command will start VIM program with the file that is provided by the filename as VIM command argument. When the argument is a name of an existing file, VIM command will open the file; but, if the provided argument is not an existing file VIM will create a new file with the name provided as the argument.

VIM editor has two mode: command mode and input or insert mode, when VIM start is starts with command mode running as the default mode. To start input text in VIM first we must type the command to tell VIM to allow text input.

These are commands that can be used to tell VIM what to do when in command mode:

And when VIM is in insert or input mode, it's going to display the word INSERT at the left bottom corner of the screen to let user know he or her is in insert mode. And to switch from input mode into command mode we use the escape key and to exit from execute mode we press escape key twice.

Moving around text file inside VIM

We can move the cursor inside VIM by using arrow keys, or we can use built in commands keys that have special functionality in VIM. 

Sponsored

Dealing with deleting, copying and changing text in VIM

There are commands that can be used to accomplish deleting, copying and changing characters or an entire line of text in VIM editor. Those commands are as follows:

The <?> after each letter in the preceding list identifies the place where you can use a movement command to choose to delete or change.

Example:

Sponsored

Any of these command above can be further modified by placing the number in-front.

 Existing, Saving and other miscellaneous commands.

To save your file and exit VIM program we can use one of the commands, depend on your intentions with the file.

Other commands that can be useful while using VIM program are:

VIM is one of the powerful text file editor that is found in many Linux distros. In order to be a Linux system power-user it's in your best interest to master this powerful text editor. These are some of the basics things you can accomplish while using this powerfully editor, you can dive deeper to learn more about this tool.

 

Sponsored