refactor(iferr): change api
This commit is contained in:
parent
36f2006b98
commit
3e78f86d42
2 changed files with 8 additions and 7 deletions
|
|
@ -1,10 +1,9 @@
|
||||||
---Add iferr declaration
|
local c = require("gopher.config").commands
|
||||||
---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 u = require "gopher._utils"
|
||||||
|
local iferr = {}
|
||||||
|
|
||||||
|
-- That's Lua of vimscript implementation of: github.com/koron/iferr
|
||||||
|
iferr.iferr = function()
|
||||||
local boff = vim.fn.wordcount().cursor_bytes
|
local boff = vim.fn.wordcount().cursor_bytes
|
||||||
local cmd = (c.iferr .. " -pos " .. boff)
|
local cmd = (c.iferr .. " -pos " .. boff)
|
||||||
local data = vim.fn.systemlist(cmd, vim.fn.bufnr "%")
|
local data = vim.fn.systemlist(cmd, vim.fn.bufnr "%")
|
||||||
|
|
@ -19,3 +18,5 @@ return function()
|
||||||
vim.cmd [[silent normal! j=2j]]
|
vim.cmd [[silent normal! j=2j]]
|
||||||
vim.fn.setpos(".", pos)
|
vim.fn.setpos(".", pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return iferr
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ local gopher = {}
|
||||||
gopher.setup = require("gopher.config").setup
|
gopher.setup = require("gopher.config").setup
|
||||||
gopher.install_deps = require "gopher.installer"
|
gopher.install_deps = require "gopher.installer"
|
||||||
gopher.impl = require "gopher.impl"
|
gopher.impl = require "gopher.impl"
|
||||||
gopher.iferr = require "gopher.iferr"
|
gopher.iferr = require("gopher.iferr").iferr
|
||||||
gopher.comment = require "gopher.comment"
|
gopher.comment = require "gopher.comment"
|
||||||
|
|
||||||
gopher.tags_add = tags.add
|
gopher.tags_add = tags.add
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue