y,自从用了vim,该让机器做的都让机器做了。。

这个东东的原理是这样滴,firefox安装一个插件,起作用的就下面几行

var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("/tmp/refresh.firefox");
//浏览器开启时启动一个定时器
var timer = setInterval(function()
{
    //每隔0.1秒检测一下这个文件存在否 
    if ( file.exists() )
    {
        //如果存在,删除之
        file.remove(true);
        //获取当前标签的文档对象
        var doc = gBrowser.selectedBrowser.contentDocument;
        //是否是在调试的东东
        if ( /(xiaonei\.com|kaixin\.com)/.test( doc.location.href ) )
        {
            //如果是,调用dnsFluher,刷新host,如果没有安装此插件就算了
            dnsFluher.refreshdns();
            //刷新页面
            doc.location.reload();
        }
    }
},100 );
Copy Code 

所以,只要在/tmp/目录生成一个refresh.firefox的文件,firefox便会刷新了

vim 里添加一行配置文件

"更改host文件时刷新
autocmd BufWritePost,FileWritePost /etc/hosts execute '!echo '' > /tmp/refresh.firefox'
"更改调试文件时刷新
autocmd BufWritePost,FileWritePost */jspro/*.js execute '!echo '' > /tmp/refresh.firefox'
Copy Code 

插件附上,根据情况自行修改。。

autorefresh1.0

扩展名改成xpi拖到firefox就可以安装了