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/after/plugin/fugitive.lua | 4 +++- .config/nvim/after/plugin/lsp.lua | 10 +++++----- .config/nvim/after/plugin/telescope.lua | 5 +++-- .config/nvim/after/plugin/undotree.lua | 4 +++- 4 files changed, 14 insertions(+), 9 deletions(-) (limited to '.config/nvim/after/plugin') diff --git a/.config/nvim/after/plugin/fugitive.lua b/.config/nvim/after/plugin/fugitive.lua index 6e1b92d..39f7df6 100644 --- a/.config/nvim/after/plugin/fugitive.lua +++ b/.config/nvim/after/plugin/fugitive.lua @@ -1 +1,3 @@ -vim.keymap.set('n', 'gs', vim.cmd.Git) +local lib = require('mango.lib') + +lib.remap('n', 'gs', vim.cmd.Git) diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index 6891256..27703fa 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -1,4 +1,5 @@ local lsp = require('lsp-zero') +local lib = require('mango.lib') lsp.preset('recommended') lsp.ensure_installed({ @@ -30,11 +31,10 @@ lsp.setup_nvim_cmp({ lsp.on_attach(function(_, bufnr) local opts = {buffer = bufnr, remap = false} - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) - vim.keymap.set('n', 'la', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'lr', vim.lsp.buf.rename, opts) - vim.keymap.set('n', 'l=', vim.lsp.buf.format, opts) - vim.keymap.set('i', '', vim.lsp.buf.signature_help, opts) + lib.remap('n', 'gd', vim.lsp.buf.definition, opts) + lib.remap('n', 'la', vim.lsp.buf.code_action, opts) + lib.remap('n', 'lr', vim.lsp.buf.rename, opts) + lib.remap('n', 'l=', vim.lsp.buf.format, opts) end) lsp.setup() diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua index a9d9225..fa355e1 100644 --- a/.config/nvim/after/plugin/telescope.lua +++ b/.config/nvim/after/plugin/telescope.lua @@ -1,8 +1,9 @@ local builtin = require('telescope.builtin') +local lib = require('mango.lib') --vim.keymap.set('n', 'pf', builtin.git_files, {}) -vim.keymap.set('n', 'pf', builtin.find_files, {}) -vim.keymap.set('n', 'ps', function() +lib.remap('n', 'pf', builtin.find_files) +lib.remap('n', 'ps', function() builtin.grep_string({ search = vim.fn.input('Grep > ') }) end) diff --git a/.config/nvim/after/plugin/undotree.lua b/.config/nvim/after/plugin/undotree.lua index a346462..ff5625d 100644 --- a/.config/nvim/after/plugin/undotree.lua +++ b/.config/nvim/after/plugin/undotree.lua @@ -1 +1,3 @@ -vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle) +local lib = require('mango.lib') + +lib.remap('n', 'u', vim.cmd.UndotreeToggle) -- cgit v1.2.3