From bc6e2fc05148dee914141a07fcefb75ac3a819e1 Mon Sep 17 00:00:00 2001
From: Arctic Ice Studio
Date: Fri, 29 Dec 2017 10:15:20 +0100
Subject: Add configuration for italic text
The configuration to enable italic comments (1) is like the name suggests
limited to comments only, but there are other use cases like the
italic style in Markdown (2).
This commit adds a new theme configuration to explicitly enable italics.
The configurations is enabled by default when running in "gui" mode and
is disabled by default in "term" mode.
The reason for this standard behavior is the fact that there are still
shells and terminals which are not able to handle italics. Enabling
italics for terminals by default would cause unpredictable bugs and
graphical glitches.
The new configuration is named "nord_italic".
References:
(1) https://github.com/arcticicestudio/nord-vim#italic-comments
(2) https://github.com/arcticicestudio/nord-vim/issues/84
GH-88
---
README.md | 44 ++++++++++++++++++++++++--------
assets/scrot-config-italic-comments.png | Bin 0 -> 135518 bytes
colors/nord.vim | 37 +++++++++++++++++----------
3 files changed, 57 insertions(+), 24 deletions(-)
create mode 100644 assets/scrot-config-italic-comments.png
diff --git a/README.md b/README.md
index af8d63d..db6c3f8 100644
--- a/README.md
+++ b/README.md
@@ -19,10 +19,11 @@ Nord Vim is a 16 colorspace theme build to run in GUI- and terminal mode with su
- [Manual](#manual)
- [Activation](#activation)
- [Configuration](#configuration)
- - [Italic comments](#italic-comments)
- - [Uniform status lines](#uniform-status-lines)
- - [Comment contrast](#comment-contrast)
- - [Uniform diff background](#uniform-diff-background)
+ - [Italic Support](#italic)
+ - [Italic Comments](#italic-comments)
+ - [Uniform Status Lines](#uniform-status-lines)
+ - [Comment Contrast](#comment-contrast)
+ - [Uniform diff Background](#uniform-diff-background)
- [Plugin Support](#plugin-support)
- [UI Plugins](#ui-plugins)
- [Language Plugins](#language-plugins)
@@ -104,12 +105,28 @@ Plug 'arcticicestudio/nord-vim', { 'on': 'NERDTreeToggle' }
```
## Configuration
+
All options should be set **before** the [activation](#activation) command!
-### Italic comments
+### Italic Support
+
**This option should only be enabled if your terminal emulator supports italics!**
-Enable to use italic font for all comments.
+Enables support for italic text.
+
+Most terminals don't handle italics right so Nord disables italics for terminals by default while in GUI mode this option is enabled by default.
+
+Italics for terminals can be enabled by setting the `g:nord_italic` to `1` to enforce displaying italics.
+
+```vim
+let g:nord_italic = 1
+```
+
+### Italic Comments
+
+**This option only takes effect if the option for [italic text support](#italic-support) has been enabled!**
+
+Enable to italicize all comments.
To adhere to the Nord style guide this option is disabled by default.
It can be enabled by setting the `g:nord_italic_comments` variable to `1`.
@@ -118,7 +135,9 @@ It can be enabled by setting the `g:nord_italic_comments` variable to `1`.
let g:nord_italic_comments = 1
```
-### Uniform status lines
+![][scrot-config-italic-comments]
+
+### Uniform Status Lines
Enables uniform activate- and inactive status lines using `nord3` as background.
@@ -132,7 +151,8 @@ let g:nord_uniform_status_lines = 1
Default status lines

Uniform status lines

-### Comment contrast
+### Comment Contrast
+
**This option should only be enabled if your terminal emulator supports 24bit true color (16 million colors)!**
This option is only visible if `termguicolors` is enabled in your `~/.vimrc` or set via `:set termguicolors`!
@@ -148,7 +168,8 @@ To adhere to the Nord style guide this option uses `nord3` by default.
More information about true color and the support in various terminals can be found in [this gist][gist-true-color].
-### Uniform diff background
+### Uniform `diff` Background
+
By default, Nord Vim provides colorful backgrounds when used in *diff* mode `vimdiff`/`vim -d`.
This can be changed to `nord1` as uniform *diff* background color by setting the `g:nord_uniform_diff_background` variable to `1`.
@@ -206,8 +227,7 @@ Please report issues/bugs, feature requests and suggestions for improvements to

[gist-true-color]: https://gist.github.com/XVilka/8346728
-[scrot-readme-default-profile]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/src/assets/scrot-readme-default-profile.png
-[scrot-readme-lazy-profile-change]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/src/assets/scrot-readme-lazy-profile-change.png
+[scrot-config-italic-comments]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-config-italic-comments.png
[scrot-lang-c]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-lang-c.png
[scrot-lang-css]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-lang-css.png
[scrot-lang-html]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-lang-html.png
@@ -218,3 +238,5 @@ Please report issues/bugs, feature requests and suggestions for improvements to
[scrot-lang-php]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-lang-php.png
[scrot-lang-python]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-lang-python.png
[scrot-lang-ruby]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-lang-ruby.png
+[scrot-readme-default-profile]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/src/assets/scrot-readme-default-profile.png
+[scrot-readme-lazy-profile-change]: https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/src/assets/scrot-readme-lazy-profile-change.png
diff --git a/assets/scrot-config-italic-comments.png b/assets/scrot-config-italic-comments.png
new file mode 100644
index 0000000..edd9d95
Binary files /dev/null and b/assets/scrot-config-italic-comments.png differ
diff --git a/colors/nord.vim b/colors/nord.vim
index 0c48df6..a55a006 100755
--- a/colors/nord.vim
+++ b/colors/nord.vim
@@ -71,8 +71,24 @@ let s:nord3_gui_brightened = [
\ "#7b88a1",
\ ]
-if !exists("g:nord_italic_comments")
- let g:nord_italic_comments = 0
+if !exists("g:nord_italic")
+ if has("gui_running") || $TERM_ITALICS == "true"
+ let g:nord_italic=1
+ else
+ let g:nord_italic=0
+ endif
+endif
+
+let s:italic = "italic,"
+if g:nord_italic == 0
+ let s:italic = ""
+endif
+
+let s:italicize_comments = ""
+if exists("g:nord_italic_comments")
+ if g:nord_italic_comments == 1
+ let s:italicize_comments = s:italic
+ endif
endif
if !exists('g:nord_uniform_status_lines')
@@ -88,11 +104,6 @@ if !exists("g:nord_uniform_diff_background")
endif
function! s:hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp)
- let l:attr = a:attr
- if g:nord_italic_comments == 0 && l:attr ==? 'italic'
- let l:attr= 'NONE'
- endif
-
if a:guifg != ""
exec "hi " . a:group . " guifg=" . a:guifg
endif
@@ -106,7 +117,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=" . l:attr . " cterm=" . l:attr
+ exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
endif
if a:guisp != ""
exec "hi " . a:group . " guisp=" . a:guisp
@@ -118,7 +129,7 @@ endfunction
"+---------------+
"+--- Attributes ---+
call s:hi("Bold", "", "", "", "", "bold", "")
-call s:hi("Italic", "", "", "", "", "italic", "")
+call s:hi("Italic", "", "", "", "", s:italic, "")
call s:hi("Underline", "", "", "", "", "underline", "")
"+--- Editor ---+
@@ -211,7 +222,7 @@ call s:hi("VertSplit", s:nord2_gui, s:nord1_gui, s:nord3_term, s:nord1_term, "NO
"+----------------------+
call s:hi("Boolean", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Character", s:nord14_gui, "", s:nord14_term, "", "", "")
-call s:hi("Comment", s:nord3_gui_brightened[g:nord_comment_brightness], "", s:nord3_term, "", "italic", "")
+call s:hi("Comment", s:nord3_gui_brightened[g:nord_comment_brightness], "", s:nord3_term, "", s:italicize_comments, "")
call s:hi("Conditional", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Constant", s:nord4_gui, "", "NONE", "", "", "")
call s:hi("Define", s:nord9_gui, "", s:nord9_term, "", "", "")
@@ -229,7 +240,7 @@ call s:hi("PreProc", s:nord9_gui, "", s:nord9_term, "", "NONE", "")
call s:hi("Repeat", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Special", s:nord4_gui, "", "NONE", "", "", "")
call s:hi("SpecialChar", s:nord13_gui, "", s:nord13_term, "", "", "")
-call s:hi("SpecialComment", s:nord8_gui, "", s:nord8_term, "", "italic", "")
+call s:hi("SpecialComment", s:nord8_gui, "", s:nord8_term, "", s:italicize_comments, "")
call s:hi("Statement", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("StorageClass", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("String", s:nord14_gui, "", s:nord14_term, "", "", "")
@@ -488,7 +499,7 @@ call s:hi("plugDeleted", s:nord11_gui, "", "", s:nord11_term, "", "")
"+--- Languages ---+
" JavaScript
" > pangloss/vim-javascript
-call s:hi("jsGlobalNodeObjects", s:nord8_gui, "", s:nord8_term, "", "italic", "")
+call s:hi("jsGlobalNodeObjects", s:nord8_gui, "", s:nord8_term, "", s:italic, "")
hi! link jsBrackets Delimiter
hi! link jsFuncCall Function
hi! link jsFuncParens Delimiter
@@ -514,7 +525,7 @@ hi! link mkdFootnotes mkdFootnote
hi! link mkdLink markdownLinkText
hi! link mkdURL markdownUrl
hi! link mkdInlineURL mkdURL
-hi! link mkdID Identifier "CHECK
+hi! link mkdID Identifier
hi! link mkdLinkDef mkdLink
hi! link mkdLinkDefTarget mkdURL
hi! link mkdLinkTitle mkdInlineURL
--
cgit v1.2.3-70-g09d2