小技巧: 在 Vimperator 中调用外部编辑器

若你使用 Vimperator,那么可以通过调用外部的文本编辑器来输入网页上文本框中的内容。Vimperator 的这项特性和 Firefox 扩展 It's All Text! 挺相似,不过后者不支持调用命令行下的文本编辑器,相较而言,Vimperator 的则更为实用。

设置方法

你只需设置 editor 选项即可,GVim 可设置为:

:set editor=gvim\ -f

如果你要使用 Vim,则可以这样设置:

:set editor=urxvt\ -e\ vim

要是你使用其他的终端,那么需要替换上述设置命令中的 urxvt。

你也可以将设置写入 Vimperator 的配置文件 $HOME/.vimperatorrc。

如何使用

很简单,定位到需要输入内容的文本框,按 Ctrl + i 组合键。一旦在 (G)Vim 中编辑完成,直接保存即可。

Read More:

19 Comments

  1. 1 Shellex Commented @ 2009-03-20 9:37Reply to this comment

    嗯,是神器

  2. 2 chisiyuan Commented @ 2009-03-20 9:39Reply to this comment

    嗯,挺好用的。 不过Vimperator在文本框里也可以用readline(?)的快捷键,比如^H, ^U什么的,所以留言之类的小规模输入原地进行也很方便。

  3. 3 飘过,哇咔咔 Commented @ 2009-03-20 10:09Reply to this comment

    不会用Vimperator

  4. 4 Rainux Commented @ 2009-03-20 10:12Reply to this comment

    哦,可以不用装 It's All Text! 了。

  5. 5 superjet Commented @ 2009-03-20 10:17Reply to this comment

    X下用到鼠标的地方还是很多的,2.0beta的改进还是挺大的,原来牛速般的历史操作终于有所改进,喜欢尝鲜的可以用git版,虽然会有更多的不稳定因素

  6. 6 hmy Commented @ 2009-03-20 10:35Reply to this comment

    这样输入不是更麻烦吗?

  7. 7 sss Commented @ 2009-03-20 10:58Reply to this comment

    不麻烦啊,比如你要编辑wiki,这样就相当方便

  8. 8 leon Commented @ 2009-03-20 11:23Reply to this comment

    真是强悍阿!

  9. 9 逸飞 Commented @ 2009-03-20 13:14Reply to this comment

    Very Good!

  10. 10 alexsunmiu Commented @ 2009-03-20 14:38Reply to this comment

    为什么我总是不能发言?囧 我在文本框中按ctrl+i之后编辑的中文是乱码!

  11. 11 Rainux Commented @ 2009-03-20 15:53Reply to this comment

    @alexsunmiu: 中文乱码?应该跟你的外部编辑器的编码配置有关。我用的 gVim,默认 utf8 编码,没有什么问题。

  12. 12 seenxu Commented @ 2009-03-20 18:00Reply to this comment

    以前一直想在terminal下用vim来编辑,这下知道了,必须得加个-e选项,多谢分享! 另外,设置editor那里得用双引号把整句包起来或者\来escape空格吧?!

  13. 13 alexmajy Commented @ 2009-03-20 20:46Reply to this comment

    我在ubuntu 804下设置时如果使用双引号或者\会出现问题,反倒是直接设置 :set editor=gvi -f 没有问题,奇怪

  14. 14 HalloKetty Commented @ 2009-03-21 0:28Reply to this comment

    可以的

  15. 15 ginkgo Commented @ 2009-03-21 12:13Reply to this comment

    vimperator 2.0 maybe will release on next weekend.

  16. 16 chisiyuan Commented @ 2009-03-21 16:29Reply to this comment

    @ginkgo really? GOOD!

  17. 17 ginkgo Commented @ 2009-03-21 18:33Reply to this comment

    Martin Stubenschrott is the author of vimperator.

    in the maillist he said below.

    On Thu, Mar 19, 2009 at 5:18 AM, Kris Maglione wrote: > > I can't speak of a time table; I probably would have > > released 2.0 already.

    Yeah, I guess it's time now. I wanted to wait for 3.1 (now 3.5) final compatibility, but we'll probably do a 2.1 anyway soon which can have that. I don't have time this weekend, but I will release 2.0 the next weekend (and submit it to AMo then).

    @localizations: Yeah, I think we probably just add a "Localized versions" link just like we have a "Other versions" link and provide things like vimperator-2.0-jp.xpi.

    The only problem is, that if you use them and use the auto-update, you'll get the english version, but that's ok for me - i'll write a big fat warning about that on the "Localized versions" HTML page. On the other hand, if we continue to do a 8-month release cycle it isn't a real problem anyway ;) (which i hope we don't, new released about every 2 months is what i aim for, but it all depends on the developers, as i really have little time currently).

    Kris: Thanks for the mouseup patch, seems a little buggy (and should be mousedown after all), but i think something like that is a good idea probably.


    Vimperator mailing list Vimperator@mozdev.org https://www.mozdev.org/mailman/listinfo/vimperator

  18. 18 transtone Commented @ 2009-03-24 12:50Reply to this comment

    如何设置在gvim的标签里打开?

  19. 19 sampeng Commented @ 2009-03-28 12:41Reply to this comment

    老是重新打开一个gvim。。真的很不方便