Closed jawang35 closed 3 years ago
This won't have any effect on terminals that don't support italics.
This does not apply to my setup:
Here is a picture how it looks like. Anybody got an idea how to fix this?
This happened to me too, on Kitty with the light theme. I was able to fix it by adding this line to my .vimrc:
hi Comment gui=NONE cterm=NONE
This basically cancels out the change. It's weird because Kitty supposedly supports italic fonts. Maybe I don't have my fonts configured correctly.
Edit: The font I'm using (Fira Code) apparently doesn't have an italic variant, which I guess results in the gray background.
@fatteneder usually most terminals will have options to enable/disable bold and italic font styles. Maybe you can check your alacritty config? I don't use alacritty myself but a google search turned up some results such as this: https://github.com/alacritty/alacritty/issues/1977.
Terminals that don't support italics will indicate so in their terminfo file. AFAIK Alacritty and Kitty (which I use) both support italics. I'm guessing the issue you're seeing is probably @garrettn's suggestion that your font might not support italics. You should be able to specify a non-italic font in your terminal.
For Alacritty, in your alacritty.yml
(using Fira Code as an example):
font:
italic:
family: Fira Code
style: Regular
bold_italic:
family: Fira Code
style: Bold
For Kitty, in your kitty.conf
(using Fira Code as an example):
italic_font Fira Code Regular
bold_italic_font Fira Code Bold
Thank you for all the replies.
After I wrote this issue yesterday I did some research myself and also tried to enable an italic font in my .alacritty.yaml
.
I could not get it to work yet. Interestingly, other terminals (Terminal.app and iTerm2) I tested also do not display italic fonts, but MacVim does. So this seems to be a more general problem with my setup which started showing up after updating my system yesterday. Since then I have also missing symbols in my vim-airline
status line...
Anyways, for now I will use @garrettn's fix till I figure out how to get italics to work.
I have same issue as @fatteneder , my platform is macOS Big Sur with iTerm2 (font is Hack that support italic).
I change line 126 on onehalf/vim/colors/onehalflight.vim
call s:h("Comment", s:comment_fg, "", "italic")
to
call s:h("Comment", s:comment_fg, "", "")
then it is ok.
@fatteneder You can check this link to get italic to work.
@jawang35 I suggest disable italic on the default setting, then add a vim variable to enable italic.
@marcuslannister that's a good suggestion and it looks like other color schemes use the same pattern. I've implemented it in https://github.com/sonph/onehalf/pull/108.
If you still want comments in italic in iterm+tmux (taken from here):
File xterm-256color-italic.terminfo:
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
xterm-256color-italic|xterm with 256 colors and italic,
sitm=\E[3m, ritm=\E[23m,
use=xterm-256color,
File tmux-256color-italic.terminfo:
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
tmux-256color-italic|tmux with 256 colors and italic,
sitm=\E[3m, ritm=\E[23m,
use=xterm-256color,
tic xterm-256color-italic.terminfo
tic tmux-256color-italic.terminfo
Figure out how to set your terminals $TERM variable to xterm-256color-italic. In iTerm it's in Prefs -> profiles -> Terminal -> Report Terminal Type.
In your .tmux.conf file:
# tmux display in 256 colours
set -g default-terminal "tmux-256color-italic"
# enable terminal compatibility with outside terminal
set-option -ga terminal-overrides ",xterm-256color-italic:Tc"
You may also find this article useful (to enable italic in iterm): https://alexpearce.me/2014/05/italics-in-iterm2-vim-tmux/
Italicized comments are popular for Vim users and IMO they look pretty good. This won't have any effect on terminals that don't support italics.