From dc695c56b49388838e9b01be2a8d1549d5440139 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 8 Jun 2022 08:50:26 +0100 Subject: [PATCH] feat(nvim): add junegunn/vim-easy-align --- roles/neovim/files/lua/opdavies/keymap.lua | 4 ++++ roles/neovim/files/lua/opdavies/options.lua | 5 +++++ roles/neovim/files/lua/opdavies/plugins.lua | 1 + 3 files changed, 10 insertions(+) diff --git a/roles/neovim/files/lua/opdavies/keymap.lua b/roles/neovim/files/lua/opdavies/keymap.lua index 98f3880..df7d5f3 100644 --- a/roles/neovim/files/lua/opdavies/keymap.lua +++ b/roles/neovim/files/lua/opdavies/keymap.lua @@ -16,4 +16,8 @@ M.vmap = function(tbl) vim.keymap.set("v", tbl[1], tbl[2], tbl[3]) end +M.xmap = function(tbl) + vim.keymap.set("x", tbl[1], tbl[2], tbl[3]) +end + return M diff --git a/roles/neovim/files/lua/opdavies/options.lua b/roles/neovim/files/lua/opdavies/options.lua index 349c6cb..de7b125 100644 --- a/roles/neovim/files/lua/opdavies/options.lua +++ b/roles/neovim/files/lua/opdavies/options.lua @@ -55,10 +55,15 @@ local function set_key_mappings() map("n", "", ":silent !tmux neww tmux-sessioniser", { noremap = true, silent = true }) local imap = require "opdavies.keymap".imap + local nmap = require "opdavies.keymap".nmap + local xmap = require "opdavies.keymap".xmap -- Easy insertion of a trailing ; or , from insert mode imap { ",,", "A," } imap { ";;", "A;" } + + nmap { "ga", "(EasyAlign)" } + xmap { "ga", "(EasyAlign)" } end local function set_highlights() diff --git a/roles/neovim/files/lua/opdavies/plugins.lua b/roles/neovim/files/lua/opdavies/plugins.lua index 8238411..65b8c8e 100644 --- a/roles/neovim/files/lua/opdavies/plugins.lua +++ b/roles/neovim/files/lua/opdavies/plugins.lua @@ -30,6 +30,7 @@ return packer.startup(function() use "folke/zen-mode.nvim" use "icatalina/vim-case-change" use "j-hui/fidget.nvim" + use "junegunn/vim-easy-align" use "kazhala/close-buffers.nvim" use "kyazdani42/nvim-web-devicons" use "lewis6991/gitsigns.nvim"