I'm trying to use junegunn/vim-easy-align
to vertically align some text.
EasyAlign has an interactive-mode which means you can invoke EasyAlign, it prompts for a key, and then aligns around whatever key you enter.
eg: given the following text:
foo = bar
hello = world
a = b
something = this
You can visually select the 4 lines, and then enter interactive mode using :EasyAlign
, then hit =
, and it will result in:
foo = bar
hello = world
a = b
something = this
Manually this works great, but when I attempt to add a keybinding it fails.
I would like to bind :EasyAlign
to <leader>xa
in visual mode.
This is the command I've used:
vim.api.nvim_set_keymap('v', "<leader>xa", "<cmd>EasyAlign<CR>", { noremap=true, silent = true })
When I hit <leader>xa
I can see the EasyAlign interactive prompt in the message area, but when I then hit =
nothing happens.
How can I bind <leader>xa
to open the EasyAlign interactive prompt, and then have it align around whatever key I enter?