Skip to content

Commit

Permalink
Implement config to toggle underlines
Browse files Browse the repository at this point in the history
All underlines can be disabled globally with the
"g:nord_underline" config.

GH-106
  • Loading branch information
dylnmc authored and arcticicestudio committed Jun 23, 2018
1 parent 9e7addb commit 3b30630
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -141,6 +142,22 @@ let g:nord_italic = 1
<p align="center"><strong>Italic formatting in Markdown</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-config-italic-markdown.png"/></p>
### 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
```
<p align="center"><strong>Underlined Text</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-config-underline.png"/></p>
### Italic Comments
**This option only takes effect if the option for [italic text support](#italic-support) has been enabled!**
Expand Down
Binary file added assets/scrot-config-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 17 additions & 12 deletions colors/nord.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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, "", "")
Expand All @@ -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 -+
Expand Down Expand Up @@ -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 ---+
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3b30630

Please sign in to comment.