vis icon indicating copy to clipboard operation
vis copied to clipboard

Retab function: automatically format code based on syntax

Open bzbug opened this issue 5 years ago • 2 comments

There's a retab function in Sublime, which re-formats code based on syntax - it detects automatically the levels of nesting and inserts tabs or spaces accordingly.

Is it possible to implement something like this with lexers? And if not, what can be done?

bzbug avatar Aug 14 '20 23:08 bzbug

You can just use any stand-alone formatter in vis, binding it to a key or calling it on save. For instance, I have ";c" bound to cargo fmt the current file.

ninewise avatar Aug 17 '20 09:08 ninewise

:|indent -kr<CR> Done. Works even on selection.

mcepl avatar Sep 03 '20 08:09 mcepl