设置粘贴切换不起作用
我的 vim 设置( https://github.com/aaronjorbin/.vim )包含 set astetoggle=
而 fn+F2(当 vim 在终端中运行时)会导致 vim 进入插入模式并在它自己的行上输出一个 Q
(当 vim 运行时,行为相同)我已经处于插入模式)。如果我在本地计算机上工作或者通过 ssh 连接到另一台服务器,情况也是如此。
在 iterm2 中,当我处于正常或可视模式时没有任何反应。当我处于插入模式时,会插入
。
我的配置在我的 mac mini 和 Linux 上网本上运行得很好,但这让我陷入了困境。
My vim setup( https://github.com/aaronjorbin/.vim ) contains set pastetoggle=<F2>
yet fn+F2 (when vim is running in terminal) causes vim to enter insert mode and output a Q
on it's own line (same behavior when I am already in insert mode). This is the same if I am working on my local machine or if I have sshed into another server.
In iterm2, nothing happens when I am in normal or visual mode. When I am in insert mode, <F2>
is inserted.
My config works perfectly well on my mac mini and linux netbook, but this is throwing me for a loop.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这可能是由于您的 TERM 类型设置为 xterm xterm-color 或 xterm-256color 以外的其他值。由于某种我不记得的原因,我将我的设置为linux。这导致功能键发送转义序列,而不是被解释为按下功能键。即- F2 正在发送
^[OQ
而不是
。如果您需要该终端类型,您可以通过按
代替键入
来更改 .vimrc 以使用您想要的键。 code>当然,更简单的解决方法是将终端类型更改为允许 vim 无需跳过任何步骤即可工作的类型。
This is likely due to your TERM type being set to something other than xterm xterm-color or xterm-256color. I had mine set to linux for some reason I can't remember. This caused the function keys to send escape sequences instead of being interpreted as function key presses. ie- F2 was sending
^[OQ
instead of<F2>
.If you need that terminal type you can change your .vimrc to use the key you want by pressing
<ctrl-v><F2>
in place of typing<F2>
The easier fix is of course to just change your terminal type to something that allows vim to work without jumping through hoops.
您已在 vimrc 中
设置了 noesckeys
。我很久以前就读过(没有来源,抱歉)一些关于功能键在某些终端中被解释为)。
number
的内容(9
for <代码>如果我是正确的并且我正确地读取了
:help noesckeys
,则set noesckeys
会阻止所有功能键。尝试将其注释掉。You have
set noesckeys
in your vimrc.I've read a long time ago (no source, sorry) something about function keys being interpreted as
<Esc>number
in some terminals (<Esc>9
for<F9>
).If I'm correct and if I read
:help noesckeys
correctly,set noesckeys
is blocking all function keys. Try commenting it out.(我知道很晚的答案,但其他人可能会发现这很有用)
我遇到了同样的问题(OSX10.9.5 上的 Vim7.4),对我有用的是设置 pastetoggle after 设置 no兼容(nocp) 。
(Very late answer I know but someone else may find this useful)
I encountered the same problem (Vim7.4 on OSX10.9.5) and what worked for me was to set pastetoggle after setting nocompatible (nocp).
我发现在 Mac 上,F2 键映射到“打开/关闭请勿打扰”。您可以在系统偏好设置 -> 下禁用此设置。键盘->快捷方式->任务控制。取消选中该复选框或选择另一个键。下图
I found that on Macs the F2 key is mapped to "Turn Do Not Disturb On/Off". You can disable this setting under System Preferences -> Keyboard -> Shortcuts -> Mission Control. Uncheck the checkbox or pick another key. Picture below