Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style spellcheck #71

Merged
merged 1 commit into from Apr 4, 2020
Merged

Style spellcheck #71

merged 1 commit into from Apr 4, 2020

Conversation

dngray
Copy link
Contributor

@dngray dngray commented Mar 17, 2020

Closes #67

@jan-warchol
Copy link
Owner

How can I test it? I tried making a typo but nothing happened (maybe my vim is too old?).

@dngray
Copy link
Contributor Author

dngray commented Mar 17, 2020

How can I test it? I tried making a typo but nothing happened (maybe my vim is too old?).

That's exactly the issue. Seems to work in neovim but not vim 😕 I checked it with solarized8 and default too.

@jan-warchol
Copy link
Owner

How can I test it? I tried making a typo but nothing happened (maybe my vim is too old?).

That's exactly the issue. Seems to work in neovim but not vim I checked it with solarized8 and default too.

:( Well, I think getting it to work in plain vim has priority over neovim (even though I like neovim project and I've been planning to switch for some time already).

@dngray
Copy link
Contributor Author

dngray commented Mar 17, 2020

:( Well, I think getting it to work in plain vim has priority over neovim (even though I like neovim project and I've been planning to switch for some time already).

Yeah it's not my intention. I want it to work in both.

@jan-warchol jan-warchol marked this pull request as ready for review March 17, 2020 18:36
@lifepillar
Copy link

How can I test it? I tried making a typo but nothing happened (maybe my vim is too old?).

Have you set 'spell'? Is spelllang set to en or some other language?

You may find guidelines about testing certain highlight groups under :help colortemplate-best-practices.

Copy link
Contributor Author

@dngray dngray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I test it? I tried making a typo but nothing happened (maybe my vim is too old?).

Have you set 'spell'? Is spelllang set to en or some other language?

Yes I did set set spell. I observed that SpellRare doesn't seem to be showing even though I set the spellang to en_au. I currently have this in .vimrc and init.vim

set t_Co=16
set termguicolors
colorscheme selenized
set spelllang=en_au
setlocal spell spelllang=en_au
set spell
set nu
syntax on

You may find guidelines about testing certain highlight groups under :help colortemplate-best-practices.

I did have a look through that. I noticed a couple of things, for example underlining doesn't seem to work in vim, (and I know you say not to depend on that.

3861084610

I think the defaults are different which is why it works out of the box in NeoVim. I cannot seem to get the underline or SpellRare to work.

Comment on lines 107 to 110
SpellBad br_red none t=underline,reverse g=undercurl s=red
SpellCap br_red none t=underline,reverse g=undercurl s=red
SpellLocal yellow none t=underline,reverse g=undercurl s=red
SpellRare cyan none t=underline,reverse g=undercurl s=cyan
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to start with the spelling taking into consideration #47 (comment)

I noticed I couldn't get underlining in Vim to work, although it seemed to work in Neovim. Also the coloring didn't seem to work for SpellLocal or SpellRare.

I have Neovim v0.4.3 and Vim 8.2.343 my .vimrc has:

set t_Co=16
set termguicolors
colorscheme selenized
syntax on

My Neovim config is the same except that it doesn't have set t_Co=16 because that is not supported. Terminal is Alacritty.

1584423446 Any ideas?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a terminal issue? Have you tried with a different terminal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've tried with Alacritty, and Gnome Terminal, kitty and a few others same result across them all.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, it is worth opening an issue at Vim's repo, or at least ask in Vim users' mailing list.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dngray I'd suggest styling other interface elements first and leave this for later, what do you think? In the meantime maybe we'll find someone who can help us with solving it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks more or less what I suggested. Do you need any help, @dngray ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't actually had time to do this, looking at having a go with it today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks more or less what I suggested. Do you need any help, @dngray ?

I tested this, seem to be getting a variety of results. Hmm.

variety_of_results

Copy link
Contributor Author

@dngray dngray Apr 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So my guess is, not all terminals support undercurl, in the case of alacritty, it will fallback to _.

However I am not sure as to why it does not want to work in Vim with either Gnome Terminal or Alacritty.

Looking at the code colortemplate generates, we see in:

if (has('termguicolors') && &termguicolors) || has('gui_running')
    hi SpellBad guifg=NONE guibg=NONE guisp=#fa5750 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=undercurl
    hi SpellCap guifg=NONE guibg=NONE guisp=#fa5750 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=undercurl
    hi SpellLocal guifg=NONE guibg=NONE guisp=#dbb32d gui=undercurl ctermfg=NONE ctermbg=NONE cterm=undercurl
    hi SpellRare guifg=NONE guibg=NONE guisp=#41c7b9 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=undercurl
if s:t_Co >= 256
    hi SpellBad ctermfg=NONE ctermbg=NONE cterm=underline
    hi SpellCap ctermfg=NONE ctermbg=NONE cterm=underline
    hi SpellLocal ctermfg=NONE ctermbg=NONE cterm=underline
    hi SpellRare ctermfg=NONE ctermbg=NONE cterm=underline
if s:t_Co >= 16
    hi SpellBad ctermfg=NONE ctermbg=NONE cterm=underline
    hi SpellCap ctermfg=NONE ctermbg=NONE cterm=underline
    hi SpellLocal ctermfg=NONE ctermbg=NONE cterm=underline
    hi SpellRare ctermfg=NONE ctermbg=NONE cterm=underline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why reverse,underline? The style for Spell* is supposed to be undercurl, which is rendered as a swiggly underline in GUI Vim and as an underline in TUI.

cterm=undercurl is guaranteed to work in Vim. It is the right value to use.

I seem as above with cterm=undercurl.

@jan-warchol
Copy link
Owner

I've checked that it works, but I think using reverse red is way too intrusive:

image

What about just using underscores like this?

SpellBad             none          none          t=underline g=undercurl s=red
SpellCap             none          none          t=underline g=undercurl s=red
SpellLocal           none          none          t=underline g=undercurl s=yellow
SpellRare            none          none          t=underline g=undercurl s=cyan

image

@dngray
Copy link
Contributor Author

dngray commented Apr 1, 2020

#71 (comment) is that in nvim, gvim, vim-qt?

@jan-warchol
Copy link
Owner

jan-warchol commented Apr 1, 2020

That's gvim 7.4. When I tried it with terminal Vim, it used underscore instead of wavy line, and it wasn't colored red, but I think we shouldn't color the whole word.

@dngray
Copy link
Contributor Author

dngray commented Apr 4, 2020

That's gvim 7.4. When I tried it with terminal Vim, it used underscore instead of wavy line, and it wasn't colored red, but I think we shouldn't color the whole word.

So yeah, I tested this but unfortunately getting no feedback in regular Vim. I was able to get it working in gVim though.

@jan-warchol
Copy link
Owner

jan-warchol commented Apr 4, 2020

That's gvim 7.4. When I tried it with terminal Vim, it used underscore instead of wavy line, and it wasn't colored red, but I think we shouldn't color the whole word.

So yeah, I tested this but unfortunately getting no feedback in regular Vim. I was able to get it working in gVim though.

Interestingly it works for me in terminal vim, with gnome-terminal and terminator. I guess it may be terminal quirks, so as far as I'm concerned this is good enough. 👍

@dngray dngray changed the title Style remaining default groups Style spellcheck Apr 4, 2020
@jan-warchol jan-warchol merged commit 76e611f into jan-warchol:master Apr 4, 2020
@dngray dngray deleted the pr-issue67 branch April 5, 2020 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vim: style remaining default groups
4 participants