35 lines
741 B
Lua
35 lines
741 B
Lua
local builtins = require'presser.builtins'
|
|
|
|
local a = vim.api
|
|
|
|
local presser = {} -- list of functions to be exported
|
|
|
|
presser.setup = function ( opts )
|
|
local opts = opts or {}
|
|
-- @Dev: TODO - construct setup function for configs
|
|
--
|
|
|
|
--map("n", "<Leader>h", "<cmd>lua require'presser'.find_replace()<CR>") -- global replace with last buffer item
|
|
|
|
a.nvim_create_user_command(
|
|
'Presser',
|
|
function ( o )
|
|
local args = {}
|
|
for arg in string.gmatch( o.args, "%S+" ) do
|
|
table.insert( args, arg )
|
|
end
|
|
builtins[args[1]]()
|
|
end,
|
|
{
|
|
nargs = 1,
|
|
complete = function (ArgLead, CmdLine, CursorPos)
|
|
return { 'find_replace', 'hyperlink' }
|
|
end,
|
|
}
|
|
)
|
|
|
|
|
|
end
|
|
|
|
return presser
|