How to move the cursor by word in command line of tcsh

做~自己de王妃 提交于 2019-12-24 10:58:45

问题


I am stucked by this for a long time. How can I move the cursor in the command line of tcsh, as did by ctrl + arrow in vim editor, ipython shell, firefox, word etc. All these above can do this nicely, excetp tcsh, which is really frustrating.


回答1:


Try Escb and Escf.

For future reference, non-programming-related questions like these may be more appropriate at SuperUser.




回答2:


tcsh has key bindings to mimic VI-style editing commands. Just put this in your ~/.cshrc file:

> bindkey -v

You can then begin vi-style editing of previous commands by hitting esc. Then, use "k" or "j" to scroll backward/forward in the command history. Use word movement keys "b" or "w" to move backward/forward one word. Use "cw" to change a word, etc. When done, hit ret (from anywhere in the command line) to execute the new (edited) command. For example:

> bindkey -v
> echo a b c d
a b c d

At this point, type 'esc k b' to recall the previous command and move back 1 word. Then type "cw z esc" to change the word "c" to "z". Then hit ret to execute the new command and get:

> echo a b z d
a b z d
> 

Enjoy!

Alan Thompson



来源:https://stackoverflow.com/questions/13089573/how-to-move-the-cursor-by-word-in-command-line-of-tcsh

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