From 3b306306cb94e8e31769504bffb8abb440b41459 Mon Sep 17 00:00:00 2001 From: dylnmc Date: Fri, 9 Mar 2018 23:04:21 -0500 Subject: Implement config to toggle underlines All underlines can be disabled globally with the "g:nord_underline" config. GH-106 --- README.md | 17 +++++++++++++++++ assets/scrot-config-underline.png | Bin 0 -> 21507 bytes colors/nord.vim | 29 +++++++++++++++++------------ 3 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 assets/scrot-config-underline.png diff --git a/README.md b/README.md index c56eb13..cbf499b 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Nord Vim is a 16 colorspace theme build to run in GUI- and terminal mode with su - [Activation](#activation) - [Configuration](#configuration) - [Italic Support](#italic-support) + - [Underline Support](#underline-support) - [Italic Comments](#italic-comments) - [Uniform Status Lines](#uniform-status-lines) - [Comment Contrast](#comment-contrast) @@ -141,6 +142,22 @@ let g:nord_italic = 1

Italic formatting in Markdown

+### Underline Support + +**This option should only be enabled if your terminal emulator supports underlines!** + +Can be enabled to support underlined text. + +Most terminals are not capable to handle underlines right so Nord disables these for terminals by default while it should work out-of-the-box™ in GUI mode. + +Set `g:nord_underline` to `1` to enforce displaying underlines. + +```vim +let g:nord_underline = 1 +``` + +

Underlined Text

+ ### Italic Comments **This option only takes effect if the option for [italic text support](#italic-support) has been enabled!** diff --git a/assets/scrot-config-underline.png b/assets/scrot-config-underline.png new file mode 100644 index 0000000..964b357 Binary files /dev/null and b/assets/scrot-config-underline.png differ diff --git a/colors/nord.vim b/colors/nord.vim index df8997b..22c1198 100755 --- a/colors/nord.vim +++ b/colors/nord.vim @@ -84,6 +84,11 @@ if g:nord_italic == 0 let s:italic = "" endif +let s:underline = "underline," +if ! get(g:, "nord_underline", 1) + let s:underline = "NONE," +endif + let s:italicize_comments = "" if exists("g:nord_italic_comments") if g:nord_italic_comments == 1 @@ -121,7 +126,7 @@ function! s:hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) exec "hi " . a:group . " ctermbg=" . a:ctermbg endif if a:attr != "" - exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . substitute(a:attr, "undercurl", s:underline, "") endif if a:guisp != "" exec "hi " . a:group . " guisp=" . a:guisp @@ -134,7 +139,7 @@ endfunction "+--- Attributes ---+ call s:hi("Bold", "", "", "", "", "bold", "") call s:hi("Italic", "", "", "", "", s:italic, "") -call s:hi("Underline", "", "", "", "", "underline", "") +call s:hi("Underline", "", "", "", "", s:underline, "") "+--- Editor ---+ call s:hi("ColorColumn", "", s:nord1_gui, "NONE", s:nord1_term, "", "") @@ -151,10 +156,10 @@ call s:hi("PmenuSbar", s:nord4_gui, s:nord2_gui, "NONE", s:nord1_term, "", "") call s:hi("PMenuSel", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "", "") call s:hi("PmenuThumb", s:nord8_gui, s:nord3_gui, "NONE", s:nord3_term, "", "") call s:hi("SpecialKey", s:nord3_gui, "", s:nord3_term, "", "", "") -call s:hi("SpellBad", "", s:nord0_gui, "", "NONE", "undercurl", s:nord11_gui) -call s:hi("SpellCap", "", s:nord0_gui, "", "NONE", "undercurl", s:nord13_gui) -call s:hi("SpellLocal", "", s:nord0_gui, "", "NONE", "undercurl", s:nord5_gui) -call s:hi("SpellRare", "", s:nord0_gui, "", "NONE", "undercurl", s:nord6_gui) +call s:hi("SpellBad", s:nord11_gui, s:nord0_gui, s:nord11_term, "NONE", "undercurl", s:nord11_gui) +call s:hi("SpellCap", s:nord13_gui, s:nord0_gui, s:nord13_term, "NONE", "undercurl", s:nord13_gui) +call s:hi("SpellLocal", s:nord5_gui, s:nord0_gui, s:nord5_term, "NONE", "undercurl", s:nord5_gui) +call s:hi("SpellRare", s:nord6_gui, s:nord0_gui, s:nord6_term, "NONE", "undercurl", s:nord6_gui) call s:hi("Visual", "", s:nord2_gui, "", s:nord1_term, "", "") call s:hi("VisualNOS", "", s:nord2_gui, "", s:nord1_term, "", "") "+- Neovim Support -+ @@ -218,7 +223,7 @@ call s:hi("WarningMsg", s:nord0_gui, s:nord13_gui, s:nord1_term, s:nord13_term, call s:hi("WildMenu", s:nord8_gui, s:nord1_gui, s:nord8_term, s:nord1_term, "", "") "+--- Search ---+ -call s:hi("IncSearch", s:nord1_gui, s:nord8_gui, s:nord1_term, s:nord8_term, "underline", "") +call s:hi("IncSearch", s:nord1_gui, s:nord8_gui, s:nord1_term, s:nord8_term, s:underline, "") call s:hi("Search", s:nord1_gui, s:nord8_gui, s:nord1_term, s:nord8_term, "NONE", "") "+--- Tabs ---+ @@ -295,7 +300,7 @@ hi! link csXmlTag SpecialComment call s:hi("cssAttributeSelector", s:nord7_gui, "", s:nord7_term, "", "", "") call s:hi("cssDefinition", s:nord7_gui, "", s:nord7_term, "", "NONE", "") -call s:hi("cssIdentifier", s:nord7_gui, "", s:nord7_term, "", "underline", "") +call s:hi("cssIdentifier", s:nord7_gui, "", s:nord7_term, "", s:underline, "") call s:hi("cssStringQ", s:nord7_gui, "", s:nord7_term, "", "", "") hi! link cssAttr Keyword hi! link cssBraces Delimiter @@ -340,7 +345,7 @@ call s:hi("goBuiltins", s:nord7_gui, "", s:nord7_term, "", "", "") hi! link goConstants Keyword call s:hi("helpBar", s:nord3_gui, "", s:nord3_term, "", "", "") -call s:hi("helpHyperTextJump", s:nord8_gui, "", s:nord8_term, "", "underline", "") +call s:hi("helpHyperTextJump", s:nord8_gui, "", s:nord8_term, "", s:underline, "") call s:hi("htmlArg", s:nord7_gui, "", s:nord7_term, "", "", "") call s:hi("htmlLink", s:nord4_gui, "", "", "", "NONE", "NONE") @@ -430,7 +435,7 @@ hi! link rubyPseudoVariable Keyword hi! link rubyRegexp SpecialChar call s:hi("sassClass", s:nord7_gui, "", s:nord7_term, "", "", "") -call s:hi("sassId", s:nord7_gui, "", s:nord7_term, "", "underline", "") +call s:hi("sassId", s:nord7_gui, "", s:nord7_term, "", s:underline, "") hi! link sassAmpersand Keyword hi! link sassClassChar Delimiter hi! link sassControl Keyword @@ -506,7 +511,7 @@ call s:hi("gitcommitSelectedFile", s:nord14_gui, "", s:nord14_term, "", "", "") " davidhalter/jedi-vim call s:hi("jediFunction", s:nord4_gui, s:nord3_gui, "", s:nord3_term, "", "") -call s:hi("jediFat", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "bold,underline", "") +call s:hi("jediFat", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, s:underline."bold", "") " NERDTree " > scrooloose/nerdtree @@ -577,7 +582,7 @@ else endfor endif -call s:hi("VimwikiLink", s:nord8_gui, "", s:nord8_term, "", "underline", "") +call s:hi("VimwikiLink", s:nord8_gui, "", s:nord8_term, "", s:underline, "") hi! link VimwikiHeaderChar markdownHeadingDelimiter hi! link VimwikiHR Keyword hi! link VimwikiList markdownListMarker -- cgit v1.2.3-70-g09d2