Here is an Easy Guide to How to Use vi Text Editor. Nano is easy, fast to learn and good text editor, but ultimately you will need to learn vi. Yes, you can do Syntax Highlighting in Nano. But, practically that is the kind of end of Nano’s usage. Nano is not written for powerful text editing. This How to Use vi Text Editor guide will not make you a vi expert, but you can; at least use if Nano almost crushes with seg fault.
How to Use vi Text Editor : Basic History
In short, in POSIX, vi is the only one standard text editor which is actually made to work as default editor at kernel level.
Those who writes History, they neither understand anything, nor thinks how the text can feel to read. You’ll read the descriptions of vi’s History – it will appear, as if the person who wrote vi, is an old, fragile person now and has died. vi is nearly 40 years old but William Nelson Joy aka Bill Joy is actually quite known person and is living quite nicely! He is co-founder of Sun Microsystems.
American companies and some NEW Indian companies has no “owner” thing unlike traditional Indian and European companies, they often get acquired. Only Mr. Mukesh Ambani has personal property more than 20.0 billion USD. It is assumption. Know it clearly – Sir Ratan Tata is the richest person in this World, none can even come closer to him. Thereafter there are many peoples in the line. But none will ever claim.
That is exactly the philosophy of vi. vi does not make fearful with the power it has. We suggest to use Nano to the new SSH users, but; you have to use vi else you’ll become like Larry Page, sell peoples’ personal data – seg fault of Nano.
How to Use vi Text Editor
wget this webpage :
You can open with vi and on the other new terminal window with nano :
Download / Open the above image by Puppet Labs in full size
Move the cursor in both window. Not much difference, not really, move the cursor closer to (fsf) – when you are on “(“, the other “)” will get highlighted, indicating the logical end. Press any key – nano will take it, vi will reject. It is done to make sure – you are not unknowingly adding any text. A wrong keypress can add a bug. You need to press i in vi (close that window, there is no need), to enter the insert-text mode. You can escape the insert-text mode only by pressing Escape key, then you need to type
:w and press Enter or Return key to save. Adding “!” is forcing, like; if you do not want change it, you need to type
:w and press Enter or Return key, but it will prompt you – because you can do mistake of hitting
w are closer keys. If you want to write out and escape, thats easy –
:wq. That “:” and letters we added, are called ex commands. vi derived from ex and ed, two editors.
When we are not in the insert-text mode, we are in command mode. We can use – h, j, k, l. It is very easy to remember – just before the [:] key is [L]. in QWERTY keyboard, this is in one line. It takes time to get used with this small usage. Your eyes will get set with the appearance and presence of
-- INSERT -- after pressing
i. New users get bouncers – they type without pressing
on any unix system, if you write :
It is not exactly like the cat utility, it is basically opens in vi. But, when we open it, we run the
commands. Why commands? OK. Move the cursor to 3rd line and in command mode, type “:3d” and hit the return key – it will delete the above three lines. Can you do it on Nano? I do not want to know even if Nano has the function after 2 decades of using unix system. I will forget the other things! Anyway, deleting has lot of rules.
If, while editing, the system or file crushed (like your wife suddenly passionately kissed and SSH connection gone away; candy crush Facebook App invitation), you can recover it –
vi -r gpl-3.0-standalone.html
If anyone tell you – To insert a blank line below the current line, type o in lowercase) and to insert a blank line above the current line, type O in uppercase, it means –
: is already typed. There is undo too,
:u is undo. If you run multiple time, you will get some output like
1 change; before #1 09:05:34.
:x is Quit without change. Search forward is
/ followed by your thing to search then Return/Enter, search forward is ? . KEEP IN MIND – a also puts in insert mode in OS X. It frequently happens as I type my name somewhere, if the window remained active, that file takes something like –
bhishek. I think, we should stop here, it is enough for our reader’s basic need, you can read really good guide here :
After learning the basics, you’ll customize your vi :
There are lot of macros, lot of things around vi. Definitely, there is help text, you could not read before know these basics –