使左右键在 KornShell (ksh) 命令行中工作
您能提供的任何更新都会很棒。
当我将其放入 .profile 中时:
set -o emacs
alias __A=`echo "\020"` # up arrow = ^p = back a command
alias __B=`echo "\016"` # down arrow = ^n = down a command
alias __C=`echo "\006"` # right arrow = ^f = forward a character
alias __D=`echo "\002"` # left arrow = ^b = back a character
alias __H=`echo "\001"` # home = ^a = start of line
alias __Y=`echo "\005"` # end = ^e = end of line
我可以使用向上/向下键查看历史记录。
但我想使用 vi 命令从命令提示符进行编辑。我知道 set -o vi
会做到这一点,但随后我失去了 set -o emacs
提供的向上/向下键功能。
底线是:我想使用上/下/左/右箭头键,并且我想使用 vi 命令从命令提示符进行编辑。如何做到这一点?
Any update you can provide will be great.
When I put this in .profile:
set -o emacs
alias __A=`echo "\020"` # up arrow = ^p = back a command
alias __B=`echo "\016"` # down arrow = ^n = down a command
alias __C=`echo "\006"` # right arrow = ^f = forward a character
alias __D=`echo "\002"` # left arrow = ^b = back a character
alias __H=`echo "\001"` # home = ^a = start of line
alias __Y=`echo "\005"` # end = ^e = end of line
I can use the up/down keys for history.
But I want to edit from the command prompt using vi commands. I know set -o vi
will do that, but then I lose the up/down key functionality provided by set -o emacs
.
Bottom line is: I want to use the up/down/left/right arrow keys and I want to edit from the command prompt using vi commands. How to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 .vimrc 点文件 禁用对特殊键的绑定,然后映射每个在正常模式下,从 默认 vi 键 到光标键的箭头运动尖括号表示法:
参考文献
Vim 参考手册:按键映射, 1.5:映射特殊键
Vim 默认
设置选项:附录 B - 学习 vi 和 Vim 编辑器,第七部分版本 - O'Reilly Media
未被识别为使用 PuTTY 的 VIM vimrc 中的变量如何映射中的转义尖括号(出现在
和
中的尖括号)Vim 基本技巧
Use a .vimrc dotfile to disable the bindings to special keys, then map each arrow motion from the default vi keys to the cursor keys in normal mode using angle bracket notation:
References
Vim Reference Manual: Key Mapping, 1.5: Mapping Special Keys
Vim Defaults
Setting Options: Appendix B - Learning the vi and Vim Editors, Seventh Edition - O'Reilly Media
<CR>
not recognized as variable in VIM vimrc using PuTTYHow to escape angle brackets in mappings (the ones that appear in
<esc>
and<cr>
)Basic Vim Tips