Add onBufferOpen plugin callback

Closes #948
This commit is contained in:
Zachary Yedidia
2018-01-08 17:08:11 -05:00
parent 9a6054fc43
commit 3f01101da4
5 changed files with 20 additions and 9 deletions

View File

@@ -170,3 +170,15 @@ func LoadPlugins() {
loadedPlugins["init"] = "init"
}
}
// GlobalCall makes a call to a function in every plugin that is currently
// loaded
func GlobalPluginCall(function string, args ...interface{}) {
for pl := range loadedPlugins {
_, err := Call(pl+"."+function, args...)
if err != nil && !strings.HasPrefix(err.Error(), "function does not exist") {
TermMessage(err)
continue
}
}
}