Closed bpstahlman closed 6 years ago
We should definitely abort early in fireplace#format
when inside a comment. A PR would be great. In the meantime, you can work around by using gw
instead.
Makes sense. Thanks. I'm in the middle of some PR's for another plugin at the moment, but perhaps if this issue is still open when I finish up, I'll have a look...
I’ve run into this too. Glad there is a workaround.
I’ve noticed the same thing happens in long docstrings, although those might be harder to detect for short circuiting.
Yeah docstrings will be tricky. You might want to patch up the common case with nmap gqa" gwa"
and/or nmap gqi" gwi"
.
The comment thing is potentially as trivial as adding || getline(a:lnum) =~# '^\s*;'
to the first conditional, unless I'm missing something.
That did work. PR submitted.
For doc strings probably the best bet will be a regexp checking that code
is a single string. Off the top of my head, something like ^\s*"\%(\\.\|[^"]\)*"\s*$
I normally use
gqgq
to re-format comments in source files, but this isn't working for clojure files now that I've installed fireplace. To reformat a comment line that's too long, I have to go to the desired column position and insert a linebreak manually, which is very tedious for long comments. I haven't researched it in depth yet, but I can see that fireplace is settingformatexpr
to...fireplace#format(v:lnum,v:count,v:char)
...and a cursory inspection of fireplace#format suggests it may be sending text off for processing by the lisp client. Is this the case? Is there a way to disable this behavior, or some sort of tweak I could perform to have comments formatted according to 'formatoptions'?