echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.45k stars 171 forks source link

[mini.align] Align for commas but I have commas inside strings #950

Closed georgeguimaraes closed 3 weeks ago

georgeguimaraes commented 3 weeks ago

Contributing guidelines

Module(s)

mini.align

Description

What's a good modifier to align commas when I have commas in strings that should not be messed?

Neovim version

NVIM v0.11.0-dev-3338+gd7651b27d-Homebrew

Steps to reproduce

  1. nvim -nu minimal.lua
  2. ...

Expected behavior

abc, "City, State",                 123
def, "Country",                     456
hij, "Another Country",             789
klm, "Another City, Another State", 012

Actual behavior

Tks for all the plugins!

I have a piece of code something like this:

abc, "City, State", 123
def, "Country", 456
hij, "Another Country", 789
klm, "Another City, Another State", 012

Trying to align it with ga, gives me

abc, "City,             State",         123
def, "Country",         456
hij, "Another Country", 789
klm, "Another City,     Another State", 012 

which is not what I wanted.

I tried to configure the split modifier manually but with no luck. Is there a good way to achieve this?

echasnovski commented 3 weeks ago

There is an "ignore" modifier. See more details here and the exported function for more control.

Its suggested application is like this: