Terminal plugin callback support

This commit is contained in:
Zachary Yedidia
2019-08-26 14:47:27 -04:00
parent 199d65017f
commit b68461cf72
10 changed files with 115 additions and 11 deletions

View File

@@ -53,8 +53,14 @@ var statusInfo = map[string]func(*buffer.Buffer) string{
func SetStatusInfoFnLua(s string, fn string) {
luaFn := strings.Split(fn, ".")
if len(luaFn) <= 1 {
return
}
plName, plFn := luaFn[0], luaFn[1]
pl := config.FindPlugin(plName)
if pl == nil {
return
}
statusInfo[s] = func(b *buffer.Buffer) string {
if pl == nil || !pl.IsEnabled() {
return ""