Closed jinyongp closed 1 year ago
I'm not sure if this is a problem with fsh.
According to the git man page the syntax should be --message=
and that also works for me.
-m <msg>, --message=<msg>
Use the given <msg> as the commit message. If multiple -m options are given, their values are concatenated as separate
paragraphs.
The -m option is mutually exclusive with -c, -C, and -F.
Oh.. Your opinion makes sense. However, it doesn't seem possible to create an alias using the --message=
option. I use the git alias plugin in on-my-zsh, and all of them use the long option format, so I just override the ones I use frequently. Anyway, the --message
option still works, so it would be nice if it could be added if possible.
I had the same problem and solved it the same way, replacing --message
with -m
for my aliases ;)
As far as I understand fsh takes the information whether a command is correct from the zsh completion system. The completion file for git should be this one https://github.com/zsh-users/zsh/blob/master/Completion/Unix/Command/_git (installed at /usr/share/zsh/5.9/functions/Completion/Unix/_git
). You could try to add --message
there.
thx, @Ultimator14. It's very helpful.
I was wrong. The zsh source is just for tab completion (they also always use the --message=
style). But fsh has it's command definitions here https://github.com/zdharma-continuum/fast-syntax-highlighting/blob/master/%E2%86%92chroma/-git.ch.
This should do the job
diff --git "a/\342\206\222chroma/-git.ch" "b/\342\206\222chroma/-git.ch"
index 12a97b3..43693ce 100644
--- "a/\342\206\222chroma/-git.ch"
+++ "b/\342\206\222chroma/-git.ch"
@@ -155,7 +155,7 @@ fsh__git__chroma__def=(
subcmd:commit "COMMIT_#_opt // FILE_#_arg // NO_MATCH_#_opt"
"COMMIT_#_opt" "
- (-m|--message=|-am)
+ (-m|--message=|--message|-am)
<<>> NO-OP // ::→chroma/-git-commit-msg-opt-action
<<>> NO-OP // ::→chroma/-git-commit-msg-opt-ARG-action
|| (--help|-a|--all|-p|--patch|--reset-author|--short|--branch|
Describe the bug
The syntax highlighting feature seems to be broken when passing a string after the "--message" option in "git commit" command. The string is not highlighted in yellow, instead it is highlighted in red.
It seems that there are no tests for the
--message
option but-m
. https://github.com/zdharma-continuum/fast-syntax-highlighting/blob/7c390ee3bfa8069b8519582399e0a67444e6ea61/test/parse.zsh#L94Steps to reproduce
git commit -m "commit message"
command, observe that the string is highlighted in yellowgit commit --message "commit message"
command, observe that the string is highlighted in redExpected behavior
The string passed with the
--message
option ingit commit
command should be highlighted in yellow, same as when using the-m
option.Screenshots and recordings
Operating System & Version
darwin22.0 | apple | x86_64 | arm64 | arm64 arm
Zsh version
zsh 5.8.1 (x86_64-apple-darwin22.0)
Terminal emulator
xterm-256color
If using WSL on Windows, which version of WSL
None
Additional context
No response