Vi/Vim : Few mundane note about it
January 7, 2011 3 Comments
I am very much comfortable with vi/vim,because I ignore or lack of interest to learn Emacs(what a sin !!!!).Anyway I have been using it from the moment I started to working with open system years back.And I found vi/vim good enough for me to go ahead and do something productive.Specifically when I write script to enhance the systems and automate thing in the server and other places.You should glean over the resources section at the bottom of the post to know more.
I am going show your few very mundane trick to deal with vi/vim; oh yeah I do too…
#1 : Put the required thing in .exrc
When you install vi/vim it would not have all the facility you would like to have in it.Because it’s turned off.Now you can put the customized thing in this file so it can take effect when you fire the editor.You need to create this file in your home directory.It has got hell number of options available.My .exrc file looks like below:
1 se nu
3 se ai
Now you can put so many things in it ,those two entry is enough for me. And it suggest,the first one is for setting the line number and the second one is for autoindentation.You can put thing like set showmode,which show you the which mode you are in i.e insert or command et al. I would highly recommend you guys give a stab at it’s manual or online tutorial.
#2 : Encrypt file through vi/vim
Sound arcane? not worry I will explain it to you in a moment.On open system you can do same thing many ways,but the impact would be different.In this case,suppose you want password protect a file without going out of vi/vim then please follow:
You need to pass
vim -x filename
It will ask you for the key(which you might have created early),then please key in that key. Now second time it will ask you the same key to entered at the prompt below and you need to do that.Please see below:
bhaskar@bhaskar-laptop_10:57:49_Fri Jan 07:~> vim -x testencrypt
Now look at the bottom of the screen:
Now once I entered the key it will ask me to enter it again like below:
Once entered the same key the edition put me to the insert mode to enter the text. Ok,Once entered some text in it and save the file I am done with it.Now that particular file is encrypted with a specific key.Now it I try to open the file in vi/vim it will ask me to enter the key to get a view of that file like below:
Once I put the key it will open the file in that editor like below:
So ,I hope you got a clear picture about the encryption through vi/vim ,but having said that it is a very weak encryption ,please don’t depend on it.
Hope this will help.