Clean up go plugin

This commit is contained in:
Zachary Yedidia
2016-08-16 13:52:42 -04:00
parent b42aba05a0
commit 563484ffc9
2 changed files with 9 additions and 4 deletions

View File

@@ -5,8 +5,8 @@ if GetOption("gofmt") == nil then
AddOption("gofmt", true)
end
MakeCommand("goimports", "go.goimports")
MakeCommand("gofmt", "go.gofmt")
MakeCommand("goimports", "go.save")
MakeCommand("gofmt", "go.save")
function onSave()
if CurView().Buf.FileType == "Go" then
@@ -34,6 +34,11 @@ function goimports()
CurView():ReOpen()
end
function save()
-- This will trigger onSave and cause gofmt or goimports to run
CurView():Save()
end
function split(str, sep)
local result = {}
local regex = ("([^%s]+)"):format(sep)