mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 14:22:42 +09:00
Add hooks for every action that's bindable
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/yuin/gopher-lua"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
@@ -10,6 +11,22 @@ var preInstalledPlugins = []string{
|
||||
"go",
|
||||
}
|
||||
|
||||
// Call calls the lua function 'function'
|
||||
// If it does not exist nothing happens, if there is an error,
|
||||
// the error is returned
|
||||
func Call(function string) error {
|
||||
luaFunc := L.GetGlobal(function)
|
||||
if luaFunc.String() == "nil" {
|
||||
return nil
|
||||
}
|
||||
err := L.CallByParam(lua.P{
|
||||
Fn: luaFunc,
|
||||
NRet: 0,
|
||||
Protect: true,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// LoadPlugins loads the pre-installed plugins and the plugins located in ~/.config/micro/plugins
|
||||
func LoadPlugins() {
|
||||
files, _ := ioutil.ReadDir(configDir + "/plugins")
|
||||
|
||||
Reference in New Issue
Block a user