2021-04-23 06:31:00 +00:00
|
|
|
-- local ts_utils = require 'nvim-treesitter.ts_utils'
|
2021-07-07 05:56:22 +00:00
|
|
|
local utils = require("go.utils")
|
2021-04-23 06:31:00 +00:00
|
|
|
|
|
|
|
local iferr = "iferr"
|
|
|
|
local run = function(...)
|
|
|
|
require("go.install").install(iferr)
|
|
|
|
local fname = vim.fn.expand("%:p") -- %:p:h ? %:p
|
|
|
|
|
|
|
|
local byte_offset = vim.fn.wordcount().cursor_bytes
|
|
|
|
|
2021-07-14 15:01:09 +00:00
|
|
|
local cmd = string.format('iferr -pos %d', byte_offset)
|
|
|
|
|
|
|
|
local data = vim.fn.systemlist(cmd, vim.fn.bufnr('%'))
|
|
|
|
|
|
|
|
data = utils.handle_job_data(data)
|
|
|
|
if not data then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local pos = vim.fn.getcurpos()[2]
|
|
|
|
vim.fn.append(pos, data)
|
|
|
|
|
|
|
|
vim.cmd('silent normal! j=2j')
|
|
|
|
vim.fn.setpos('.', pos)
|
|
|
|
vim.cmd('silent normal! 4j')
|
|
|
|
--
|
|
|
|
|
2021-04-23 06:31:00 +00:00
|
|
|
end
|
|
|
|
return {run = run}
|