Setting the backspace key functionality in VIM

Vi Back space does not work ??

Setting the Backspace Key

For the backspace key, it isn’t quite as easy. The problem here is that there are two common backspace codes: backspace and delete. One is ^H, the other is ^?. If you are having problems it is because your terminal program choose the one the system didn’t. The default cluster login scripts set it to ^H. One solution is to change the setting in the local terminal emulator. However there are many possible emulators and we can’t support them all. So, to fix this on the UNIX side, you have to type the following at the shell prompt:

stty erase ^v<press backspace key right after typing ^v>

The ^v (control – v ) is the “quote character.” It keeps the shell from interpreting the next keystroke. This is necessary because some shells are smart enough to realize that either ^H or ^? should be treated as the backspace character, but some programs don’t (like mail, vi…).

If the problem persists try one of the following:

put the following lines into your .vimrc or type them in the vi commnad mode

set nocompatible bs=2

set backspace=start,eol,indent

set backspace=2

How to set the tab spacing in vi

set tabstop=x

x is the number of spaces that tab should introduce

How to highlight multiple words in VIM:

http://vim.wikia.com/wiki/Highlight_multiple_words

The above link provides an excellent way to highlight multiple words in vim. It is easy to setup, use and to extend the functionality provided.

How to use / without \ in a search string

Are you sick of using escape character “\” while searching-replacing a long string with ‘/’ in them? Then here is the solution

suppose you want to replace all ‘/’ with “.” in a long string like “soc_tb/smca/par_glm1/pcs_cdu_glm1/pcs_cdu_glm1_plm/plm/mux_body/all_disable”

Instead of doing the following

s/lskdfj\/adf\/Dafd\/adfafdf\/g

do this

s#lskdfj/adf/Dafd/adfafdf#g

VIM does not require you to use “/” for search and replace. So instead of this

s/old/new/g

you can use any other character. I prefer “#”. So this is what I do

s#old#new#g

The advantage is that now you can freely use “/” in your string without worrying about escape character “\” madness