当次删除操作,可以用【ctrl+w】以词为单位删除。一劳永逸的解决办法需按下面进行,二选一。
vim/vi下退格键出现^? (bash下)
编辑 .bash_profile 文件,添加一行 stty erase ^? 到最后。执行如下:
vi ~/.bash_profile
stty erase ^?
vim/vi下退格键出现^H(csh下)
编辑 .cshrc 文件,添加一行 stty erase ^H 到最后。执行如下:
vi ~/.cshrc
stty erase ^H
----------------------------------------------------------------------------------------
p.s.:bash下 检查修改是否成功,输入命令:
stty -a
输出为:
speed 38400 baud; rows 50; columns 126; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <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 -cdtrdsr
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel -iutf8
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
发现值 erase = ^?; 已经修改成功。