max_xy 发表于 2005-5-29 14:38:16

关于VI里面的BACK SPACE键

为什么我在XTERM里用vi打开一个文件,敲BACK SPACE键,不是向后删除东西,而是向前删除?

我stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

假如我stty erase ^?
那么在这个SHELL里vi,一切就正常了。但是换一个shell,也就是重新打开一个xterm vi,还是老毛病,于是我把stty erase ^?放到~/.bashrc里,这样就好了。但是问题又来了,重启动后,机器进入不了XWindows,干掉stty erase ^?这句,就能启动了。

唉,请哪位高人指导一下,我GOOGLE了半天,找不到问题解决的方法

zhy2111314 发表于 2005-5-30 08:50:27

这个是否与vi的配置文件有关呢,试着看看/etc/vimrc,~/.vimrc这类的看看!

kornlee 发表于 2005-5-30 12:17:12

:set all

pslist 发表于 2005-5-30 13:44:21

在 .Xdefault 里编辑
*VT100.Translations: #override \
                <Key>BackSpace: string(0x7F)\n\
                <Key>Delete:    string("\033[3~")\n\
                <Key>Home:      string("\033[1~")\n\
                <Key>End:       string("\033[4~")
*ttyModes: erase ^?

更具体 请看
http://www.ibb.net/~anne/keyboard.html

如果是xterm 应该还可以在 /usr/X11R6/lib/X11/app-defaults
下面有个 XTerm
加入<Key>BackSpace: string(0x7F)\n\
在那一段里
(这个方法我没有试过)

shannleon 发表于 2005-6-14 11:44:56

vi中设置 set backspace=2 不管用吗?
页: [1]
查看完整版本: 关于VI里面的BACK SPACE键