kamykn / spelunker.vim

Improved vim spelling plugin (with camel case support)!
MIT License
357 stars 20 forks source link

Ignore words inside backtick/backquote(`) #20

Closed vcfvct closed 4 years ago

vcfvct commented 4 years ago

Hey @kamykn Thanks for this nice plugin. Camel case support is great.

Is there a way to config the spelunker to ingore words inside the backticks? I believe this is the behavior of the vim's built-in spell check. I found this the time I enabled spelunker and disabled build-in checker, a lot misspells indicators came up inside backticks.

Thanks!

kamykn commented 4 years ago

Hi, @vcfvct !

Thank you for your feedback. Maybe, this behavior is for markdown only, and the link syntax is similar as this behavior too. It is difficult to add same behavior for Spelunker.vim, because it does not parse the texts.

However, I think it is a very good idea, so I would like to try it if there is a good way.

kamykn commented 4 years ago

@vcfvct I'm sorry that I made you wait. I added new option for this Issue.

" Disable checking words in backtick/backquote.
let g:spelunker_disable_backquoted_checking = 1

Please update the plugin and try new option!

vcfvct commented 4 years ago

Great. Thanks a lot. 👍 I installed the latest version via vim plug, The checking is working. For some reason, the highlight does not work any more even though I could still navigate the mispelss with ZN or correct with ZL. Any clue? Thanks. FYI, I am using nvim-v0.4.3 with Alacritty + tmux on MacOS.

kamykn commented 4 years ago

I'm trying to find out this problem, but same problem does not occur with my nvim-v0.4.3 with Alacritty + tmux. Can you tell me your situation when the problem occurred.

1) Please tell me your spelunker.vim settings. 2) Does the problem occur with a specific words?

I need more information to replicate the same behavior you reported.

kamykn commented 4 years ago

I fix some bugs. Please update the plugin and make sure the problem is fixed 🙏

9bfe895 d0f892a

vcfvct commented 4 years ago

Thanks for the quick response. After trying many combinations, looks like it is because of the colorscheme Plug 'morhetz/gruvbox' that I am using. If I revert to the default nvim color, the underscore and highlights shows up correctly. Any solutions here? 😄

kamykn commented 4 years ago

Some color scheme plugin reset highlighting to default. And morhetz/gruvbox is also reseting highlight too.

https://github.com/morhetz/gruvbox/blob/master/colors/gruvbox.vim#L12-L17

To fix it, you need to load spelunker.vim after loading gruvbox plugin. Or add highlight setting after color scheme plugin loading.

" Override highlight setting.
highlight SpelunkerSpellBad cterm=underline ctermfg=247 gui=underline guifg=#9e9e9e
highlight SpelunkerComplexOrCompoundWord cterm=underline ctermfg=NONE gui=underline guifg=NONE
vcfvct commented 4 years ago

Awesome, that's the root cause. You the man! 👍 どうもありがとう! One thing I notice is say if I type godo with back-tick which is a mispell and reload file, it skips the check correctly. However, if i type another godo in normal text, it will mark/highlight both as mispell. Is that an expected behavior?

kamykn commented 4 years ago

@vcfvct Now, spelunker.vim depends on [matchadd()](https://vim-jp.org/vimdoc-en/eval.html#matchadd()) for highlighting. This function uses a regular expression to specify the target to highlight. If there are more options in the future, it is difficult to exclude ignore options such as backquotes. Therefore, this is currently the expected behavior.

vcfvct commented 4 years ago

Got it. Thanks. :) I am closing this for now!