Skip to content

Commit

Permalink
Fix terminal italics (urxvt + tmux)
Browse files Browse the repository at this point in the history
Test with `$ echo -e "\e[3mitalic\e[0m"`
  • Loading branch information
sentientwaffle committed Nov 17, 2015
1 parent 48a94c5 commit aec573e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 43 deletions.
6 changes: 5 additions & 1 deletion .bashrc
Expand Up @@ -103,7 +103,11 @@ complete -F _complete mux pass ssh
# ##############################################################################

if [[ -n "$DISPLAY" && "$TERM" == 'xterm' ]]; then
export TERM=screen-256color
if [[ -f /usr/share/terminfo/t/tmux-256color ]]; then
export TERM=tmux-256color
else
export TERM=screen-256color
fi
fi

if [[ -x /usr/bin/dircolors ]]; then
Expand Down
2 changes: 1 addition & 1 deletion .tmux.conf
Expand Up @@ -96,4 +96,4 @@ set-option -g display-panes-colour colour166 #orange
# clock
set-window-option -g clock-mode-colour colour64 #green

set -g default-terminal "screen-256color"
set -g default-terminal "tmux-256color"
12 changes: 5 additions & 7 deletions .vim/colors/custom.vim
Expand Up @@ -18,7 +18,6 @@ hi String ctermfg=107
hi SpecialChar ctermfg=184

" Constants
" 135 -> 67,153
hi Boolean ctermfg=67
hi Number ctermfg=67
hi Float ctermfg=67
Expand All @@ -27,14 +26,13 @@ hi Debug ctermfg=225 cterm=bold
hi Define ctermfg=81
hi Delimiter ctermfg=241

" 118 -> 221
hi Function ctermfg=221
" 81 -> 160
" json object key
hi Label ctermfg=221
hi Special ctermfg=160

hi Ignore ctermfg=244 ctermbg=232

hi Label ctermfg=229 cterm=none
hi Macro ctermfg=137

hi MatchParen ctermfg=233 ctermbg=251
Expand All @@ -53,7 +51,7 @@ hi Statement ctermfg=166
hi PreCondit ctermfg=221 cterm=bold
hi PreProc ctermfg=221
hi Question ctermfg=81
hi Search ctermfg=0 ctermbg=222 cterm=NONE
hi Search ctermfg=0 ctermbg=222 cterm=none
hi IncSearch ctermfg=193 ctermbg=16

" marks column
Expand Down Expand Up @@ -125,7 +123,6 @@ hi WarningMsg ctermfg=231 ctermbg=none
" -----------------------------------------------------------------------------
" Diff
" -----------------------------------------------------------------------------

" vimdiff
hi DiffAdd ctermfg=107
hi DiffChange ctermfg=181
Expand All @@ -139,7 +136,6 @@ hi diffRemoved ctermfg=160
" -----------------------------------------------------------------------------
" HTML / XML
" -----------------------------------------------------------------------------

hi htmlTag ctermfg=137
hi htmlTagN ctermfg=137
hi htmlTagName ctermfg=137
Expand All @@ -154,6 +150,8 @@ hi xmlTagName ctermfg=137
hi xmlNamespace ctermfg=221
hi xmlEndTag ctermfg=137

" JavaScript
hi jsObjectKey ctermfg=221
" -----------------------------------------------------------------------------
" Netrw
" -----------------------------------------------------------------------------
Expand Down
74 changes: 40 additions & 34 deletions .vimrc
@@ -1,10 +1,5 @@
call pathogen#infect()

" Hex editor
" :%!xxd
" Revert
" :%!xxd -r

" -----------------------------------------------------------------------------
" General
" -----------------------------------------------------------------------------
Expand All @@ -15,6 +10,10 @@ set nofoldenable " No folding
set mouse=a
set history=150

set wildmenu " command-line completion
set wildmode=longest:full " Better autocompletion
set title " show filename in window titlebar

" -----------------------------------------------------------------------------
" Indentation
" -----------------------------------------------------------------------------
Expand All @@ -25,10 +24,6 @@ set shiftwidth=2
set tabstop=8 " number of visual spaces per tab
set expandtab " tabs are spaces

set wildmenu " command-line completion
set wildmode=longest:full " Better autocompletion
set title " show filename in window titlebar

" -----------------------------------------------------------------------------
" UI
" ------------------------------------------------------------------------------
Expand Down Expand Up @@ -96,7 +91,7 @@ let mapleader = " "

nnoremap <Leader> <Nop>
" Get current syntax token stack.
nnoremap <Leader>s :call <SID>SynStack()<CR>
nnoremap <Leader>s :call <SID>ToggleSynStack()<CR>
" View built-in vim syntax files.
nnoremap <Leader>S :tabe $VIMRUNTIME/syntax/<CR>
" Open another tab of the file.
Expand All @@ -105,46 +100,57 @@ nnoremap <Leader>t :tabe %<CR>
nnoremap <Leader>T :tabe .<CR>
" Toggle paste mode.
nnoremap <Leader>p :set paste!<CR>
nnoremap <Leader>x :call <SID>ToggleHex()<CR>
function! <SID>SynStack()
function! <SID>ToggleSynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunction

function! <SID>ToggleHex()
if exists("b:is_hex")
let &filetype = b:is_hex
unlet b:is_hex
%!xxd -r
else
let b:is_hex = &filetype
let &filetype = 'xxd'
%!xxd
endif
endfunction

" -----------------------------------------------------------------------------
" Autocommands
" -----------------------------------------------------------------------------
" Reload .vimrc when saved.
" autocmd bufwritepost .vimrc source $MYVIMRC
" TODO: autogroups

" ftdetect
autocmd BufNewFile,BufRead *.glsl,*.geom,*.vert,*.frag,*.gsh,*.vsh,*.fsh set filetype=c
autocmd BufNewFile,BufRead *.gyp set filetype=json
augroup FTOptions
autocmd!
" ftdetect
autocmd BufNewFile,BufRead *.glsl,*.geom,*.vert,*.frag,*.gsh,*.vsh,*.fsh set filetype=c
autocmd BufNewFile,BufRead *.gyp set filetype=json

" Indentation
autocmd FileType python,rust setlocal expandtab shiftwidth=4 softtabstop=4
autocmd FileType go,make,c,cpp,sh,gitconfig setlocal noexpandtab shiftwidth=8 softtabstop=8

" Spellchecking
autocmd FileType mail,gitcommit setlocal spell
" Indentation
autocmd FileType python,rust setlocal expandtab shiftwidth=4 softtabstop=4
autocmd FileType go,make,c,cpp,sh,gitconfig setlocal noexpandtab shiftwidth=8 softtabstop=8

" au BufWritePost *.js echo system("jshint " . shellescape(expand('%:p')))
" Spellchecking
autocmd FileType mail,gitcommit setlocal spell

" Help (shift-K)
autocmd FileType vim setlocal keywordprg=:help
" Help (shift-K)
autocmd FileType vim setlocal keywordprg=:help
augroup END

" -----------------------------------------------------------------------------
" Abbreviations
" -----------------------------------------------------------------------------
" JavaScript
autocmd FileType javascript iabbrev pro prototype
augroup FTAbbreviations
autocmd!
" JavaScript
autocmd FileType javascript inoreabbrev pro prototype

" Go
autocmd FileType go iabbrev qTest func Test(t *testing.T) {<CR><TAB><CR><BACKSPACE>}<ESC>kk$F(i
autocmd FileType go iabbrev qfunc func() {<CR><TAB><CR><BACKSPACE>}<ESC>kk$F(i
" Go
"autocmd FileType go inoreabbrev qTest func Test(t *testing.T) {<CR><TAB><CR><BACKSPACE>}<ESC>kk$F(i
"autocmd FileType go inoreabbrev qfunc func() {<CR><TAB><CR><BACKSPACE>}<ESC>kk$F(i
augroup END

" -----------------------------------------------------------------------------
" Statusline
Expand Down

0 comments on commit aec573e

Please sign in to comment.