Backspace problems

Scott Mayo sgmayo at mail.bloomfield.k12.mo.us
Tue Jun 12 17:22:20 UTC 2007


doug wrote:
> On Mon, 11 Jun 2007, Scott Mayo wrote:
> 
>> I am not on any VI list, but thought I would post this here to see if 
>> anyone had any ideas.
>>
>> This is my first FreeBSD server, so I am still learning.
>>
>> I got my backspace and delete working the shell after a few 
>> adjustments, but they still act odd in VI.  I have checked setting 
>> with my linux boxes (the backspace and delete work fine there) and 
>> everything looks the same.  I did an stty -a | grep erase and it tells 
>> me that erase is Contral-? and erase2 is control-H.  I have changed 
>> both around to make them either Ctrl-? or Ctrl-H, but that has not 
>> helped.
>>
>> If I hit backspace it just backs up on the line until were input-mode 
>> was started during this input-mode session.  If I hit delete then it 
>> capitalizes the charcter behind the cursor and throws me into 
>> command-mode.
>>
>> I am not sure if there are anymore settings to change in FreeBSD or if 
>> it is a setting in VI.
>>
>> Any help would greatly be appreciated.
>>
> Scott, my stty -a:
> 
> cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
>         eol2 = <undef>; erase = ^H; erase2 = ^@; intr = ^C; kill = ^U;
>         lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
>         status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
> 
> IMO redefining keys is not a good thing if you are learning UNIX and vi. 
> In the default setup (I use tcsh for an interactive shell) ctrl-h is a 
> backspace and functions on the command line like the backspace key, 
> i.e., deletes the char to the left of the cursor. In vi the delete-key 
> == x in command mode (by default). The [del] key does not work on the 
> command line.
> 
> I would advise getting comfortable with the default settings before 
> branching out. Key bindings and /etc/termcap changes have lots of 
> ramifications. vi is as it is because it was written when systems were 
> line oriented. The 'hjkl' are where your fingers sit if you are a touch 
> typist, and hence were chosen for that purpose. As late as 1995 vi on 
> BSDI (where I start on the BSD trail) did not support the cursor keys 
> very well.
> 
> I have attached a vi cheat sheet that I found years ago. This is a 
> pretty good starter set of commands for vi.
> 
> vi is not even as bad as it gets. vi is in /usr/bin so if your system is 
> really broken and you must edit something ed is the tool available in 
> FreeBSD.
> 


Thanks for the info Doug.  A friend of mine set me on the right path.  I 
have been using vi in linux, except it was not vi.  Vi was aliased to 
vim.  I had installed vim on my FreeBSD server the other day, but that 
did not fix it.  I found out that it has to be run with 'set nocp' so 
that it does not run in vi compatibility mode.

I did this and now my backspace and delete work like I want them to. :)

I appreciate the replies.

-- 
Scott Mayo
System Administrator
Bloomfield Schools
PH: 573-568-5669
FA: 573-568-4565
Pager: 800-264-2535 X2549

Duct tape is like the force, it has a light side and a dark side and it
holds the universe together.


More information about the freebsd-questions mailing list