What Will I Learn?
- You will learn how to install VIM
- You will learn how to use VIM
- You will learn technical information about VIM
Requirements
- Basic knowledge about Ubuntu / Linux
Difficulty
- Basic
Tutorial Contents
Installation Steps of VIM
Open a terminal or login to the remote Ubuntu server utilizing the ssh client. Sort the following apt-get command to set up vim text editor (when encouraged type your very own password):
or:
Sample outputs:
You can now use vim text editor:
Fig.01: Vim in action on Ubuntu
What's Vim, and Why Do I Want It?
Vim is the editor of choice for many developers and power users. It's a "modal" text editor based on the vi editor written by Bill Joy in the 70s to get a version of UNIX. It inherits the key bindings of vi, but additionally adds a whole lot of functionality and extensibility which are missing from the first vi.
What the hell do we mean by modal? Whenever you're using most word processors and text editors, the alphanumeric keys (i.e., a through z, 1 through 9) are only utilized to input those characters unless they're altered by means of a control key. In Vim, the mode the editor is in determines whether the alphanumeric keys will input those characters or move the cursor throughout the document.
For example, several text editors and word processors require you to use the mouse to click on a menu item or icon, or even use the Ctrl-s hotkey combination, to store a file.
If that sounds complicated, it's not--however it could take a little getting used to, such as driving a manual transmission instead of an automatic. Therefore, why do you would love to know Vim? Though Vim is my favorite editor, I'll be quite blunt: you might not wish to. If you're never going to do some system administration or heavy editing of text, and if you don't wish to spend any time in learning the capabilities that Vim has, then learning Vim might not be the best use of your time.
And on the other hand, if do any one of the following, you probably want to look into Vim:
- Substantial editing of plain text files
- System administration
- Programming
- Working with HTML, LaTeX, or other markup languages
Though Vim is not as easy to use originally as conventional GUI text editors such as Gedit or word processors like OpenOffice.org's Writer, over a longer term you can become more productive using Vim. If you're a touch-typist, you'll find that your speed will improve even more with Vim since your hands rarely need to leave the "home" keys--and you'll only need to use the mouse if you choose to do so.
System administrators will need to know at least a tiny Vim/vi to get by simply because it's the editor more than likely to be on some given *nix system which you will need to work on. Vi is the lingua franca of system administration.
The Basics of Moving in Vim.
The very first thing you will want to learn is how to move around a document. When you are in command mode, you will want to remember the following keys and what they do:
- h moves the cursor one character to the left.
- j moves the cursor down one line.
- k moves the cursor up one line.
- l moves the cursor one character to the right.
- 0 moves the cursor to the beginning of the line.
- $ moves the cursor to the end of the line.
- w move forward one word.
- b move backward one word.
- G move to the end of the file.
- gg move to the beginning of the file.
- `. move to the last edit.
Editing Vim Style
Now that you simply skills to maneuver around a small amount, let's strive writing. Move the indicator to the start of a word. Now type x. What happened? you must have deleted the character that the indicator was on. need to undo it? No drawback. kind u (for undo) and it'll be improved.
Want to delete a complete word? Move your indicator to the start of a word once more. Use dw. Note that this can solely delete the word from the indicator on--so if you've got the indicator within the middle of a word, it'll solely delete from that time on. Again, u can undo it. Note that Vim has multiple levels of undo, thus you'll undo the amendment before that and also the amendment before that, etc.
Want to undo your undo? Hit Ctrl-r. which will redo your last undo.
Again, here's a extended list of the commands you may positively need to understand beginning out:
- d starts the delete operation.
- dw will delete a word.
- d0 will delete to the beginning of a line.
- d$ will delete to the end of a line.
- dgg will delete to the beginning of the file.
- dG will delete to the end of the file.
- u will undo the last operation.
- Ctrl-r will redo the last undo.
Curriculum
GitHub Link : https://github.com/vim/vim
Posted on Utopian.io - Rewarding Open Source Contributors