Update ftoptions and statusline plugin configuration options

This commit is contained in:
Zachary Yedidia
2019-07-28 16:28:04 -07:00
parent 23a76e1381
commit 576036f251
4 changed files with 82 additions and 37 deletions

View File

@@ -7,8 +7,10 @@ import (
luar "layeh.com/gopher-luar"
"github.com/zyedidia/micro/internal/action"
"github.com/zyedidia/micro/internal/display"
ulua "github.com/zyedidia/micro/internal/lua"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/micro/internal/shell"
)
func init() {
@@ -17,9 +19,12 @@ func init() {
}
func LuaImport(pkg string) *lua.LTable {
if pkg == "micro" {
switch pkg {
case "micro":
return luaImportMicro()
} else {
case "micro/shell":
return luaImportMicroShell()
default:
return ulua.Import(pkg)
}
}
@@ -31,7 +36,19 @@ func luaImportMicro() *lua.LTable {
ulua.L.SetField(pkg, "TermError", luar.New(ulua.L, screen.TermError))
ulua.L.SetField(pkg, "InfoBar", luar.New(ulua.L, action.GetInfoBar))
ulua.L.SetField(pkg, "Log", luar.New(ulua.L, log.Println))
ulua.L.SetField(pkg, "TryBindKey", luar.New(ulua.L, action.TryBindKey))
ulua.L.SetField(pkg, "SetStatusInfoFn", luar.New(ulua.L, display.SetStatusInfoFnLua))
// ulua.L.SetField(pkg, "TryBindKey", luar.New(ulua.L, action.TryBindKey))
return pkg
}
func luaImportMicroShell() *lua.LTable {
pkg := ulua.L.NewTable()
ulua.L.SetField(pkg, "ExecCommand", luar.New(ulua.L, shell.ExecCommand))
ulua.L.SetField(pkg, "RunCommand", luar.New(ulua.L, shell.RunCommand))
ulua.L.SetField(pkg, "RunBackgroundShell", luar.New(ulua.L, shell.RunBackgroundShell))
ulua.L.SetField(pkg, "RunInteractiveShell", luar.New(ulua.L, shell.RunInteractiveShell))
return pkg
}