在 vim / MacVim 中使用 SHIFT+箭头选择文本
MacVim 中更好的功能之一是可以使用常用的操作系统命令在其中复制和粘贴文本(即 command+C 和 command+V)。
当您一分钟前在另一个编辑器中工作并且您的大脑尚未准备好建议您的手指如何输入真实内容时,这尤其有用。
然而,我的大脑需要思考一件事:它是文本选择模式。在非 vi 编辑器中,我会使用 Shift+Arrow 来执行此操作,但在 MacVim 中尝试此操作不起作用。但另一方面,我认为 Shift+Arrow 也没有被用于其他用途。是否可以重新映射按键以使这成为可能?
(理想情况下,编辑器在选择文本后仍处于插入模式;这样可以节省一些额外的击键。)
One of the nicer features in MacVim is that it is possible to use the usual OS commands for copying and pasting text (namely command+C and command+V) in it.
This is especially nice in situations when you’ve worked in another editor just a minute before and your brain isn’t ready yet to advise your fingers on how to type the real thing.
However, there’s one thing my brain needs to do quite a little thinking on: It’s the text selecting mode. In non-vi editors, I’d use Shift+Arrow for this and trying this in MacVim doesn’t work. But on the other hand it does not look to me that Shift+Arrow is being used for anything else either. Is it possible to remap the keys in order to make this possible?
(Ideally, the editor would still be in insertion mode after having selected the text; that would spare some additional key strokes.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从手册中:
From the manual:
作为对自己的注释和对其他人的巧妙提示:
由于 SHIFT+箭头选择和鼠标选择现在自动启动
SELECT
模式,这意味着制作VISUAL< /code> 使用鼠标或箭头键进行选择。 (即使已经处于
VISUAL
模式,鼠标选择仍然会触发SELECT
模式。)因此,每当有人想要对选择应用命令时,以下方法会有所帮助。ESC
取消选择gv
自动重新选择之前的选择并触发VISUAL
模式编辑:只需使用 CTRL + g 即可完成相同的操作。
As a note to self and a neat hint for others:
Since SHIFT+Arrow selection and mouse selection now automatically starts
SELECT
mode, this means that it is apparently not as easy to make aVISUAL
selection by using the mouse or arrow keys. (Even when already inVISUAL
mode a mouse selection will still triggerSELECT
mode.) Therefore, whenever one wants to apply commands to the selection, the following method helps.ESC
gv
to automatically reselect the previous selection and triggerVISUAL
modeEdit: Same can be done using simply CTRL + g.
在 neovim 中,您只需将 selectmode 设置为
mouse,key
:in neovim, you just set selectmode to
mouse,key
: