Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何使在bash中跳过单词的ctrl箭头与特殊字符一起工作?_Linux_Bash_Shell_Input_Zsh - Fatal编程技术网

Linux 如何使在bash中跳过单词的ctrl箭头与特殊字符一起工作?

Linux 如何使在bash中跳过单词的ctrl箭头与特殊字符一起工作?,linux,bash,shell,input,zsh,Linux,Bash,Shell,Input,Zsh,我发现使用ctrl-arrow可以非常方便地跳过单词。 但是,由于某些原因,空间后的特殊字符使得跳跃忽略了空间。例如(ctrl+left在箭头和|之间按下表示航向的位置) command-flag/home/path |->command-flag/home/| path->command-flag/| home/path ->命令-|标志/主/路径->|命令-标志/主/路径 这种行为让我非常恼火-您知道如何设置它,使光标停在每个单词的开头,包括特殊字符吗? 预期行为示例: command-f

我发现使用ctrl-arrow可以非常方便地跳过单词。 但是,由于某些原因,空间后的特殊字符使得跳跃忽略了空间。例如(
ctrl+left
在箭头和
|
之间按下表示航向的位置)

command-flag/home/path |->command-flag/home/| path->command-flag/| home/path
->命令-|标志/主/路径->|命令-标志/主/路径

这种行为让我非常恼火-您知道如何设置它,使光标停在每个单词的开头,包括特殊字符吗?

预期行为示例:

command-flag/home/path |->command-flag/home |/path->command-flag |/home/path
->命令|-flag/home/path->|命令-flag/home/path


我个人使用的是zsh+linux,但我希望有一个独立于OS/shell的解决方案。

光标移动完全依赖于shell;shell在提示符处处理输入
bash
使用GNU
readline
zsh
使用自己的行编辑器
zle
。此外,您的终端仿真器将决定哪些密钥可用;控件箭头需要在该级别进行配置,以发送shell可以解释的适当字符序列。可能-但它现在在bash/zsh/chrome/firefox中的行为方式相同。我对zsh的解决方案感兴趣。@chepner遗漏了一个警告:shell决定单词的组成字符。如果bash和zsh在给出的示例中同意这一点,这很好,听起来好像OP在询问vi模式),但我们不能指望这一巧合。请参阅。