diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-01 01:14:59 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-01 01:14:59 +0200 |
commit | e1de506156454ba1d324faf548ad15fe804aa806 (patch) | |
tree | 1ca249b22bace59d41e950b7482443440ccc8c5e /config/essentials/vis/vis-go.lua | |
parent | fecb6306631aaec1774497093b7da44ab5950d92 (diff) | |
parent | b2077bbddf86dbdbf6cc63aaf2ceb8a2da614ebc (diff) |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'config/essentials/vis/vis-go.lua')
-rw-r--r-- | config/essentials/vis/vis-go.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/config/essentials/vis/vis-go.lua b/config/essentials/vis/vis-go.lua index b0b383f..bb0c7ab 100644 --- a/config/essentials/vis/vis-go.lua +++ b/config/essentials/vis/vis-go.lua @@ -1,3 +1,13 @@ +--[[ +Based on https://gitlab.com/timoha/vis-go +Changes made: +- stylua format +- check if line, col in godef() +- no formatting because already handled by format.lua +- removed the goimports option +- set env variable for godef that fixes "no definition found" +--]] + local function jump_to(path, line, col) if path then vis:command(string.format("e %s", path)) @@ -28,7 +38,7 @@ local function godef() local file = win.file local pos = win.selection.pos - local cmd = string.format("godef -i -o %d", pos) + local cmd = string.format("GO111MODULE=off godef -i -o %d", pos) local status, out, err = vis:pipe(file, { start = 0, finish = file.size }, cmd) if status ~= 0 or not out then if err then @@ -44,7 +54,9 @@ local function godef() -- same file line, col = string.match(out, "([^:]+):([^:]+)") end - jump_to(path, line, col) + if line and col then + jump_to(path, line, col) + end end local function godef_back() |