# problem with HOME, END, DELETE, BACKSPACE and TAB keys



## presario (Jul 6, 2010)

Hello.

Is there a general fix to make these keys function naturally?
HOME - go to the start of the current line.
END - go to the end of the current line.
DELETE - remove a character after the cursor.
BACKSPACE - remove a character before the cursor.
TAB - insert a tab character in editor, (try to) autocomplete in shell.

Some of the problems I'm facing:
Home and End keys insert the tilde character (~) in shell and triggers the menu in ee.
Tab inserts tab character in shell.
Backspace also inserts a character inside VIM and LESS.

Thanks in advance.


----------



## soupbowl (Jul 6, 2010)

(Been Drinking)

I use ZSH and VIM configs from http://github.com/DaisukeAramaki/Configs (website) 

 Not all things you want are here, but some. They work for me and once you look things over, you can see that its not hard to get what you want from these.


----------



## fairy (Jul 6, 2010)

I think [thread=13950]correcting termcap[/thread] is the way to go.


----------



## SirDice (Jul 8, 2010)

set the correct TERM variable. If you use PuTTY set TERM to xterm.


----------



## itcotbtoemik (Jul 21, 2010)

*PuTTY vs xterm for $TERM*

PuTTY's behavior doesn't match xterm.
ncurses has a "putty" terminal description,
which does match the default settings for PuTTY.


----------



## SirDice (Jul 21, 2010)

itcotbtoemik said:
			
		

> PuTTY's behavior doesn't match xterm.


Set Home and End keys to rxvt. Everything else can stay default. Works like a charm.


----------



## itcotbtoemik (Jul 22, 2010)

*PuTTY vs xterm and rxvt*

Actually, all three (PuTTY, xterm and rxvt) have different key bindings.
PuTTY happens to be closer to xterm by default; I see that it has a
selection for home/end keys marked "rxvt", but haven't verified if it
is correct.


----------



## freethread (Jul 22, 2010)

This work for me

*PuTTY configuration*

Set terminal-type string to *xterm*.










*tcsh key bindings*


```
## Del
# Delete key (see FreeBSD FAQ on keyboard and mouse)
bindkey "\e[3~"   delete-char              # xterm

## Home & End
# Home and End keys for XTerm compatible console
bindkey "\e[1~"   beginning-of-line        # xterm
bindkey "\e[4~"   end-of-line              # xterm
```

In GNU screen (with $TERM set to xterm) the _End_ key in midnight commander does not work (do nothing), it binds to ESC[4~ but does not work.

See also these links:
FreeBSD FAQ - Keyboards and Mice
Consistent BackSpace and Delete Configuration


----------



## fairy (Jul 24, 2010)

Making applications recognize your function keys (Delete, HOME, END, etc) is one of the purposes for termcap/terminfo databases. If you need to bind a key (e.g. Home, *\e[1~*) only in one terminal emulator while others work fine then you're doing it wrong and you'd end up having to make same keybind in *every* application under such terminal emulator.


----------

