1

I have noticed that vim spellcheck does not highlight/select text which is emphasized (i.e., italicized) or strongly emphasized (i.e., bold) in markdown.

For example,

The wuick brown fox jumps over the lazy dog

Vim spellcheck highlights wuick. I can also select this word using ]s and [s.

However when I type:

_The wuick brown fox jumps over the lazy dog_

wuick is not highlighted. While one may think that the highlight is not done since vim highlights the entire emphasized segment, even when I use ]s or [s to cycle through misspelt words I am not able to select wuick in the emphasized text. It is the same situation when I strongly emphasize the text as

**The wuick brown fox jumps over the lazy dog**

However when I take the cursor to wuick in the emphasized or strongly emphasized text, z= pops up the possible correct spellings for me to select from.

How can I turn on vim spellcheck highlighting and selection for emphasized and strongly emphasized text?

Added information (2021-01-21)

as suggested in the comments below maybe there was a problem with my vimrc. I ran vi with the -u NONE -U NONE -N flags and then vi spell check was able to highlight wuick in all three of the above sentences. Thinking that there was a problem with my vimrc, I ran vi as usual but with an empty vimrc file. However, this recreated the above issue of vi spell check not highlighting the misspelt wuick in the emphasised and strongly emphasised text and also not cycling through them with [s and ]s.

I then tried the following test:

I opened a new buffer in vi (with the empty vimrc file) and typed the following sentences fresh

The wuick brown fox jumps over the lazy dog
_The wuick brown fox jumps over the lazy dog_
**The wuick brown fox jumps over the lazy dog**

When I turned on spell check with set spell the three misspellings of wuick were highlighted and I could cycle through them with ]s and [s.

However the moment I saved the file with the command :sav test.md vi spell check failed to highlight the latter two occurrences of wuick and also did not cycle through them with ]s and [s

This suggests to me that there is something about how vi detects markdown files that interferes with vi spell check.

Will be grateful if someone else can redo the test above and share the results.

Note that when I rerun the above test with vi -u NONE -U NONE -N spell check works correctly but, of course, there is no syntax highlighting of the markdown file.

Close of added information

sghosh
  • 11
  • 2
  • Welcome to [vi.se]! I'm not seeing this behavior, even in vim --clean. Do you have any plugins that might be working with markdown syntax? Generally the way this is affected is by allowing or disallowing spelling in syntax groups. – D. Ben Knoble Jan 19 '21 at 13:10
  • @D.BenKnoble The only plugins I have currently are vim-taskpaper, goyo and limelight and the latter two were turned off during editing.

    Vim detects that I am editing a markdown file by the file extension I used i.e. either .md or .markdown

    – sghosh Jan 19 '21 at 19:40
  • @D.BenKnoble as per your suggestion I took at a look at How to debug my vimrc. When I run vi -u none -U None then I don't get the problem. Spell check highlights wuick in all three of the above sentences.

    Therefore, I thought my vimrc has a problem. So I renamed it and created an empty vimrc file by touch .vimrc. Now when I opened the text file with the above three sentences with vim, I saw the same error as I documented above even though my vimrc is empty. So the problem is not with my vimrc.

    – sghosh Jan 20 '21 at 18:55
  • As a further step, I opened vi with my empty vimrc. In the empty buffer I typed the following:
    _The wuick brown fox jumps over the lazy dog_
    **The wuick brown fox jumps over the lazy dog**```
    
    Now when I turn spell check on ```wuick``` in all three sentences is highlighted as a misspelling and I can cycle through them by ```[s``` and ```]s```.
    
    However when I save the file as ```test.md```, the highlights on ```wuick``` on the second and third sentences disappear and I also cannot cycle through as above.
    
    – sghosh Jan 20 '21 at 18:56
  • Fwiw, there is actually a difference between no vimrc and an empty vimrc. I’ll see if i can track this down at some point – D. Ben Knoble Jan 20 '21 at 23:54

0 Answers0