Disable terminal italics by default, opt-in w/ var

Yes, terminal emulation is a ghetto.  Why should that surprise you?
This commit is contained in:
Matthew Lyon
2014-09-03 22:34:33 -07:00
parent 0adfc1b534
commit b79c5177ca
2 changed files with 19 additions and 0 deletions

View File

@@ -64,6 +64,16 @@ If youre looking for neutral heading colors, set the following in your
let g:pencil_neutral_headings = 1 " 0=blue (def), 1=normal
```
### Terminal Italics
If you're using Vim in the terminal and your terminal supports italics, you
can opt-in to italic support for some syntax highlighting, such as comments,
by setting the following in your `.vimrc`:
```
let g:pencil_terminal_italics = 1
```
### Airline Theme
![airline-example](http://i.imgur.com/V39pwZq.png)

View File

@@ -45,6 +45,11 @@ if ! exists("g:pencil_neutral_headings")
let g:pencil_neutral_headings = 0
endif
" not all terminals support italics properly. If yours does, opt-in.
if ! exists("g:pencil_terminal_italics")
let g:pencil_terminal_italics = 0
endif
" Colors
let s:black = { "gui": "#212121", "cterm": "0" }
let s:medium_gray = { "gui": "#767676", "cterm": "243" }
@@ -122,6 +127,10 @@ 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.
if g:pencil_terminal_italics == 0 && has_key(a:style, "cterm") && a:style["cterm"] == "italic"
unlet a:style.cterm
endif
execute "highlight" a:group
\ "guifg=" (has_key(a:style, "fg") ? a:style.fg.gui : "NONE")
\ "guibg=" (has_key(a:style, "bg") ? a:style.bg.gui : "NONE")