Monday, November 12, 2018

The Power Of Vim Text Editor!

The Power Of Vim Text Editor!

Vim is a small and light text editor. I feel I am in a different environment when using Vim. We will not find the menu bar as in the text editor that has optimized the GUI which can be operated easily.

Maybe, for those who have never used Vim, they will find it difficult when they first try. Or even, to write a character, you will feel confused. Yes, I also felt that.

To run Vim, we don't need a mouse to click, because all activities are done using the keyboard. Vim has various orders to do something.

Why is Vim difficult?

Difficult or not, depends on the knowledge that is owned by the user. When you already understand using Vim, maybe you will feel if this text editor is very cool.

Some advantages of Vim:

1. Does not require a mouse to be able to operate it.
2. Has a simple appearance and running on Linux terminal.
3. Very light even if used on old computers.

Install Vim on Ubuntu:

Open terminal and type this command:
sudo apt-get update
sudo apt-get install vim

In this application it is divided into several modes:

1. NORMAL Mode

In this mode it is the initial display when we open Vim or create a file via Vim. We will be in normal mode that contains a navigation. In this mode you cannot type a word or add a character to the file. But you can write a command.

So, when you have finished typing a code or word in Vim, to save, copy files, undo, redo and others, you must enter normal mode, after that, you can do those commands. To return to normal mode, you can press Esc.

2. INSERT Mode

When you want to write a program code, you must enter insert mode by pressing i on the keyboard. If on the writing menu at the bottom left there is the word "--INSERT--", it means you can type in vim.

3. VISUAL Mode

This mode is used to select a character or word. In visual mode, we can copy, cut, and paste. To enter in visual mode please press v and you can select the desired word or character.

These are some of the commands I use frequently, when using vim!

1. Make a File: vim hello.py or etc.
2. Insert characters: Press i on the keyboard.
3. Return to normal mode by pressing ESC.
4. v : To enter visual mode to select words or characters (in normal mode).
5. y : To copy characters in visual mode.
6. d : cut character.
7. p : To paste the characters copied in visual mode
8. u : Undo (in normal mode)
9. Ctrl + r : redo (in normal mode)
10. dd : To delete a single line file (in normal mode)
11. :w : to save files. If previously the file you wrote was not named, to save it, you can type the command :w (followed by the file name). Example: :w myfile.
12. :q : close the application
13. :q! : close the application without saving.
14. :wq : Save the file and close it.

The above command is only a small part that I often use in carrying out activities using vim. For other commands, you can learn through the manual that has been provided. May be useful.

No comments:

Post a Comment