mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-22 08:47:15 +09:00
Use actual lua functions for callbacks instead of strings
This commit is contained in:
@@ -105,7 +105,7 @@ function string.starts(String,Start)
|
||||
end
|
||||
|
||||
function init()
|
||||
config.MakeCommand("comment", "comment.comment", config.NoComplete)
|
||||
config.MakeCommand("comment", comment, config.NoComplete)
|
||||
config.TryBindKey("Alt-/", "lua:comment.comment", false)
|
||||
config.AddRuntimeFile("comment", config.RTHelp, "help/comment.md")
|
||||
end
|
||||
|
||||
@@ -82,13 +82,12 @@ function init()
|
||||
makeLinter("swiftc", "swiftc", {"%f"}, "%f:%l:%c:.+: %m", {"linux"}, true)
|
||||
makeLinter("yaml", "yaml", "yamllint", {"--format", "parsable", "%f"}, "%f:%l:%c:.+ %m")
|
||||
|
||||
config.MakeCommand("lint", "linter.lintCmd", config.NoComplete)
|
||||
config.AddRuntimeFile("linter", config.RTHelp, "help/linter.md")
|
||||
end
|
||||
config.MakeCommand("lint", function(bp, args)
|
||||
bp:Save()
|
||||
runLinter(bp.Buf)
|
||||
end, config.NoComplete)
|
||||
|
||||
function lintCmd(bp, args)
|
||||
bp:Save()
|
||||
runLinter(bp.Buf)
|
||||
config.AddRuntimeFile("linter", config.RTHelp, "help/linter.md")
|
||||
end
|
||||
|
||||
function contains(list, element)
|
||||
@@ -144,7 +143,7 @@ function lint(buf, linter, cmd, args, errorformat, loff, coff, callback)
|
||||
end
|
||||
end
|
||||
|
||||
shell.JobSpawn(cmd, args, "", "", "linter.onExit", buf, linter, errorformat, loff, coff)
|
||||
shell.JobSpawn(cmd, args, nil, nil, onExit, buf, linter, errorformat, loff, coff)
|
||||
end
|
||||
|
||||
function onExit(output, args)
|
||||
|
||||
Reference in New Issue
Block a user