Description
At the moment, the Fixedqg
function for formatexpr
completely breaks comment-formatting.
If I place the cursor as indicated in the below snippet,
class Foo {
/*
* ⁁I love chocolate oat cake apple pie ice cream jelly-o sweet. Sweet roll jujubes gummi bears soufflé cotton candy. Shortbread muffin bear claw muffin marshmallow donut I love bonbon jelly. Gingerbread sweet chocolate oat cake I love I love.
*/
constructor(){}
}
... and attempt to use Vim's built-in gq
comment-formatting mechanism (:set textwidth=80 fo+=cq]
, then use gqq
or gq{motion}
) … absolutely nothing happens. The extremely-long line stays all in one line.
If I disable the Fixedgq
added by this plugin (:set formatexpr&
), then it formats, but it gets super-weird and janky, because the indentexpr
setting is attempting to take control inside comments:
class Foo {
/*
* I love chocolate oat cake apple pie ice cream jelly-o sweet. Sweet roll jujubes gummi bears
* soufflé cotton candy. Shortbread muffin bear claw muffin marshmallow donut I love bonbon jelly.
* Gingerbread sweet chocolate oat cake I love I love.
*/
constructor(){}
}
The only way I've found to restore natural gq
functionality is to disable both, which requires creating two separate dang files, unfortunately:
" $XDG_CONFIG_HOME/after/ftplugin/typescript.vim
setl formatexpr&
" $XDG_CONFIG_HOME/after/indent/typescript.vim
setl indentexpr&
Then I get sane output:
class Foo {
/*
* I love chocolate oat cake apple pie ice cream jelly-o sweet. Sweet roll jujubes gummi bears
* soufflé cotton candy. Shortbread muffin bear claw muffin marshmallow donut I love bonbon jelly.
* Gingerbread sweet chocolate oat cake I love I love.
*/
constructor(){}
}
Getting gq
working in comments properly is probably going to require a couple of changes to the indent-handling function; but I strongly suggest the user be allowed to entirely desable the "fixed" gq
function. I'm perfectly happy with how vim's built-in gq
operates; I don't what whatever 'fixes' this plugin is trying to apply! D: