Vimperator 复制/粘贴

has*_*sen 23 firefox vim vimperator

我正在试用Vimperator。我主要希望它用于 hjkl 滚动,并且我喜欢它的“提示”系统来跟踪链接。这两个功能真的是我所需要的;我认为。

我不介意其他功能,只是有时会妨碍我。

最让我烦恼的是复制/粘贴。我习惯了Ctrl+ c/ Ctrl+ v,我不介意使用另一个快捷方式,但是 ..

:help yank 表示复制选定的文本是用 Y 完成的,但唯一提到的粘贴方法是鼠标中键!

这与 Vim 的精神背道而驰!

如何在不使用鼠标的情况下粘贴 Vimperator?

小智 36

我很惊讶这个问题没有更准确的答案。所选答案的插件链接解决了 OP 的问题,但实际上没有人解释如何在不使用直通 (Cv) 模式的情况下将某些内容粘贴到文本字段中。

如果您在 INSERT 模式下的文本字段中并想要粘贴某些内容,那么在 vi-land 中要做的显而易见的事情是按 ESC 和 p 进行粘贴。在 vimperator 中,这不起作用 - ESC 使您完全退出 INSERT 模式并进入您将页面/选项卡作为一个整体工作的模式。

Vimperator 通过额外的 BASIC 模式 - TEXTAREA 解决了这个问题。在 TEXTAREA 模式下,您可以使用在 vi 中使用的受支持命令。

Enter TEXTAREA mode: C-t
Paste:    p
Copy line:    yy
Delete Char:  x
Delete Line:  dd
Run Code Online (Sandbox Code Playgroud)

等等。

这似乎没有得到很好的记录 - 我最终大部分是错误地计算出来的。它在多行和单行文本框中的工作方式相同。


小智 15

您可以做的最好和最简单的事情是重新映射密钥。这并不难。将其放入您的 _vimperatorrc(或 Linux 中的 .vimperatorrc)

noremap <C-c> <C-v><C-c>
noremap <C-v> <C-v><C-v>
Run Code Online (Sandbox Code Playgroud)

<C-v>默认情况下映射到“传递下一个”模式,这意味着您按下的下一个键会直接发送到 Firefox,而不会被 vimperator 处理和吃掉。所以上面的映射只是激活“通过下一个”模式并发送相应的快捷方式。

甚至还有一个vimperator 插件可以进一步扩展它并重新映射所有常见的 Windows 快捷方式,因此它们的行为符合预期。

  • 对于 &lt;Cv&gt; (paste) 应该是 inoremap (3认同)
  • 看起来当前版本 (3.8.1) 可能有默认情况下 Cc 和 Cv 执行操作系统级复制和粘贴...我无法在更新日志中找到任何关于它的信息,但我刚刚从 Pentadactyl 切换到最新Vimperator 和 Cc 和 Cv 像我希望的那样工作。 (2认同)

joe*_*joe 13

现在,vimperator 重新映射了 Ctrl+C(从“复制”到“取消”)和 Ctrl+V(从“粘贴”到“传递”)。在 Linux 上,复制/粘贴的首选方法是使用鼠标中键,所以这不是问题。在 Windows 上,这是一个用户界面灾难,非常需要修复。

您可以从三个位置复制:来自网页的文本、来自表单域的文本和来自外部应用程序的文本。您可以复制到两个位置:表单域和外部应用程序。地址栏和命令栏的工作方式类似于表单域。

Copying from...
     A web page: 'Y' works, '^C' doesn't
     Form field: 'Y' doesn't work, '^C' does
     Extern application: 'Y' doesn't work, '^C' does
  Copying to...
     Form field: '^V' doesn't work, '^V,^V' does
     External application: '^V' works, '^V,^V' pastes twice
 Or, seen another way
       Copy  Paste
 Page  Y     N/A
 Form  ^C    ^V,^V
 App   ^C    ^V
Run Code Online (Sandbox Code Playgroud)

普通用户不会记住那个表。他们永远不会弄清楚,因为它没有明确记录,即使有,他们也不会阅读。相反,他们将使用右键单击菜单,这是唯一适用于任何地方的东西。事实上,在我开始使用 Vimperator 几周后,我发现自己正在一个完全不相关的应用程序中这样做,这是我以前从未做过的事情。

We need to restore ^C and ^V to their original, rightful functions as copy and paste, which means displacing the ^C=cancel and ^V=pass-through hotkeys. In fact, both of these hotkeys are unique to vimperator and do not appear in vim. ^V means 'block visual' in vim, which doesn't apply in vimperator, so pass-through can be easily assigned to some other key. I suggest backslash in command mode and ctrl+backslash in both command and insert modes. That leaves ^C. I think that should be moved to ^S. This has two good mnemonics: it's 'stop', and it's also the Unix hotkey for XOFF, which is useless but semantically similar. ^S is currently "save page as" in vimperator, which is rarely used and can still be accessed with :save or :saveas.

Undo is also broken; it was ^Z, but ^Z is not pass-through mode and there's no way to undo edits in a form field without using the mouse. I see no reason not to move that to another hotkey, especially since ^Z in vim means suspend, which is completely unrelated, and unexpectedly finding yourself in pass-through mode is extremely disorienting. I can't think of a non-arbitrary hotkey to change this to, but ^Z was pretty arbitrary in the first place, so any unused hotkey will do.

Soruce : http://www.mozdev.org/pipermail/vimperator/2008-October/002359.html