local justify_right_second_col = function(parts, _) local target_width = vim.bo.textwidth > 0 and vim.bo.textwidth or 80 -- For the line 'aaa *aaa*' the row is `{ 'aaa', ' ', '*aaa*'}` for _, row in ipairs(parts) do -- Make sure that separator column doesn't affect row[2] = "" -- Justify second column so that its right part is at `target_width` row[3] = string.rep(" ", target_width - vim.fn.strchars(row[1]) - vim.fn.strchars(row[3])) .. row[3] end end local align_helptag = function(steps, opts) -- Split based on whitespace opts.split_pattern = "%s+" steps.justify = MiniAlign.new_step("justify_helptag", justify_right_second_col) end vim.b.minialign_config = { modifiers = { ["*"] = align_helptag } }