Fix bug with init.lua
This commit is contained in:
parent
acc03e9707
commit
e634b4e180
3 changed files with 11 additions and 3 deletions
|
@ -142,8 +142,11 @@ func LoadPlugins() {
|
|||
}
|
||||
|
||||
if _, err := os.Stat(configDir + "/init.lua"); err == nil {
|
||||
if err := L.DoFile(configDir + "/init.lua"); err != nil {
|
||||
pluginDef := "\nlocal P = {}\n" + "init" + " = P\nsetmetatable(" + "init" + ", {__index = _G})\nsetfenv(1, P)\n"
|
||||
data, _ := ioutil.ReadFile(configDir + "/init.lua")
|
||||
if err := L.DoString(pluginDef + string(data)); err != nil {
|
||||
TermMessage(err)
|
||||
}
|
||||
loadedPlugins = append(loadedPlugins, "init")
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -29,6 +29,11 @@ want a callback before the action is executed, use `preAction()`. In this case
|
|||
the boolean returned specifies whether or not the action should be executed
|
||||
after the lua code completes.
|
||||
|
||||
Another useful callback to know about which is not a action is
|
||||
`onViewOpen(view)` which is called whenever a new view is opened and the new
|
||||
view is passed in. This is useful for setting local options based on the filetype,
|
||||
for example turning off `tabstospaces` only for Go files when they are opened.
|
||||
|
||||
---
|
||||
|
||||
There are a number of functions and variables that are available to you in
|
||||
|
|
Loading…
Reference in a new issue