Closed melboyce closed 7 years ago
Note: the last sentence is actually a question. Is it best to work on rc/core/formatter.kak
or is there somewhere in the cpp
that I need to grok and change?
This is indeed the place to deal with this. If you have questions the best way to get quick answer is on IRC.
Hello, sorry for the delay, this one slipped through. The problem is that the return value from the commands used in the |
(or !
) normal mode key is not interpretted at all by Kakoune.
Here, we could fix that by either having |
not replace the text if the command does not exit successfully, or make it possible to access that command exit status from a %sh{...} shell so that the formatter.kak
script could trigger a undo when the status was not 0.
The first solution looks like its going to be refusing to pipe in various legitimate cases. The second seems very specific, so not very elegant.
All good - I haven't had a chance to work on my Kakoune environment for a while due to work. I'll see how it feels to handle this all in the formatter shell script by using a temp file when I have some time.
As per @casimir 's request, I'm logging this issue here and closing one in @lenormf 's
kakoune-extras
repo.The
:format
command will wipe the buffer if the command specified by theformatcmd
setting returns an error instead of a copy of the code. I'm happy to take a crack at a PR againstrc/core/formatter.kak
if that's the best place to deal with this.