vim-easy-align
vim-easy-align copied to clipboard
I can not align by #
sample text
a # 1
bc # 2
def # 3
ghi # 4
I wish it could convert to
a # 1
bc # 2
def # 3
ghi # 4
It works for me, have you tried:
:%EasyAlign /#/
Lines with # are not working for me as well.
The '#' mapping is tied to "Comment" syntax group by default. The support of syntax groups has all sorts of problems, which I put in a separate ticket #159. My guess would be that in the file types that you work with the highlighting of comments is different from what the plugin expects.
I would suggest the following:
- Check that in your files, the syntax is recognized correctly and syntax highlighting is on.
- For neovim, the syntax highlighting is based on the old vim regex method, not treesitter
- Try typing
Ctrl-G
before#
. That would override the dependency on Comment syntax group - Try overriding the align rules for
#
(viag:easy_align_delimiters
), providing different ignore groups- specify empty ignore_group to not use this feature at all
- add the comment group names specific to the file types you work with
gaip#
or gaip-<space>
all work well in this case.
https://github.com/junegunn/vim-easy-align/issues/114#issuecomment-343356693