I use neovim as editor for git. Especially when rebasing it is hard to focus on the important things because the spell check highlights the commit hashes.

Therefore I'm trying to exclude the 7-char long hex strings from spell checking with:

syntax match NoSpellGitHash /\x\{7}/ contains=@NoSpell

This does not seem to have any effect because e.g. 1278fbd or bdbbe1f still get the bad-spell highlighting. If I search for my pattern with /\x\{7} it does however find the hashes.

Where am I going wrong?

  • 3
    See here: github.com/vim/vim/pull/7221 Dec 22 '20 at 11:40
  • Yeah, I was going to say that that text is already matched in Vim's syntax/gitrebase.vim ... syn match gitrebaseHash "\v<\x{7,}>" contained. I wonder if you can override that (e.g. in after config) while waiting for the patch to get released.
    – B Layer
    Dec 22 '20 at 15:17
  • I'm using neovim though. I tried copying the match rules from the diff but no success so far.
    – beluga.me
    Dec 22 '20 at 16:07
  • 1
    BTW, the question's first sentence..."as editor for Vim". Vim? Or git? I suggest you edit that so other people don't have to read it multiple times like I did.
    – B Layer
    Dec 22 '20 at 20:07
  • Can you try the same changes with Vim. If it's working with Vim but not Neo than the latter must have a bug. (They use the same syntax files generally. Certainly the git syntax files look identical).
    – B Layer
    Dec 22 '20 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.