From b9324d1735120dc978d675821c0ed2d1140ac3d7 Mon Sep 17 00:00:00 2001 From: Alexander Karle Date: Tue, 13 Mar 2018 15:35:40 -0400 Subject: [PATCH] Italics in tmux and vim and iTerm2 This may break some things... --- terminfo/README.md | 7 +++++++ terminfo/tmux-256color.terminfo | 6 ++++++ terminfo/xterm-256color-italic.terminfo | 14 ++++++++++++++ tmux.conf | 5 +++-- vim/theme.vim | 3 ++- zshrc | 6 ++++++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 terminfo/README.md create mode 100644 terminfo/tmux-256color.terminfo create mode 100644 terminfo/xterm-256color-italic.terminfo diff --git a/terminfo/README.md b/terminfo/README.md new file mode 100644 index 0000000..e29390e --- /dev/null +++ b/terminfo/README.md @@ -0,0 +1,7 @@ +# Terminfo Dotfiles + +At the time of adding, the sole purpose of these files is to add italics support to iTerm2, tmux, and vim. + +For the setup instructions, see this [link](https://alexpearce.me/2014/05/italics-in-iterm2-vim-tmux/). + +Also check out [this link](https://medium.com/@dubistkomisch/how-to-actually-get-italics-and-true-colour-to-work-in-iterm-tmux-vim-9ebe55ebc2be) for the tmux parts that got it working for me. diff --git a/terminfo/tmux-256color.terminfo b/terminfo/tmux-256color.terminfo new file mode 100644 index 0000000..8fd4cd4 --- /dev/null +++ b/terminfo/tmux-256color.terminfo @@ -0,0 +1,6 @@ +# A tmux-256color based TERMINFO that adds the escape sequences for italic. +# CREDIT: https://medium.com/@dubistkomisch/how-to-actually-get-italics-and-true-colour-to-work-in-iterm-tmux-vim-9ebe55ebc2be +tmux-256color|tmux with 256 colors, + ritm=\E[23m, rmso=\E[27m, sitm=\E[3m, smso=\E[7m, Ms@, + khome=\E[1~, kend=\E[4~, + use=xterm-256color, use=screen-256color, diff --git a/terminfo/xterm-256color-italic.terminfo b/terminfo/xterm-256color-italic.terminfo new file mode 100644 index 0000000..e072d29 --- /dev/null +++ b/terminfo/xterm-256color-italic.terminfo @@ -0,0 +1,14 @@ +# A xterm-256color based TERMINFO that adds the escape sequences for italic. +# +# Install: +# +# tic xterm-256color-italic.terminfo +# +# Usage: +# +# export TERM=xterm-256color-italic +# +# CREDIT: https://gist.github.com/sos4nt/3187620 +xterm-256color-italic|xterm with 256 colors and italic, + sitm=\E[3m, ritm=\E[23m, + use=xterm-256color, diff --git a/tmux.conf b/tmux.conf index 6d5af21..76295be 100644 --- a/tmux.conf +++ b/tmux.conf @@ -16,9 +16,10 @@ bind c new-window -c "#{pane_current_path}" bind r source-file ~/.tmux.conf; display "reloaded" # Add truecolor support -set-option -ga terminal-overrides ",xterm-256color:Tc" +# set-option -ga terminal-overrides ",xterm-256color:Tc" # Default terminal is 256 colors -set -g default-terminal "screen-256color" +set -g default-terminal 'tmux-256color' +set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m' # switch panes using vim keys bind C-h select-pane -L diff --git a/vim/theme.vim b/vim/theme.vim index d799b82..580fed9 100644 --- a/vim/theme.vim +++ b/vim/theme.vim @@ -23,13 +23,14 @@ if (has("termguicolors")) " load colorscheme if plugins installed if filereadable(expand("~/.vim/bundle/vim-one/colors/one.vim")) + let g:one_allow_italics = 1 colorscheme one " reverse one-dark's fold colors highlight Folded guibg=#282c34 guifg=#5c6370 endif " Needed for termgui in tmux--&term begins w screen-... - if &term =~# '^screen' + if &term =~# '^tmux' " Set the terminal foreground+background colors " See :h xterm-true-color let &t_8f = "\[38;2;%lu;%lu;%lum" diff --git a/zshrc b/zshrc index 2b659a7..4b75eec 100644 --- a/zshrc +++ b/zshrc @@ -15,6 +15,9 @@ export DEFAULT_USER="$(whoami)" # prevent zsh from renaming tmux windows DISABLE_AUTO_TITLE="true" +# export editor for tmuxinator +# export EDITOR="vim" + # vi keymap in terminal # credit: Doug Black (https://dougblack.io/words/zsh-vi-mode.html) bindkey -v @@ -38,5 +41,8 @@ zle -N zle-keymap-select # alias vim='nvim' alias dps="docker ps -a" +# ITALICS UPDATE: may break ssh? +# alias ssh='TERM=xterm-256color ssh' + # cd to a parent directory function pcd { cd ${PWD%/$1/*}/$1; } -- libgit2 0.28.4