&是什么QUOT;设置键盘映射六"做? [英] What does "set keymap vi" do?

查看:126
本文介绍了&是什么QUOT;设置键盘映射六"做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想VIM般的导航为我的终端,所以我说:

 组编辑模式VI
设置键盘映射六

要我 .inputrc文件根据这个文件。 编辑模式VI 补充六导航。这是什么键盘映射VI 做的,为什么我需要它?


解决方案

男人的readline (我的重点):

<块引用>设置的法律键盘映射名称是emacs的,emacs的标准,与Emacs元,emacs的-CTLX,VI,VI-举动,VI-命令,六插入。 六等同于VI-命令

因此​​,在你的 INPUTRC 您可以指定不同的模式不同keybinds,因此,例如,命令模式下,你可以抽出从previous命令<大骨节病>替代 <大骨节病> p ,但这个热键绑定会在插入模式(在这个简单的设置反正):

 组编辑模式VI一套键盘映射VI-命令
#这些都为VI命令模式
\\ E [A:历史记录的搜索向后
\\ E [B:历史记录的搜索前进
\\ EP:使劲-最后ARG一套键盘映射VI插入
#这些都为VI-插入模式
\\ E [A:历史记录的搜索向后
\\ E [B:历史记录的搜索前进
控制-L:清屏

I wanted vim-like navigation for my terminal, so I added:

set editing-mode vi
set keymap vi

To my .inputrc file based on this. editing-mode vi adds vi navigation. What does keymap vi do, and why do I need it?

解决方案

From man readline (my emphasis):

The set of legal keymap names is emacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command, and vi-insert. vi is equivalent to vi-command

Thus, in your inputrc you can specify different keybinds for the different modes, so, for example, in command mode you could yank the last argument from the previous command with Altp, but this keybind would have no effect in insert mode (in this simple setup anyway):

set editing-mode vi

set keymap vi-command
# these are for vi-command mode
"\e[A": history-search-backward
"\e[B": history-search-forward
"\ep": yank-last-arg

set keymap vi-insert
# these are for vi-insert mode
"\e[A": history-search-backward
"\e[B": history-search-forward
Control-l: clear-screen

这篇关于&是什么QUOT;设置键盘映射六&QUOT;做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆