Closed2

zdharma/fast-syntax-highlighting 使用時のコミットログの文字数上限を変更する

XeresXeres
$ ghq get zsh-users/zsh-syntax-highlighting
     clone https://github.com/zsh-users/zsh-syntax-highlighting -> /home/xeres/repos/github.com/zsh-users/zsh-syntax-highlighting
       git clone --recursive https://github.com/zsh-users/zsh-syntax-highlighting /home/xeres/repos/github.com/zsh-users/zsh-syntax-highlighting
Cloning into '/home/xeres/repos/github.com/zsh-users/zsh-syntax-highlighting'...
remote: Enumerating objects: 6919, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6919 (delta 2), reused 2 (delta 0), pack-reused 6913
Receiving objects: 100% (6919/6919), 1.46 MiB | 2.50 MiB/s, done.
Resolving deltas: 100% (4676/4676), done.
$ cd -- /home/xeres/repos/github.com/zsh-users/zsh-syntax-highlighting
COPYING.md  HACKING.md  INSTALL.md  Makefile  README.md  changelog.md  docs/  highlighters/  images/  release.md  tests/  zsh-syntax-highlighting.plugin.zsh  zsh-syntax-highlighting.zsh
$ rg -w 50 .
./highlighters/main/test-data/brackets-mismatch8-if-positive.zsh
47:  '50 50 commandseparator' # ;
$ rg -w 51 .
./highlighters/main/test-data/cthulhu.zsh
52:  '51 58 default' # Cthu"lhu

./highlighters/main/test-data/multiple-quotes.zsh
39:  "33 51 dollar-quoted-argument" # $'quux\nfoo\001bar'

うーん、どこで設定がされているのか見当たらない…。

XeresXeres

あ、zdharma/fast-syntax-highlighting を使用してるのに zsh-users/zsh-syntax-highlighting を見ていた…。そりゃ見つからんわ。

$ ghq get zdharma/fast-syntax-highlighting
     clone https://github.com/zdharma/fast-syntax-highlighting -> /home/xeres/repos/github.com/zdharma/fast-syntax-highlighting
       git clone --recursive https://github.com/zdharma/fast-syntax-highlighting /home/xeres/repos/github.com/zdharma/fast-syntax-highlighting
Cloning into '/home/xeres/repos/github.com/zdharma/fast-syntax-highlighting'...
remote: Enumerating objects: 3592, done.
remote: Counting objects: 100% (34/34), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 3592 (delta 17), reused 20 (delta 8), pack-reused 3558
Receiving objects: 100% (3592/3592), 1.49 MiB | 11.25 MiB/s, done.
Resolving deltas: 100% (2421/2421), done.
$ cd -- /home/xeres/repos/github.com/zdharma/fast-syntax-highlighting
$ rg -w 50 .
./test/parse.zsh
156:    for (( i=1; i<= 50; i ++ )); do

./→chroma/-ogit.ch
201:                    if (( ${#__firstline} > 50 )); then
202:                        for (( __idx1 = 1, __idx2 = 1; __idx1 <= 50; ++ __idx1, ++ __idx2 )); do

./DONATIONS.md
14:- [2018-05-25, received $50](#2018-05-25-received-50)
249:## 2018-05-25, received $50

./→chroma/-git.ch
902:    integer length=${FAST_HIGHLIGHT[git-cmsg-len]:-50}

お、これっぽい。

(抜粋)
./→chroma/-git.ch
902:    integer length=${FAST_HIGHLIGHT[git-cmsg-len]:-50}

5.2 Distributed Git - Contributing to a Project / Commit Guidelinesによると、サマリであれば 50 文字以内、必要に応じて 72 文字以内にしろ、とのことらしい。

Capitalized, short (50 chars or less) summary

More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. (以下略)

クォートの有無に関わらず、FAST_HIGHLIGHT[git-cmsg-len] で指定した文字数 + 1 で赤字になるようなので、シングルクォートまたはダブルクォートを使用する前提で、74 文字 (73 + 1) までは許容するように変更した。

.zshrc (抜粋)
zinit lucid wait light-mode for \
    atload"_zsh_autosuggest_start" \
        zsh-users/zsh-autosuggestions \
    atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=73; zicompinit; zicdreplay" \
        zdharma/fast-syntax-highlighting

72文字+クォート文字まで赤字にならないのが分かる

このスクラップは2021/05/09にクローズされました