Skip to content

[Help] Mini.align - How to ignore delimiter if it's inside double quotes #361

Closed Answered by echasnovski
icyrainz asked this question in Q&A
Discussion options

You must be logged in to vote

Apparently, I forgot how my modules work 😞

There is an i modifier (for ignore) that does just that: adds matches inside "" to be ignored. So you can gAip followed by , to set separator and followed by i to add "ignore" pre-split step.

If you want to ignore inside both '' and "", you can customize i modifier like so:

local align = require('mini.align')
align.setup({
  modifiers = {
    i = function(steps, _) table.insert(steps.pre_split, align.gen_step.ignore_split({ '".-"', "'.-'" })) end,
  },
})

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@icyrainz
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #360 on June 09, 2023 06:54.