1834770 Members
2901 Online
110070 Solutions
New Discussion

# in vi.

 
SOLVED
Go to solution
Greg Conn
Advisor

# in vi.

I have a weird one. This just started for me. When I vi a file and try to put a # in the file, it wont let me. Any ideas?
12 REPLIES 12
Jim Moffitt_1
Valued Contributor

Re: # in vi.

What do you mean it won't let you? when you put the # does it give you an immediate response? Do you have your caps on?
Robert Hoey
Advisor

Re: # in vi.

Greg,

I would double check that your TERM environment variable is set correctly. I have never seen this before, but if it happened to me, that's what I would check. Also, verify that those keys (Shift, 3) on your keyboard work.

I apologize if I am stating the obvious.

-Rob
Stefan Farrelly
Honored Contributor
Solution

Re: # in vi.


Things to try;

1. use another terminal window to vi the file. Sometimes terminal windows do crazy things and need a restart.

2. Can you insert a # manually but doing;
echo \\043 >> then vi the file and you can see the # character ? then you can move it.

3. Check your keyboard mapping and terminal setup.
Im from Palmerston North, New Zealand, but somehow ended up in London...
A. Clay Stephenson
Acclaimed Contributor

Re: # in vi.

Hi Greg, Dollars to donuts you have set the 'erase' key to '#'. That is leftover from the very old days of unix when rather than entering a backspace you enter a '#' to erase (strikeout) the character.

You almost certainly have an incorrect TERM setting. If the problem persists after you exit vi then you can test the problem using the 'stty' command.
If stty reports that erase=# then that's your problem. You should then be able to do a
stty erase '^H' to set erase back to a backspace.

Regards, Clay
If it ain't broke, I can fix that.
Vincenzo Restuccia
Honored Contributor

Re: # in vi.

Check your keyboard in /etc/kbdlang
Greg Conn
Advisor

Re: # in vi.

Only happens on one box. Term is set right and everything else looks good. Weird! I will switch out keyboards and see what happens. Thanks, Greg
Greg Conn
Advisor

Re: # in vi.

I inserted it manualy and then I reset it using stty. Great job guys!
Greg Conn
Advisor

Re: # in vi.

When i reset it using stty and log out and then in it did not stay. Where should I check to set it perm?
A. Clay Stephenson
Acclaimed Contributor

Re: # in vi.

You can set in your .profile.
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: # in vi.

Hi Greg:

The appropriate place to set it is in the $HOME/.profile

You will see the standard issue .profile already accomodates 'stty' commands.

...JRF...
Greg Conn
Advisor

Re: # in vi.

Why do I have to do this? Is there a bigger configuration problem somewhere? Putting it in the .profile did work. Thanks.
MANOJ SRIVASTAVA
Honored Contributor

Re: # in vi.

Hi Greg

This is not a bigger config problem . It is just a matter of the env variables . It can be possible that stty erase has been set to # in the same .proifle at the start of the file and you are just restting it . But in no case this is a bigger config problem . Dont worry at all.

Manoj Srivastava