I can implement that specific case with a couple of lines in zsh. Something like:
autoload -Uz zed
icommit() {
() {
zed $1
git commit -F $1 # -a too, if you must ;)
} =(:) # Or maybe even =(< commit_template.txt)
}
Then icommit, via zed¹, will initiate an inline editor with all the power of ZLE available. Hit C-x C-w to write and commit, or C-c to abort. Obviously, you'd want some error checking and the like².
Beauty of this basic implementation is that the keymap is fully controllable in zed as it is simply a new ZLE widget. It works with emacs or vi mode out of the box, and is fully customisable beyond that.
You could make the interface generic by writing your own ZLE widget, so that it can be called directly from within the line editor and remove the need for wrapping commands like I did above.
I can implement that specific case with a couple of lines in zsh. Something like:
Then icommit, via zed¹, will initiate an inline editor with all the power of ZLE available. Hit C-x C-w to write and commit, or C-c to abort. Obviously, you'd want some error checking and the like².Beauty of this basic implementation is that the keymap is fully controllable in zed as it is simply a new ZLE widget. It works with emacs or vi mode out of the box, and is fully customisable beyond that.
You could make the interface generic by writing your own ZLE widget, so that it can be called directly from within the line editor and remove the need for wrapping commands like I did above.
¹ https://github.com/zsh-users/zsh/blob/master/Functions/Misc/...
² This at least uses, and cleans up, a temp file to handle the commit message so it isn't completely useless.