2022-03-09 19:03:04 +01:00
|
|
|
local helpers = require("my.helpers")
|
|
|
|
local arpeggio = vim.fn["arpeggio#map"]
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
function M.chord(mode, lhs, rhs, opts)
|
2022-09-12 13:50:02 +02:00
|
|
|
if string.len(mode) > 1 then
|
|
|
|
for i = 1, #mode do
|
|
|
|
local c = mode:sub(i, i)
|
|
|
|
M.chord(c, lhs, rhs, opts)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
local options = helpers.mergeTables(opts, { noremap = true })
|
|
|
|
local settings = options.settings or ""
|
2022-03-09 19:03:04 +01:00
|
|
|
|
2022-09-12 13:50:02 +02:00
|
|
|
if options.silent then settings = settings .. "s" end
|
2022-03-09 19:03:04 +01:00
|
|
|
|
2022-09-12 13:50:02 +02:00
|
|
|
arpeggio(mode, settings, options.noremap, lhs, rhs)
|
|
|
|
end
|
2022-03-09 19:03:04 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function M.chordSilent(mode, lhs, rhs, opts)
|
2022-09-12 13:50:02 +02:00
|
|
|
local options = helpers.mergeTables(opts, { silent = true })
|
|
|
|
M.chord(mode, lhs, rhs, options)
|
2022-03-09 19:03:04 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|