暂时禁用Vimperator [英] disable Vimperator temporarily
问题描述
我猜你已经知道Shift-Esc暂时禁用vimperator。所以我写了如何禁用vimperator根据您当前的位置。
首先,解决方案:
autocmd LocationChange。* js modes.passAllKeys = false
autocmd LocationChange mail\\.google\\.com js modes.passAllKeys = true
autocmd LocationChange www\\.google\\.com / calendar js modes.passAllKeys = true
autocmd LocationChange www\\.google\\.com / reader js模式。 passAllKeys = true
autocmd LocationChange mail\\.google\\.com / tasks js modes.passAllKeys = false
这个过滤gMail,gCalendar,gReader,但不是gTask。
我给出的解决方案是级联的方法,您可以定义所有网站vimperator,那么它有选择地禁用每个网站。因此,即使gTask使用与gmail相同的父站点,它也启用了vimperator。
现在解释:
$ b
这些命令放在主目录中的.vimperatorrc中。您可以通过
来源更改.vimperatorrc的位置! *目录*
在.vimperatorrc文件中,但默认位置是.vimperatorrc文件在您的主目录中。 (%Windows中的userprofile%)
替代解决方案:
pre $ autocmd LocationChange。* js modes.passAllKeys = /mail\.google\.com/.test(buffer.URL)
*请注意反斜杠以避开点。
这个方法的问题是只有最后一行带有autocmd的命令行才会起作用。这意味着最后一个autocmd命令会覆盖第一个。所以你最终会导致布尔操作的命令,如下所示:
autocmd LocationChange。* js modes.passAllKeys = / (mail \.google\.com | google\.com\ / reader)/。test(buffer.URL)
正如你所看到的,当你有很多你想要过滤掉的网站时,这可能会变得很复杂。
$ b
文档:
< a href =http://vimperator.sourceforge.net/help/vimperator/autocommands.xhtml =noreferrer> http://vimperator.sourceforge.net/help/vimperator/autocommands.xhtml <
解决方案来源:
http://code.google.com/p/vimperator-labs/issues/detail?id=406
How can I disable Vimperator temporarily? For example, I'd like to disable Vimperator temporarily when I am using a web email app. Is there a command for it?
I am guessing you already know about Shift-Esc to temporarily disable vimperator. So I wrote how to disable vimperator based on your current location.
First, the solution:
autocmd LocationChange .* js modes.passAllKeys = false
autocmd LocationChange mail\\.google\\.com js modes.passAllKeys = true
autocmd LocationChange www\\.google\\.com/calendar js modes.passAllKeys = true
autocmd LocationChange www\\.google\\.com/reader js modes.passAllKeys = true
autocmd LocationChange mail\\.google\\.com/tasks js modes.passAllKeys = false
This filters gMail, gCalendar, gReader, but not gTask.
The solution I gave is cascading approach where you define all websites to enable vimperator, then it selectively disables for each website. Thus, even though gTask uses the same parent site as gmail, it has vimperator enabled.
Now the explanation:
These commands go in your .vimperatorrc in the home directory. You can change the location of the .vimperatorrc by
source! *directory*
in .vimperatorrc file, but the default location is .vimperatorrc file in your home directory. (%userprofile% in Windows)
The alternative solution:
autocmd LocationChange .* js modes.passAllKeys = /mail\.google\.com/.test(buffer.URL)
*Notice the backslash to escape the dot.
The problem with this approach is that only the latest line of command with autocmd will take work. Meaning the last autocmd command overwrites the first. So you would end up resulting to boolean operation on the command, like this:
autocmd LocationChange .* js modes.passAllKeys = /(mail\.google\.com|google\.com\/reader)/.test(buffer.URL)
As you can see this can get complicated when you have many websites you want to filter out.
The documentation:
http://vimperator.sourceforge.net/help/vimperator/autocommands.xhtml
Source of the solution:
http://code.google.com/p/vimperator-labs/issues/detail?id=406
这篇关于暂时禁用Vimperator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!