How to map Delete and End keys on tcsh shell?

China☆狼群 提交于 2019-12-05 16:54:18

问题


I use tcsh , and when Delete/End is pressed on cmd line, it simply shows up as ~ ; I have to press <Ctrl><e> to go to end of line. Can anyone help me to be able to use Delete/End keys as their name suggests ?


回答1:


Those keys already worked on my Debian system. I found these commands in the /etc/csh.cshrc file:

if ($?tcsh && $?prompt) then
        bindkey "\e[1~" beginning-of-line # Home
        bindkey "\e[7~" beginning-of-line # Home rxvt
        bindkey "\e[2~" overwrite-mode    # Ins
        bindkey "\e[3~" delete-char       # Delete
        bindkey "\e[4~" end-of-line       # End
        bindkey "\e[8~" end-of-line       # End rxvt
endif



回答2:


You need to use the bindkey builtin. See the tcsh man page discussion for details (search for 'bindkey'), but you want to add a line like

bindkey [end] end-of-line

to your .cshrc or .tcshrc file, replacing '[end]' with the actual end keypress. See this page for the list of binding names and helpful examples.




回答3:


There's a great resource on fixing inconsistencies with delete/backspace here. The document also addresses mapping home/end, though that's not the focus.



来源:https://stackoverflow.com/questions/1912328/how-to-map-delete-and-end-keys-on-tcsh-shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!