From 78d2f88b3207f00cac1d5cbe21e00286dec417e8 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 12 Sep 2023 23:33:16 +0200 Subject: nvim: Move ‘remap()’ to mango.lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/nvim/lua/mango/lib.lua | 10 ++++++++++ .config/nvim/lua/mango/remap.lua | 6 +----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/mango/lib.lua b/.config/nvim/lua/mango/lib.lua index 71fbc08..4c38986 100644 --- a/.config/nvim/lua/mango/lib.lua +++ b/.config/nvim/lua/mango/lib.lua @@ -8,4 +8,14 @@ function M.set_tab_width(tw, localp) opt.shiftwidth = tw end +function M.remap(modes, from, to, opts) + local ct = {} + + modes:gsub('.', function(c) + table.insert(ct, c) + end) + + vim.keymap.set(ct, from, to, opts) +end + return M diff --git a/.config/nvim/lua/mango/remap.lua b/.config/nvim/lua/mango/remap.lua index 46e2bc2..bcc34f3 100644 --- a/.config/nvim/lua/mango/remap.lua +++ b/.config/nvim/lua/mango/remap.lua @@ -1,8 +1,4 @@ -local function remap(modes, from, to) - modes:gsub('.', function(c) - vim.keymap.set(c, from, to) - end) -end +local remap = require('mango.lib').remap vim.g.mapleader = ' ' -- cgit v1.2.3