"fmt"
"io/ioutil"
"os"
+ "runtime"
- "github.com/gdamore/tcell"
- "github.com/gdamore/tcell/encoding"
"github.com/go-errors/errors"
+ "github.com/layeh/gopher-luar"
"github.com/mattn/go-isatty"
"github.com/mitchellh/go-homedir"
+ "github.com/yuin/gopher-lua"
+ "github.com/zyedidia/tcell"
+ "github.com/zyedidia/tcell/encoding"
)
const (
// Is the help screen open
helpOpen = false
+
+ // L is the lua state
+ L *lua.LState
)
// LoadInput loads the file input for the editor
os.Exit(1)
}
+ L = lua.NewState()
+ defer L.Close()
+
encoding.Register()
tcell.SetEncodingFallback(tcell.EncodingFallbackASCII)
InitConfigDir()
// Load the user's settings
InitSettings()
+ InitBindings()
// Load the syntax files, including the colorscheme
LoadSyntaxFiles()
+ // Load the help files
+ LoadHelp()
buf := NewBuffer(string(input), filename)
messenger = new(Messenger)
view := NewView(buf)
+ L.SetGlobal("OS", luar.New(L, runtime.GOOS))
+ L.SetGlobal("view", luar.New(L, view))
+ L.SetGlobal("messenger", luar.New(L, messenger))
+ L.SetGlobal("GetOption", luar.New(L, GetOption))
+ L.SetGlobal("AddOption", luar.New(L, AddOption))
+
+ LoadPlugins()
+
for {
// Display everything
Redraw(view)
}
case tcell.KeyCtrlG:
if !helpOpen {
- helpBuffer := NewBuffer(helpTxt, "")
- helpBuffer.name = "Help"
+ helpBuffer := NewBuffer(helpTxt, "help.md")
+ helpBuffer.Name = "Help"
helpOpen = true
view.OpenBuffer(helpBuffer)
} else {