Skip to content

Instantly share code, notes, and snippets.

@caisui
Created November 9, 2011 12:45
Show Gist options
  • Select an option

  • Save caisui/1351332 to your computer and use it in GitHub Desktop.

Select an option

Save caisui/1351332 to your computer and use it in GitHub Desktop.
vimperatorrc を here doc で 遅延
" plugin load 後実行
" Enter 後、:source 時は、遅延無しで実行
" here doc の ネスト 可能
:js <<END
{
let one= function (f1) liberator.registerObserver("enter", function f2() {f1(); liberator.unregisterObserver("enter", f2);});
let c = commands.addUserCommand(["lazy"], "lazy", function (args, extra) {
function f() {
io.source({
__proto__: extra && extra.setFrom ? extra.setFrom : File("~"),
read: function () args[0],
toString: function() this.__proto__.path,
__noSuchMethod__: function (name, args) ["exists", "isReadable"].indexOf(name) >= 0,
}, false);
}
if (!this.preLoad) f();
else one(f);
}, {literal:0, hereDoc:true, preLoad: true}, false);
if (c) one(function () c.preLoad = false);
}
END
lazy <<END
" plugin ロード後
js alert(2)
" 遅延読込の here doc
js <<END1
window.setTimeout(function () {
alert("lazy here doc");
}, 1200);
set grep
END1
" plugin 実装 option
"set grep_scroll_position=auto
END
js alert(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment