From d91bae8864d67a1118be00a0cd947fa564512a45 Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Tue, 7 Feb 2023 21:42:56 +0200 Subject: [PATCH] fix(iferr): now this not have type errors --- lua/gopher/iferr.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/gopher/iferr.lua b/lua/gopher/iferr.lua index 7f43318..69f1787 100644 --- a/lua/gopher/iferr.lua +++ b/lua/gopher/iferr.lua @@ -1,16 +1,15 @@ +local c = require("gopher.config").config.commands + ---Add iferr declaration ---That's Lua of vimscript implementation of: ---github.com/koron/iferr return function() - local c = require("gopher.config").config.commands - local u = require "gopher._utils" - local boff = vim.fn.wordcount().cursor_bytes local cmd = (c.iferr .. " -pos " .. boff) - local data = vim.fn.systemlist(cmd, vim.fn.bufnr "%") + local data = vim.fn.systemlist(cmd, vim.fn.bufnr(0)) --[[@as string]] if vim.v.shell_error ~= 0 then - u.notify("command " .. cmd .. " exited with code " .. vim.v.shell_error, "error") + error("iferr exited with code: " .. vim.v.shell_error) return end