Right now, vim-colors-solarized/colors/solarized.vim lines 137-157 employ an if/else tree to determine compatibility with italics by testing against a hard-coded list of known-compatible terminal emulators:
" Terminals that support italics
let s:terms_italic=[
\"rxvt",
\"gnome-terminal"
\]
" For reference only, terminals are known to be incomptible.
" Terminals that are in neither list need to be tested.
let s:terms_noitalic=[
\"iTerm.app",
\"Apple_Terminal"
\]
if has("gui_running")
let s:terminal_italic=1 " TODO: could refactor to not require this at all
else
let s:terminal_italic=0 " terminals will be guilty until proven compatible
for term in s:terms_italic
if $TERM_PROGRAM =~ term
let s:terminal_italic=1
endif
endfor
endif
I think a more general approach would be to shell out to tput and test for a correct sitm entry:
if has("gui_running") || ( has("unix") && system("tput sitm") == "\033[3m" )
let s:terminal_italic=1
else
let s:terminal_italic=0
endif
Thanks, @AprilArcus! In addition to implementing your edit to .vim/colors/solarized.vim, I also had to follow this Gist and add these two lines to my .vimrc, using <Ctrl-v><Esc> to enter ^[:
Italics are now supported in iTerm2, if the user supplies an emended terminfo file. See Enabling italic fonts in iTerm2, tmux, and vim by Alex Pierce for a detailed walkthrough.
Right now,
vim-colors-solarized/colors/solarized.vim
lines 137-157 employ an if/else tree to determine compatibility with italics by testing against a hard-coded list of known-compatible terminal emulators:I think a more general approach would be to shell out to
tput
and test for a correctsitm
entry:I think this should cover all the bases.