]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/plugin.go
Small fix to redraw location
[micro.git] / cmd / micro / plugin.go
index 548d1caffd02311ac50a8fd721702853ade3c56e..f2091bfcf58266eefdf58ff1b9daba4fcee9e052 100644 (file)
@@ -3,6 +3,7 @@ package main
 import (
        "errors"
        "io/ioutil"
+       "os"
        "strings"
 
        "github.com/layeh/gopher-luar"
@@ -55,8 +56,8 @@ func Call(function string, args []string) (lua.LValue, error) {
 // and creates a function that will call that lua function
 // Specifically it creates a function that can be called as a binding because this is used
 // to bind keys to lua functions
-func LuaFunctionBinding(function string) func(*View) bool {
-       return func(v *View) bool {
+func LuaFunctionBinding(function string) func(*View, bool) bool {
+       return func(v *View, _ bool) bool {
                _, err := Call(function, nil)
                if err != nil {
                        TermMessage(err)
@@ -131,4 +132,10 @@ func LoadPlugins() {
                        loadedPlugins = append(loadedPlugins, pluginName)
                }
        }
+
+       if _, err := os.Stat(configDir + "/init.lua"); err == nil {
+               if err := L.DoFile(configDir + "/init.lua"); err != nil {
+                       TermMessage(err)
+               }
+       }
 }