Fix empty string and GoRun -F main module (#147)

* fix: append check if val is nil
Add check to see if value is empty. And don't add to path if already in
path.

Signed-off-by: Davincible <david.brouwer.99@gmail.com>

* feat: auto run main module in floating term
Add check to see if floating term, to auto run main file

Signed-off-by: Davincible <david.brouwer.99@gmail.com>

* Update asyncmake.lua

no need to show a notification as there is another one once the program is finished.

Co-authored-by: rayx <rayx.cn@gmail.com>
pull/149/head
David Brouwer 2 years ago committed by GitHub
parent 10264d6904
commit 6e7410452f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -170,7 +170,9 @@ function go.setup(cfg)
vim.cmd(
[[command! -nargs=* -complete=custom,v:lua.package.loaded.go.modify_tags_complete GoModifyTag lua require("go.tags").modify(<f-args>)]]
)
vim.cmd([[command! -nargs=* -complete=custom,v:lua.package.loaded.go.add_tags_complete GoAddTag lua require("go.tags").add(<f-args>)]])
vim.cmd(
[[command! -nargs=* -complete=custom,v:lua.package.loaded.go.add_tags_complete GoAddTag lua require("go.tags").add(<f-args>)]]
)
vim.cmd([[command! -nargs=* GoRmTag lua require("go.tags").rm(<f-args>)]])
vim.cmd(
[[command! -nargs=* -complete=custom,v:lua.package.loaded.go.impl_complete GoImpl lua require("go.impl").run(<f-args>)]]
@ -256,7 +258,6 @@ function go.setup(cfg)
if _GO_NVIM_CFG.textobjects then
require("go.ts.textobjects").setup()
end
-- TODO remove in future
gobin = vfn.getenv("GOBIN")
if gobin == vim.NIL then
return
@ -312,15 +313,14 @@ go.modify_tags_complete = function(_, _, _)
return table.concat(opts, "\n")
end
-- how to deal complete https://github.com/vim-scripts/marvim/blob/c159856871aa18fa4f3249c6aa312c52f586d1ef/plugin/marvim.vim#L259
-- go.add_tags_complete = function(arglead, line, pos)
go.add_tags_complete = function(arglead, line, _)
-- print("lead: ",arglead, "L", line, "p" )
local transf = { "camelcase", "snakecase", "lispcase", 'pascalcase', "titlecase", 'keep' }
local transf = { "camelcase", "snakecase", "lispcase", "pascalcase", "titlecase", "keep" }
local ret = {}
if #vim.split(line, '%s+') >= 2 then
if #vim.split(line, "%s+") >= 2 then
if vim.startswith("-transform", arglead) then
return "-transform"
end
@ -332,11 +332,13 @@ go.add_tags_complete = function(arglead, line, _)
if #ret > 0 then
return table.concat(ret, "\n")
end
return table.concat(transf, '\n')
return table.concat(transf, "\n")
end
local opts = {
"json", "json.yml", "-transform",
"json",
"json.yml",
"-transform",
}
return table.concat(opts, "\n")
end

@ -118,7 +118,7 @@ function M.make(...)
end
if makeprg:find("go run") then
runner = "go run"
if args == nil or #args == 0 then
if args == nil or #args == 0 or (#args == 1 and args[1] == "-F") then
makeprg = makeprg .. " ."
end
efm = efm .. [[,%A%\\t%#%f:%l\ +0x%[0-9A-Fa-f]%\\+]]

@ -16,6 +16,9 @@ end
function M.append(env, val)
local oldval = vfn.getenv(env)
if val == vim.NIL or string.find(oldval, val) then
return
end
local newval = oldval .. ":" .. val
vfn.setenv(env, newval)
end

Loading…
Cancel
Save