autoload -z edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
[1] https://unix.stackexchange.com/questions/6620/how-to-edit-co...It is in Bash.
"\C-x\C-e": edit-and-execute-command bind -p
or bind -P
For example: $ bind -P |grep execute
edit-and-execute-command can be found on "\C-x\C-e".
$
The "bind" shell built-in is detailed in the SHELL BUILTIN COMMANDS section of the "bash" manual.> beyond that I find that editing long freeform text on the command line gets annoying fast if only because of the careful escaping you have to do, especially for nested quotes.
Oh I agree. Here I'd suggest it for the rare case where I was expecting to write a simple commit message and end up needing a much longer one, though usually I'd just create the commit and immediately "amend" into a proper text editor (and most of the time I use a text editor directly, because rare are the commits where the short desc is sufficient).
git commit -F- <<EOF
Fix issue
Hello world...
EOFPut linebreaks and fill-paragraph for the later lines? You can put linebreaks in quoted shell strings, so once it's in an editor buffer there's no issue with that.
> I guess you can edit the command to read from STDIN
The use case here is "I've already started writing a commit message inline, I now realise I need more room, I don't want to bother copy/pasting stuff around".
If I know from the start that I will need more than just a shortdesc, I'll obviously be crafting the message in my editor in the first place.
fold -c -s -w 80 | git commit -F - <<EOF
Fix issue
Hello world...
EOF