Closed hovsater closed 5 years ago
err no. I'll see if I can reproduce.
hmmm, can't seem to reproduce this. This is vim 8.1, iTerm2 3.1.5.
What do you have in your vimrc around enabling colours? This is what I have:
"24bit color
set termguicolors
"dark
set background=dark
" falcon settings
let g:falcon_lightline = 1
let g:lightline.colorscheme='falcon'
let g:falcon_background = 0
let g:falcon_inactive = 1
colorscheme falcon
This is my full .vimrc
:
" vimrc : My personal (n)vim configuration.
" Author: Kevin Sjöberg
"
" vim: et:ts=2:sw=2
"
" ========================================================================
" GENERAL
" ========================================================================
set nocompatible
if !has('nvim')
set noesckeys
endif
filetype plugin indent on
if has('nvim')
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
else
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
endif
if has('nvim')
call plug#begin('~/.local/share/nvim/plugged')
else
call plug#begin('~/.vim/plugged')
endif
Plug 'fatih/vim-go'
Plug 'janko-m/vim-test'
Plug 'sgur/vim-editorconfig'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-projectionist'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
Plug 'w0rp/ale'
Plug 'fenetikm/falcon'
call plug#end()
syntax on
colorscheme falcon
if $COLORTERM == 'truecolor'
set termguicolors
endif
if !has('nvim')
if &term =~# '^screen'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
endif
set autoindent
set autoread
set backspace=indent,eol,start
set belloff=all
set grepprg=rg\ --vimgrep
set hidden
set hlsearch
set incsearch
set laststatus=2
set lazyredraw
set nocursorline
set noshowcmd
set noswapfile
set nowritebackup
set number
set ruler
set splitbelow
set splitright
set ttimeout
set ttimeoutlen=50
set ttyfast
set wildmode=list:longest,full
let mapleader = "\\"
let maplocalleader = "\<Space>"
nnoremap <Leader>ve :edit $MYVIMRC<CR>
nnoremap <Leader>vs :source $MYVIMRC<CR>
" ========================================================================
" PLUGINS
" ========================================================================
" ALE
let g:ale_fix_on_save = 1
let g:ale_lint_on_enter = 0
let g:ale_lint_on_filetype_changed = 0
let g:ale_lint_on_text_changed = 'never'
let g:ale_fixers = { 'elm': ['elm-format'] }
nmap <silent> [W <Plug>(ale_first)
nmap <silent> [w <Plug>(ale_previous)
nmap <silent> ]w <Plug>(ale_next)
nmap <silent> ]W <Plug>(ale_last)
" FZF
if isdirectory('/usr/local/opt/fzf')
set rtp+=/usr/local/opt/fzf
nnoremap <C-p> :FZF<CR>
endif
" Go
let g:go_fmt_command = 'goimports'
" netrw
let g:netrw_localrmdir='rm -r'
" Test
if has('nvim')
let test#strategy = 'neovim'
else
let test#strategy = 'vimterminal'
endif
nmap <silent> t<C-n> :TestNearest<CR>
nmap <silent> t<C-f> :TestFile<CR>
nmap <silent> t<C-s> :TestSuite<CR>
nmap <silent> t<C-l> :TestLast<CR>
nmap <silent> t<C-g> :TestVisit<CR>
" Polyglot
let g:polyglot_disabled = ['go', 'clojure']
I'm also running Vim 8.1 on Mac OS with iTerm 3.2.8.
hmmm, do you have italics enabled in the terminal? comments are set to show in italics. I wonder if it is because the terminal is interpreting italics as reversed text.
This is what I have in the config for the fonts in iTerm2. I have now upgraded to iTerm2 3.2.9 and it still looks ok on my machine.
@fenetikm yes, italics are enabled. I even tried with your exact settings. Same issue.
...and you are seeing italics elsewhere in the terminal? I started up vim with your .vimrc
and it looks as expected. What settings do you have on ther Terminal
settings panel? what output do you get for echo $TERM
?
do you see italics from the following in the terminal echo -e "\e[3mfoo\e[23m"
The problem you are seeing looks similar to this: https://stackoverflow.com/questions/29679501/my-italic-font-vim-iterm2-on-mac-not-working#29712391
echo $TERM
output xterm-256color
.echo &term
within vim output xterm-256color
echo -e "\e[3mfoo\e[23m"
output foo
in italicsI've also completely reset iTerm2, still same result. I've noticed that setting the following in my .vimrc
make the problem go away. It will properly render the comments in italics.
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
However, I have no idea what it does, why it works and why it's needed in my case.
Digging into this further it looks like the terminfo database shipping with Mac OS was at fault. Libraries that read terminfo entries are expected to check for a TERMINFO directory first, look at $HOME/.terminfo if TERMINFO is not set, and finally look in /usr/share/terminfo.
I decided to compile an up-to-date terminfo database in $HOME/.terminfo
:
curl -LO http://invisible-island.net/datafiles/current/terminfo.src.gz
gunzip terminfo.src.gz
tic -x -o $HOME/.terminfo terminfo.src
After doing this, I could remove what I previously had in my .vimrc
:
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
With the new terminfo database, it also support the tmux-256color
term, so I changed my .tmux.conf
to include the following:
set -s default-terminal "tmux-256color"
set -ga terminal-overrides ',xterm-256color:Tc'
In my .vimrc
I added the following snippet to ensure truecolor support will work under tmux as well. See :help xterm-true-color
for more information.
if $COLORTERM == 'truecolor'
set termguicolors
if !has('nvim')
if &term =~# '^tmux'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
endif
endif
Everything now works perfectly in both vim/neovim inside/outside tmux!
So these lines:
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
Refer to the terminal options in Vim and you are essentially telling Vim what escape codes it should look for with respect to turning italic on and off.
Yeah, I too rebuilt the terminfo but had forgot about that. Glad we finally got to the bottom of it!
Are comments intended to look like the screenshot below?
This is using the latest version of Vim and iTerm2 using the Falcon colorscheme in both Vim and the terminal.