Vi is an old screen-oriented text editor , the first release of this software is dated back in 1976, originally created for the Unix operating system.
What I like of
vi is that I can find it in any Linux and Unix system I’ve to work, so once I learnt how to use it I’ve used it everywhere, but there is small problem the software is user-friendly as could be a software wrote in 1976, so many new users find really hard to understand the shortcuts and so after some small test they decide that the software is too hard and return to some graphical editor like gedit, leafpad or perhaps libreoffice.
With this article I want to give some useful information for people who have never used Vi.
Note: in general I use
Vim (V IMproved) on all my systems, so I’m sure that all the following tips work with this software, if you use the classic
VI some of the tips could not work.
Step 1 The base.
VIM Adventures is an online game based on VIM’s keyboard shortcuts (commands, motions and operators). It’s the “Zelda meets text editing” game. It’s a puzzle game for practicing and memorizing VIM commands (good old VI is also covered, of course). It’s an easy way to learn VIM without a steep learning curve.
You play a blinking cursor appearing one day in a semi text based world inhabited by little people but ruled by bugs. You soon discover that your arrival was foretold by an old prophecy and that you’re expected to restore order to the world.
Step 2 The base part 2
Ok, i can understand that perhaps learning
Vi shortcuts in a flash game may not be suitable for all, or perhaps you think that this is not a kind of study your Boss will likes, so the following is the list of some more traditional guides and tutorial on vi:
And if you prefer something more interactive (no game this time):
Step 3 The Cheat sheet
At this point you should know some of the shortcuts available in
vi, and you could start to think “How will I remember all of these commands ?”, don’t worry anymore there is a nice graphical cheat sheet available (in colors !) that you can print and keep next to your keyboard, you can find it in the website: http://www.viemu.com
There you can find a single page describing the full vi/vim input model, the function of all keys, and all major features. You can see it as a compressed vi/vim manual.
Step 4 Get the full control of your vimrc file
Vim’s settings are stored in a configuration file called .vimrc which is located in your profile’s home directory. You can add dozens of excellent features to Vim by making some very simple changes in this file – only one problem, you have to do a lot of reading to figure out which settings to enable, but I’m here for this these are some useful settings that i use in my .vimrc:
set statusline=%F%m%r%h%w [%03.3b] [%02.2B] [%04l,%04v][%p%%] [%L]
The statusline at the bottom of the window is handy little tool to show all kinds of information about the file and the character where the cursor is located.
This shows, from left to right:
- file name
- is the file modified or not flag
- readonly flag
- flag for indicating if the window is for help
- same for preview
- value of the char under cursor in decimal
- same in hexadecimal
- line number where the cursor is
- and virtual column number
- cursor position in buffer in percentage
- number of lines in the buffer
syntax onEnable syntax highlighting
set numberDisplay line numbers on the left
This will highlight matching parens, some people dislike this option that it’s become a defualt in some Distributions, if you want to disable this feature you can use
set noshowmatch .
And these are some useful links to get more .vimrc information and examples:
And the dedicated blog:
VI Improved Tips :: vimrc dissected
- Linux game: Garry’s Mod
- Check how much do you type with WhatPulse on Linux
- Linux Terminal: Reptyr attach a running process to a new terminal
- Zorin OS Contest Results
- Linux Terminal: speedtest_cli checks your real bandwidth speed.
Find me on Google+