vim-pandoc / vim-pandoc-syntax

pandoc markdown syntax, to be installed alongside vim-pandoc
MIT License
425 stars 61 forks source link

Spell check enabled but not working #344

Open medwatt opened 3 years ago

medwatt commented 3 years ago

I have spell check enabled for markdown documents. For some reason, with this plugin enabled, no spelling mistakes are detected. If I disable this plugin, the errors are detected.

I'm using Neovim 0.5 on Windows 10.

ravl1084 commented 3 years ago

I see the same on Ubuntu 18, Vim 8

meck commented 3 years ago

Same issue but i notices spelling only stops working if i set a custom g:pandoc#syntax#codeblocks#embeds#langs without it spelling works fine.

N3on1x commented 3 years ago

I had the same issue. After troubleshooting I found that the syntax file for java located at $VIMRUNTIME/syntax/java.vim messes with the syntax spell option by setting: syntax spell default. This overwrites the spell check setting syntax spell toplevel set in syntax/pandoc.vim.

Removing 'java' from my g:pandoc#syntax#codeblocks#embeds#langs list in .vimrc solved the problem.

The current setting can be verified by typing :syntax spell in a buffer. Setting the spell checking to toplevel also fixes the problem for the current buffer: :syntax spell toplevel

alerque commented 3 years ago

Great tip @NicolajNiels1. That might explain why I've never been able to replicate various reports like this (I don't have Java enabled as a possible embedded language) and why it keeps coming up. It might not be just Java either, perhaps there are other languages that trip people up.

I wonder if this is something we can mitigate by saving / restoring the setting after loaded embedded syntaxes. I think we do that already for some other settings.

meck commented 3 years ago

I checked and the my problems is traceable to haskell in g:pandoc#syntax#codeblocks#embeds#langs so its not only java

alerque commented 3 years ago

Thanks @meck, I think we're on to something. I'm pretty sure there is a way we can block this change.

N3on1x commented 3 years ago

I checked and the my problems is traceable to haskell in g:pandoc#syntax#codeblocks#embeds#langs so its not only java

Running grep -irn "syntax spell default" * when located in $VIMRUNTIME/syntax yields the following for me, confirming that it might not only be a problem with java:

groovy.vim:226:  syntax spell default  " added by Bram
java.vim:161:  syntax spell default
papp.vim:29:  syntax spell default  " added by Bram
spyce.vim:22:syntax spell default  " added by Bram

(Of course this is dependent on which vim distribution you are using. I am using macvim installed via homebrew. )