Open starkovv opened 4 months ago
This plugin has a very beginner friendly implementation. If you are having trouble with this level of simplicity, then you should drop whatever this additional layer of abstraction called "LazyVim" is and start from the basics.
I'm using this:
use {
'Vonr/align.nvim',
commit = '2004d26',
config = function ()
vim.keymap.set('x', '<C-a>', function()
require'align'.align_to_string(true, true, true)
end, { noremap = true, silent = true, nowait = true })
end
}
You just need to change <C-a>
to anything else. I encountered some bugs so I stayed in the old version 2004d26.
I have this in my plugins directory
return {
"Vonr/align.nvim",
keys = {
{
mode = "x",
"<leader>aa",
function()
require("align").align_to_char({
length = 1,
})
end,
desc = "Aligns to 1 char",
},
{
mode = "x",
"<leader>ad",
function()
require("align").align_to_char({
preview = true,
length = 2,
})
end,
desc = "Aligns to 2 chars",
},
{
mode = "x",
"<leader>aw",
function()
require("align").align_to_string({
preview = true,
regex = false,
})
end,
desc = "Aligns to string",
},
{
mode = "x",
"<leader>ar",
function()
require("align").align_to_string({
preview = true,
regex = true,
})
end,
desc = "Aligns to Vim regex",
},
},
}
I also added this to my which-key config file
defaults = {
["<leader>a"] = { name = "+align", mode = "x" },
},
hope it helps :)
I wanted to point out that the documentation is unclear and lacks adequate instructions for beginners with Lua and LazyVim (NeoVim) on how to start using the plugin.
As a result, I'm unsure where to insert these bindings.