1
Fork 0
satellite/dotfiles/neovim/lua/my/plugins/arpeggio.lua

28 lines
676 B
Lua
Raw Normal View History

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
2022-10-09 03:28:51 +02:00
local options = helpers.mergeTables(opts or {}, { noremap = true })
2022-09-12 13:50:02 +02:00
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-10-09 03:28:51 +02:00
arpeggio(mode, settings, not options.noremap, lhs, rhs)
2022-09-12 13:50:02 +02:00
end
2022-03-09 19:03:04 +01:00
end
function M.chordSilent(mode, lhs, rhs, opts)
2022-10-09 03:28:51 +02:00
local options = helpers.mergeTables(opts or {}, { silent = true })
2022-09-12 13:50:02 +02:00
M.chord(mode, lhs, rhs, options)
2022-03-09 19:03:04 +01:00
end
return M