micro
micro copied to clipboard
How to Justify selected text ?
What is the equivalent of Nano's ^J for justifying text in Micro ?
Also Thank you very very much for creating a beautiful text editor like this. ❤️
I believe it is a work for plugin (If you are about hard wrap which persist in the file). @taconi does prettier https://github.com/taconi/plugin-channel/issues/37 solves this?
If you need softwrap you can use softwrap
and wordwrap
options
The prettier plugin uses the prettier tool and I know that it formats markdown files, maybe this plugin with some config help to solve this. The other plugin with the same name also uses prettier if the other one helps.
You can also use the manager plugin to create your own formatters:
-- ~/.config/micro/init.lua
MANAGER_FORMATTERS_ENABLED = true
formatters = {
-- yarn global add markdownlint-cli
{ cmd = 'markdownlint --dot --fix %f', onSave = true, filetypes = { 'markdown' } },
}
Seems kinda annoying that the solution is to install a plugin that depends on a tool written in node.js. I tried to write a plug-in that would do that, but could not figure how to access util.StringWidth
from Lua code (which would be necessary to figure out how long a string is, because Lua's string functions don't care about UTF-8).
I tried to write a plug-in that would do that, but could not figure how to access
util.StringWidth
from Lua code (which would be necessary to figure out how long a string is, because Lua's string functions don't care about UTF-8).
We can add exporting util.StringWidth
to Lua, if needed. It should be trivial to implement.
Or perhaps you can get by with using the buffer cursor's GetVisualX()
method, which uses util.StringWidth
underneath?
That sounds like it would be a reasonable addition in general, as, for example, anyone who would want to write a plug-in that prints or outputs a table would also want to know the width of strings of text.