@@ -6,16 +6,15 @@ local shell = import("micro/shell")
6
6
local buffer = import (" micro/buffer" )
7
7
8
8
function init ()
9
- config .RegisterCommonOption (" goimports" , false )
10
- config .RegisterCommonOption (" gofmt" , true )
9
+ config .RegisterCommonOption (" go " , " goimports" , false )
10
+ config .RegisterCommonOption (" go " , " gofmt" , true )
11
11
12
- config .MakeCommand (" goimports" , " go. goimports" , config .NoComplete )
13
- config .MakeCommand (" gofmt" , " go. gofmt" , config .NoComplete )
14
- config .MakeCommand (" gorename" , " go.gorename " , config .NoComplete )
12
+ config .MakeCommand (" goimports" , goimports , config .NoComplete )
13
+ config .MakeCommand (" gofmt" , gofmt , config .NoComplete )
14
+ config .MakeCommand (" gorename" , gorenameCmd , config .NoComplete )
15
15
16
16
config .AddRuntimeFile (" go" , config .RTHelp , " help/go-plugin.md" )
17
17
config .TryBindKey (" F6" , " command-edit:gorename " , false )
18
- config .MakeCommand (" gorename" , " go.gorenameCmd" , config .NoComplete )
19
18
end
20
19
21
20
function onSave (bp )
@@ -52,10 +51,10 @@ function gorenameCmd(bp, args)
52
51
local loc = buffer .Loc (c .X , c .Y )
53
52
local offset = buffer .ByteOffset (loc , buf )
54
53
local cmdargs = {" --offset" , buf .Path .. " :#" .. tostring (offset ), " --to" , args [1 ]}
55
- shell .JobSpawn (" gorename" , cmdargs , " " , " go. renameStderr" , " go. renameExit" , bp )
54
+ shell .JobSpawn (" gorename" , cmdargs , nil , renameStderr , renameExit , bp )
56
55
else
57
56
local cmdargs = {" --from" , args [1 ], " --to" , args [2 ]}
58
- shell .JobSpawn (" gorename" , cmdargs , " " , " go. renameStderr" , " go. renameExit" , bp )
57
+ shell .JobSpawn (" gorename" , cmdargs , nil , renameStderr , renameExit , bp )
59
58
end
60
59
micro .InfoBar ():Message (" Renaming..." )
61
60
end
0 commit comments