diff --git a/nvim/.config/nvim/lua/modules/easyalign.lua b/nvim/.config/nvim/lua/modules/easyalign.lua new file mode 100644 index 0000000..c2aef34 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/easyalign.lua @@ -0,0 +1,21 @@ +vim.api.nvim_set_keymap('x', 'ga', '(EasyAlign)', {}) +vim.api.nvim_set_keymap('n', 'ga', '(EasyAlign)', {}) + +vim.g.easy_align_delimiters = { + [';'] = { pattern = ';' , left_margin = 0 }, + ['['] = { pattern = '[' , left_margin = 1, right_margin = 0 }, + [']'] = { pattern = ']' , left_margin = 0, right_margin = 1 }, + [','] = { pattern = ',' , left_margin = 0, right_margin = 1 }, + [')'] = { pattern = ')' , left_margin = 0, right_margin = 0 }, + ['('] = { pattern = '(' , left_margin = 0, right_margin = 0 }, + ['='] = { pattern = [[<\?=>\?]], left_margin = 1, right_margin = 1 }, + ['|'] = { pattern = [[|\?|]] , left_margin = 1, right_margin = 1 }, + ['&'] = { pattern = [[&\?&]] , left_margin = 1, right_margin = 1 }, + [':'] = { pattern = ':' , left_margin = 1, right_margin = 1 }, + ['?'] = { pattern = '?' , left_margin = 1, right_margin = 1 }, + ['<'] = { pattern = '<' , left_margin = 1, right_margin = 0 }, + ['\\'] = { pattern = '\\' , left_margin = 1, right_margin = 0 }, + ['+'] = { pattern = '+' , left_margin = 1, right_margin = 1 }, + ['>'] = { pattern = '->' , left_margin = 1, right_margin = 1 }, + ['#'] = { pattern = '#-' , left_margin = 1, right_margin = 1 } +} diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index aee77aa..23df5ff 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -115,6 +115,11 @@ local init = function () use 'lambdalisue/edita.vim' -- Take care of sudo use 'lambdalisue/suda.vim' + -- Alignment + use { + 'junegunn/vim-easy-align', + config = "require('modules.easyalign')" + } -- LSP use { 'neovim/nvim-lspconfig',