Skip to content

Commit

Permalink
Add configuration for italic text
Browse files Browse the repository at this point in the history
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) #84

GH-88
  • Loading branch information
arcticicestudio committed Dec 29, 2017
1 parent 53fce0d commit bc6e2fc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 24 deletions.
44 changes: 33 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`.
Expand All @@ -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.

Expand All @@ -132,7 +151,8 @@ let g:nord_uniform_status_lines = 1

<align="center"><strong>Default status lines</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-config-uniform-status-lines-default.png"/><br><strong>Uniform status lines</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-vim/develop/assets/scrot-config-uniform-status-lines.png"/></p>

### 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`!
Expand All @@ -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`.
Expand Down Expand Up @@ -206,8 +227,7 @@ Please report issues/bugs, feature requests and suggestions for improvements to
<p align="center"><a href="https://github.com/arcticicestudio/nord-vim/blob/develop/LICENSE.md"><img src="https://img.shields.io/badge/License-MIT-5E81AC.svg?style=flat-square"/></a> <a href="https://creativecommons.org/licenses/by-sa/4.0"><img src="https://img.shields.io/badge/License-CC_BY--SA_4.0-5E81AC.svg?style=flat-square"/></a></p>

[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
Expand All @@ -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
Binary file added assets/scrot-config-italic-comments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 24 additions & 13 deletions colors/nord.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 ---+
Expand Down Expand Up @@ -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, "", "", "")
Expand All @@ -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, "", "", "")
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bc6e2fc

Please sign in to comment.