From 603eae224e871b81a410cfa789345d5f178bdbbb Mon Sep 17 00:00:00 2001 From: Reed Esau Date: Thu, 29 Jan 2015 00:16:48 -0700 Subject: [PATCH] Opt for undercurl for spell errors, for GUI #15 --- README.markdown | 17 +++++++++++++---- colors/pencil.vim | 19 +++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/README.markdown b/README.markdown index 1aee07e..f7179a7 100644 --- a/README.markdown +++ b/README.markdown @@ -57,8 +57,7 @@ When using a filetype of markdown, the ‘#’ heading text is shaded dark blue by default. This compensates for the lack of a visual cue found in iA Writer where the heading indicators are inside the left margin. -If you’re looking for neutral heading colors, set the following in your -`.vimrc`: +If you’re looking for neutral heading colors: ``` let g:pencil_neutral_headings = 1 " 0=blue (def), 1=normal @@ -69,8 +68,7 @@ let g:pencil_neutral_headings = 1 " 0=blue (def), 1=normal Similar to the rendered markdown found on GitHub, `inline` and `fenced` code blocks will have a subtle gray background. -If you’re looking for neutral code background, set the following in -your `.vimrc`: +If you’re looking for neutral code background: ``` let g:pencil_neutral_code_bg = 1 " 0=gray (def), 1=normal @@ -79,6 +77,17 @@ let g:pencil_neutral_code_bg = 1 " 0=gray (def), 1=normal See `g:pencil_higher_contrast_ui` above for adjusting the code background contrast. +### Curled Underline for Spelling Highlights + +GUI users may prefer `undercurl` to the default `underline` in +highlighting misspelled words. + +``` +let g:pencil_gui_spell_undercurl = 1 " 0=underline (def), 1=undercurl +``` + +Non-spell underlines remain non-curled. + ### Terminal Italics If you're using Vim in the terminal and your terminal supports italics, you diff --git a/colors/pencil.vim b/colors/pencil.vim index 02866a1..b42cc20 100644 --- a/colors/pencil.vim +++ b/colors/pencil.vim @@ -54,6 +54,11 @@ if ! exists("g:pencil_terminal_italics") let g:pencil_terminal_italics = 0 endif +if ! exists("g:pencil_gui_spell_undercurl") + let g:pencil_gui_spell_undercurl = 0 +endif + + " Colors let s:black = { "gui": "#212121", "cterm": "0" } let s:medium_gray = { "gui": "#767676", "cterm": "243" } @@ -135,6 +140,12 @@ else let s:code_bg = s:bg_very_subtle endif +if g:pencil_gui_spell_undercurl == 1 + let s:gui_sp_un = 'undercurl' +else + let s:gui_sp_un = 'underline' +endif + " shamelessly stolen from hemisu: https://github.com/noahfrederick/vim-hemisu/ function! s:h(group, style) " Not all terminals support italics properly. If yours does, opt-in. @@ -231,10 +242,10 @@ call s:h("DiffText", {"fg": s:dark_blue}) call s:h("SignColumn", {"fg": s:light_green}) if has("gui_running") - call s:h("SpellBad", {"gui": "underline", "sp": s:red}) - call s:h("SpellCap", {"gui": "underline", "sp": s:light_green}) - call s:h("SpellRare", {"gui": "underline", "sp": s:pink}) - call s:h("SpellLocal", {"gui": "underline", "sp": s:dark_green}) + call s:h("SpellBad", {"gui": s:gui_sp_un, "sp": s:red}) + call s:h("SpellCap", {"gui": s:gui_sp_un, "sp": s:light_green}) + call s:h("SpellRare", {"gui": s:gui_sp_un, "sp": s:pink}) + call s:h("SpellLocal", {"gui": s:gui_sp_un, "sp": s:dark_green}) else call s:h("SpellBad", {"cterm": "underline", "fg": s:red}) call s:h("SpellCap", {"cterm": "underline", "fg": s:light_green})