30 lines
605 B
Lua
30 lines
605 B
Lua
-- local ts_utils = require 'nvim-treesitter.ts_utils'
|
|
local utils = require("go.utils")
|
|
local vfn = vim.fn
|
|
|
|
local iferr = "iferr"
|
|
local run = function()
|
|
require("go.install").install(iferr)
|
|
|
|
local byte_offset = vfn.wordcount().cursor_bytes
|
|
|
|
local cmd = string.format('iferr -pos %d', byte_offset)
|
|
|
|
local data = vfn.systemlist(cmd, vfn.bufnr('%'))
|
|
|
|
data = utils.handle_job_data(data)
|
|
if not data then
|
|
return
|
|
end
|
|
|
|
local pos = vfn.getcurpos()[2]
|
|
vfn.append(pos, data)
|
|
|
|
vim.cmd('silent normal! j=2j')
|
|
vfn.setpos('.', pos)
|
|
vim.cmd('silent normal! 4j')
|
|
--
|
|
|
|
end
|
|
return {run = run}
|