vi or vim
for redhat based systems this doesn’t in any ways pose a difference as both vi and vim are on and the same thing (for more technical vi is aliased to vim).
but if you go to the other variants like debian or slackware these two software do show a difference in terms of evolution vi is what vi was and vim is what we always wanted vi to be.
so here I am presenting some more tips and tricks for better working inside vim
NOTE : most of these option work only in the command mode of vim until and unless explicitly specified
1) :sp <file_name>
split window splits the active vim window into two parts ….. if <file_name> is specified then in that case that particular file is being opened in the other half otherwise the same file is opened…….
2) this split windows can be easily managed by use of CTRL+W
3) :! <command>
this is a very useful option if you don’t want to leave the vi window and yet wish to work on command line for some help or other thing.
4) :set nu
this option can be a real timesaver when looking for errors
this gives number to each other.
5) :set ai
real timesaver for the programmers ai stands for auto indentation and not artificial intelligence 🙂
6) :set tabstop=x
this yet is a programmers help ,
let you specify the tab stopping which is by default 8 spaces
which can now be changed to x spaces
7) .vimrc The default config for your regular sessions.
if you wish to keep some options as constants what you can do is that you can just put all your general commands in a script file at ~/.vimrc………….
8 ) / for forward searching and ? for reverse searching….
9) most of us who are familiar with vi learned dd yy p and the basic commands
but P is also a paste facility with just one difference…..
when you use p you paste below the current line while P paste above the current line……..
10) sometimes you don’t want to change the binary data in a file or you have to work on binary files try
vim -b <file_name>
we usually go on undoing stuff with “u” but what for redo….
CTRL + R is for the rescue…….
besides these if you are a programmer then you can leave aside the conventional “no file extension also works philosophy” asides just because this gives you a upper edge in vim with a proper syntax highlighting.
I HOPE THESE TIPS HELP YOU SOMEDAY