Closed marinopposite closed 7 years ago
function quote() manipulate(".*", '"%1"', 1) end
MakeCommand("quote", "manipulator.quote" )
function single() manipulate(".*", "'%1'", 1) end
MakeCommand("single", "manipulator.single")
function generic() manipulate(".*", "<%1>", 1) end
MakeCommand("generic", "manipulator.generic")
Hi @marinopposite
Thanks for the contribution! It has been added now and I will make a PR to get it upstream in micro's repo.
I wrote some small enhancements to your manipulator.lua:
Command: capital (uppercases the first letter of marked block or letter at cursor when nothing is marked)
As per resolving issue #707 in micro, these wrap the marked text either in braces, curly braces or square brackets:
Command: curly, brace, square
To accomodate this I needed to change the declaration of the function manipulate at line 44 by adding the argument num:
function manipulate(regex, manipulator, num)
and line 49 in it:
local newTxt = string.gsub(oldTxt, regex, manipulator, num)
to control the number of replacements (effectively to restrict them to only one).
I apologize for not going through entire pull/push routine due to this being so small.
Best regards.