From a74d63748be1b7adee948624498547ed94f34405 Mon Sep 17 00:00:00 2001 From: natemaia Date: Sat, 16 Jun 2018 22:46:22 -0700 Subject: [PATCH] Add vim colorscheme (default is awful), fix issue with ranger config regarding tmux --- home/.config/ranger/rc.conf | 2 +- home/.vim/colors/jinx.vim | 466 ++++++++++++++++++++++++++++++++++++ home/.vimrc | 11 +- 3 files changed, 477 insertions(+), 2 deletions(-) create mode 100644 home/.vim/colors/jinx.vim diff --git a/home/.config/ranger/rc.conf b/home/.config/ranger/rc.conf index e150af92..a09144d8 100644 --- a/home/.config/ranger/rc.conf +++ b/home/.config/ranger/rc.conf @@ -12,7 +12,7 @@ set colorscheme default set shorten_title 4 set update_title true -set update_tmux_title true +# set update_tmux_title true set tilde_in_titlebar true set hostname_in_titlebar true set max_history_size 20 diff --git a/home/.vim/colors/jinx.vim b/home/.vim/colors/jinx.vim new file mode 100644 index 00000000..5787a852 --- /dev/null +++ b/home/.vim/colors/jinx.vim @@ -0,0 +1,466 @@ +" ------------------- jinx ---------------------- " +" Written by Nathaniel Maia, December 2017 " +" ----------------------------------------------- " + +" ---------- Setup and Checks ----------- " {{{1 +" Pre {{{2 + +if !has('gui_running') && &t_Co != 256 + finish +endif + +if exists('syntax_on') + highlight clear + syntax reset +endif + +let g:colors_name = 'jinx' + +if exists('g:jinx_theme_toggle_key') && g:jinx_theme_toggle_key !=# '' + let s:t_key = g:jinx_theme_toggle_key +else + let s:t_key = '' + if maparg('T', 'n') ==# '' + let s:t_key = 'T' + endif +endif + +" Colors {{{2 + +" empty color dictionary +let s:jinx = {} + +" NOTE: For those looking to edit the theme +" +" Color definition is done for both true color +" and 256 color. The format is in ['HEX', 256color] +" +" eg. let s:jinx.black = ['#000000', 0] + +" completion menu, wildmenu, and status/tab lines +let s:jinx.menu_bgr = ['#4D5057', 238] +let s:jinx.menu_fgr = ['#999999', 102] +let s:jinx.menusel_bgr = ['#1F2326', 235] +let s:jinx.menusel_fgr = ['#CECECE', 251] +let s:jinx.menualt_fgr = ['#CECECE', 251] +let s:jinx.menualt_bgr = ['#37383D', 237] +let s:jinx.tabsel_bgr = ['#8DBC8D', 108] + +" background, foreground, line, visual selection, folds, and comments +" as well as standard 1-7 colors: +" red, green, yellow, blue, purple, cyan, and orange (instead of white) +if exists('g:jinx_colors') && g:jinx_colors =~? 'day' + set background=light + let s:jinx.fgr = ['#494949', 238] + let s:jinx.bgr = ['#E1E1E1', 254] + let s:jinx.line = ['#DADADA', 253] + let s:jinx.select = ['#CECECE', 251] + let s:jinx.folded = ['#D4D4D4', 252] + let s:jinx.commnt = ['#999999', 102] + + let s:jinx.red = ['#EF7878', 210] + let s:jinx.green = ['#78A078', 108] + let s:jinx.yellow = ['#CE9D00', 178] + let s:jinx.blue = ['#4E88CF', 32] + let s:jinx.purple = ['#AF86C8', 140] + let s:jinx.cyan = ['#00AFAF', 37] + let s:jinx.orange = ['#E0914C', 172] +else + set background=dark + let s:jinx.fgr = ['#E1E1E1', 253] + let s:jinx.bgr = ['#4D545E', 235] + let s:jinx.line = ['#4D545E', 237] + let s:jinx.select = ['#797979', 240] + let s:jinx.folded = ['#414449', 239] + let s:jinx.commnt = ['#B9B9B9', 102] + + let s:jinx.red = ['#FF777A', 210] + let s:jinx.green = ['#8DBC8D', 108] + let s:jinx.yellow = ['#FFEB56', 220] + let s:jinx.blue = ['#6699CC', 32] + let s:jinx.purple = ['#CC99CC', 140] + let s:jinx.cyan = ['#5DD5FF', 81] + let s:jinx.orange = ['#FF9157', 208] +endif + +" Functions {{{2 + +if !exists('g:jinx_theme_toggle_loaded') && s:t_key !=# '' + let g:jinx_theme_toggle_loaded = 1 + function! Toggle_Theme() abort + if exists('g:jinx_colors') && g:jinx_colors =~? 'day' + let g:jinx_colors = 'night' + else + let g:jinx_colors = 'day' + endif + unlet g:colors_name + colorscheme jinx + let g:colors_name = 'jinx' + endfunction + execute 'nnoremap '.s:t_key.' :call Toggle_Theme()' +endif + + +function! HighLight(GRP, FG, BG, ATT) abort + if a:FG !=# '' + let l:fg_col = get(s:jinx, a:FG) + let l:fg_true = l:fg_col[0] + let l:fg_term = l:fg_col[1] + exec 'highlight! '.a:GRP.' guifg='.l:fg_true.' ctermfg='.l:fg_term + endif + if a:BG !=# '' + let l:bg_col = get(s:jinx, a:BG) + let l:bg_true = l:bg_col[0] + let l:bg_term = l:bg_col[1] + exec 'highlight! '.a:GRP.' guibg='.l:bg_true.' ctermbg='.l:bg_term + endif + if a:ATT !=# '' + exec 'highlight! '.a:GRP.' gui='.a:ATT.' cterm='.a:ATT + endif +endfunction + + +" ---------- Highlight Groups ------------ " {{{1 + +" Editor {{{2 + +call HighLight('Title', 'commnt', 'bgr', 'bold') +call HighLight('Visual', '', 'select', '') +call HighLight('SignColumn', '', 'line', '') +call HighLight('CursorLine', '', 'line', 'none') +call HighLight('CursorColumn', '', 'line', '') +call HighLight('CursorLineNr', 'cyan', 'line', '') +call HighLight('LineNr', 'commnt', 'line', '') +call HighLight('ColorColumn', 'fgr', 'red', '') +call HighLight('Error', 'red', 'bgr', '') +call HighLight('ErrorMsg', 'red', 'bgr', '') +call HighLight('WarningMsg', 'red', 'bgr', '') +call HighLight('MatchParen', 'blue', 'line', 'underline') +call HighLight('ModeMsg', 'cyan', 'bgr', '') +call HighLight('MoreMsg', 'cyan', 'bgr', '') +call HighLight('Directory', 'blue', 'bgr', '') +call HighLight('Question', 'green', 'bgr', '') +call HighLight('NonText', 'commnt', 'bgr', '') +call HighLight('SpecialKey', 'commnt', 'bgr', '') +call HighLight('Folded', 'commnt', 'folded', '') +call HighLight('Search', 'bgr', 'blue', '') +call HighLight('Normal', 'fgr', 'bgr', '') +call HighLight('VertSplit', 'menu_bgr', 'menu_fgr', '') + +" Tabline {{{2 + +call HighLight('TabLine', 'menu_fgr', 'menu_bgr', 'none') +call HighLight('TabLineFill', 'menu_bgr', 'menu_bgr', '') +call HighLight('TabLineSel', 'tabsel_bgr', 'menu_bgr', 'bold') +call HighLight('WildMenu', 'menusel_fgr', 'menu_bgr', 'bold') +call HighLight('Pmenu', 'menusel_fgr', 'menu_bgr', 'bold') +call HighLight('PmenuSel', 'menusel_bgr', 'menusel_fgr', 'bold') +call HighLight('PmenuSbar', 'menu_fgr', 'menu_bgr', '') +call HighLight('PmenuThumb', 'menu_fgr', 'menu_bgr', '') +call HighLight('StatusLine', 'menu_bgr', 'menu_fgr', '') +call HighLight('StatusLineNC', 'menu_fgr', 'menu_bgr', '') + +" Spell {{{2 + +if has('spell') + call HighLight('SpellBad', '', '', 'undercurl') + call HighLight('SpellLocal', '', '', 'undercurl') + call HighLight('SpellRare', '', '', 'undercurl') +endif + +" CtrlP {{{2 + +call HighLight('CtrlPNoEntries', 'red', '', 'bold') +call HighLight('CtrlPMatch', 'blue', '', 'bold') +call HighLight('CtrlPLinePre', 'blue', 'menu_bgr', 'none') +call HighLight('CtrlPPrtBase', 'blue', '', 'none') +call HighLight('CtrlPPrtCursor', 'menu_fgr', 'menu_bgr', 'bold') +call HighLight('CtrlPMode1', 'menu_fgr', 'menu_bgr', 'bold') +call HighLight('CtrlPMode2', 'menu_fgr', 'menu_bgr', 'bold') +call HighLight('CtrlPStats', 'menu_fgr', 'menu_bgr', 'bold') + +" ALE {{{2 + +call HighLight('ALEErrorSign', 'red', 'line', 'bold') +call HighLight('ALEWarningSign', 'orange', 'line', 'bold') + +" Generic {{{2 + +call HighLight('Comment', 'commnt', '', '') +call HighLight('Todo', 'red', 'bgr', 'bold') +call HighLight('Float', 'cyan', '', '') +call HighLight('Character', 'cyan', '', '') +call HighLight('String', 'cyan', '', '') +call HighLight('Number', 'cyan', '', 'bold') +call HighLight('Boolean', 'cyan', '', 'bold') +call HighLight('Exception', 'blue', '', 'bold') +call HighLight('Include', 'blue', '', '') +call HighLight('Operator', 'blue', '', 'bold') +call HighLight('Label', 'green', '', '') +call HighLight('Repeat', 'green', '', '') +call HighLight('Statement', 'green', '', '') +call HighLight('Conditional', 'green', '', '') +call HighLight('Keyword', 'green', '', 'bold') +call HighLight('Structure', 'purple', '', 'bold') +call HighLight('StorageClass', 'purple', '', 'bold') +call HighLight('Type', 'purple', '', 'bold') +call HighLight('Tag', 'purple', '', 'bold') +call HighLight('Macro', 'purple', '', 'bold') +call HighLight('Special', 'purple', '', 'bold') +call HighLight('TypeDef', 'purple', '', 'bold') +call HighLight('Define', 'yellow', '', 'bold') +call HighLight('Constant', 'yellow', '', 'bold') +call HighLight('PreProc', 'yellow', '', '') +call HighLight('Identifier', 'yellow', '', 'bold') +call HighLight('PreCondit', 'yellow', '', '') +call HighLight('Function', 'orange', '', 'bold') +call HighLight('Conceal', 'orange', '', '') + +" Vim {{{2 + +call HighLight('vimCommand', 'green', '', 'bold') +call HighLight('vimGroup', 'yellow', '', 'bold') +call HighLight('vimGroupName', 'yellow', '', 'bold') +call HighLight('VimFunction', 'orange', '', 'bold') +call HighLight('vimMapModKey', 'purple', '', 'bold') +call HighLight('vimBracket', 'purple', '', 'bold') +call HighLight('vimOption', 'purple', '', 'bold') +call HighLight('vimMapMod', 'purple', '', '') +call HighLight('vimNotation', 'purple', '', '') + +" Shell {{{2 + +call HighLight('shStatement', 'green', '', 'bold') +call HighLight('shKeyword', 'purple', '', 'bold') +call HighLight('zshStatement', 'purple', '', 'bold') +call HighLight('zshOption', 'purple', '', 'bold') +call HighLight('zshFunction', 'orange', '', 'bold') +call HighLight('zshVariableDef', 'yellow', '', '') +call HighLight('zshOperator', 'blue', '', 'bold') + +" C {{{2 + +call HighLight('cConditional', 'green', '', '') +call HighLight('cRepeat', 'purple', '', '') +call HighLight('cStorageClass', 'purple', '', '') +call HighLight('cType', 'yellow', '', '') + +" PHP {{{2 + +call HighLight('phpMemberSelector', 'blue', '', '') +call HighLight('phpVarSelector', 'red', '', '') +call HighLight('phpConditional', 'green', '', '') +call HighLight('phpStatement', 'green', '', 'bold') +call HighLight('phpKeyword', 'purple', '', 'bold') +call HighLight('phpRepeat', 'purple', '', '') + +" Ruby {{{2 + +call HighLight('rubyInclude', 'blue', '', '') +call HighLight('rubyAttribute', 'blue', '', '') +call HighLight('rubySymbol', 'green', '', '') +call HighLight('rubyStringDelimiter', 'green', '', '') +call HighLight('rubyRepeat', 'purple', '', '') +call HighLight('rubyControl', 'purple', '', '') +call HighLight('rubyConditional', 'purple', '', '') +call HighLight('rubyException', 'purple', '', '') +call HighLight('rubyCurlyBlock', 'orange', '', '') +call HighLight('rubyLocalVariableOrMethod', 'orange', '', '') +call HighLight('rubyInterpolationDelimiter', 'orange', '', '') +call HighLight('rubyAccess', 'yellow', '', '') +call HighLight('rubyConstant', 'yellow', '', '') + +" Python {{{2 + +call HighLight('pythonRun', 'red', '', '') +call HighLight('pythonDecorator', 'red', '', 'bold') +call HighLight('pythonExClass', 'blue', '', '') +call HighLight('pythonException', 'blue', '', 'bold') +call HighLight('pythonExceptions', 'blue', '', 'bold') +call HighLight('pythonEscape', 'blue', '', '') +call HighLight('pythonImport', 'green', '', 'bold') +call HighLight('pythonRepeat', 'green', '', '') +call HighLight('pythonCoding', 'green', '', '') +call HighLight('pythonInclude', 'green', '', 'bold') +call HighLight('pythonPreCondit', 'green', '', '') +call HighLight('pythonStatement', 'green', '', 'bold') +call HighLight('pythonConditional', 'green', '', '') +call HighLight('pythonDef', 'yellow', '', 'bold') +call HighLight('pythonBuiltin', 'purple', '', 'bold') +call HighLight('pythonBuiltinObj', 'purple', '', 'bold') +call HighLight('pythonBuiltinFunc', 'orange', '', 'bold') +call HighLight('pythonDot', 'orange', '', 'bold') +call HighLight('pythonLambda', 'orange', '', '') +call HighLight('pythonFunction', 'orange', '', 'bold') +call HighLight('pythonDottedName', 'orange', '', '') +call HighLight('pythonBuiltinObjs', 'orange', '', '') + +" LaTeX {{{2 + +call HighLight('texZone', 'red', '', 'none') +call HighLight('texStatement', 'blue', '', 'none') +call HighLight('texRefLabel', 'blue', '', 'none') +call HighLight('texRefZone', 'green', '', 'none') +call HighLight('texMath', 'orange', '', 'none') +call HighLight('texMathZoneX', 'orange', '', 'none') +call HighLight('texMathZoneA', 'orange', '', 'none') +call HighLight('texMathZoneB', 'orange', '', 'none') +call HighLight('texMathZoneC', 'orange', '', 'none') +call HighLight('texMathZoneD', 'orange', '', 'none') +call HighLight('texMathZoneE', 'orange', '', 'none') +call HighLight('texMathMatcher', 'orange', '', 'none') +call HighLight('texDelimiter', 'purple', '', 'none') +call HighLight('texComment', 'commnt', '', 'none') + +" JavaScript {{{2 + +call HighLight('javaScriptNumber', 'cyan', '', 'bold') +call HighLight('javascriptNull', 'red', '', 'bold') +call HighLight('javascriptStatement', 'green', '', '') +call HighLight('javaScriptConditional', 'green', '', '') +call HighLight('javaScriptRepeat', 'purple', '', '') +call HighLight('javaScriptBraces', 'purple', '', 'bold') +call HighLight('javascriptGlobal', 'yellow', '', 'bold') +call HighLight('javaScriptFunction', 'orange', '', 'bold') +call HighLight('javaScriptMember', 'orange', '', 'bold') + +" HTML {{{2 + +call HighLight('htmlTag', 'red', '', '') +call HighLight('htmlTagName', 'red', '', 'bold') +call HighLight('htmlLink', 'blue', '', 'bold') +call HighLight('htmlArg', 'green', '', 'bold') +call HighLight('htmlScriptTag', 'purple', '', 'bold') +call HighLight('htmlTitle', 'blue', '', 'bold') +call HighLight('htmlH1', 'blue', '', 'bold') +call HighLight('htmlH2', 'cyan', '', '') +call HighLight('htmlH3', 'cyan', '', '') +call HighLight('htmlH4', 'green', '', '') +call HighLight('htmlH5', 'green', '', '') + +" YAML {{{2 + +call HighLight('yamlKey', 'red', '', '') +call HighLight('yamlAnchor', 'red', '', '') +call HighLight('yamlAlias', 'blue', '', '') +call HighLight('yamlDocumentHeader', 'green', '', '') + +" Markdown {{{2 + +call HighLight('markdownHeadingRule', 'red', '', '') +call HighLight('markdownHeadingDelimiter', 'red', '', '') +call HighLight('markdownListMarker', 'blue', '', '') +call HighLight('markdownOrderedListMarker', 'blue', '', '') +call HighLight('markdownCode', 'purple', '', '') +call HighLight('markdownCodeBlock', 'purple', '', 'bold') +call HighLight('markdownCodeDelimiter', 'orange', '', 'bold') +call HighLight('markdownH1', 'blue', '', 'bold') +call HighLight('markdownH2', 'blue', '', 'bold') +call HighLight('markdownH3', 'cyan', '', '') +call HighLight('markdownH4', 'cyan', '', '') +call HighLight('markdownH5', 'green', '', '') + +" ShowMarks {{{2 + +call HighLight('ShowMarksHLm', 'cyan', '', '') +call HighLight('ShowMarksHLl', 'orange', '', '') +call HighLight('ShowMarksHLo', 'purple', '', '') +call HighLight('ShowMarksHLu', 'yellow', '', '') + +" Lua {{{2 + +call HighLight('luaRepeat', 'purple', '', '') +call HighLight('luaStatement', 'purple', '', '') +call HighLight('luaCond', 'green', '', '') +call HighLight('luaCondEnd', 'green', '', '') +call HighLight('luaCondStart', 'green', '', '') +call HighLight('luaCondElseif', 'green', '', '') + +" Go {{{2 + +call HighLight('goDeclType', 'blue', '', '') +call HighLight('goLabel', 'purple', '', '') +call HighLight('goRepeat', 'purple', '', '') +call HighLight('goBuiltins', 'purple', '', '') +call HighLight('goStatement', 'purple', '', '') +call HighLight('goDirective', 'purple', '', '') +call HighLight('goDeclaration', 'purple', '', '') +call HighLight('goConditional', 'purple', '', '') +call HighLight('goTodo', 'yellow', '', '') +call HighLight('goConstants', 'orange', '', '') + +" Clojure {{{2 + +call HighLight('clojureException', 'red', '', '') +call HighLight('clojureParen', 'cyan', '', '') +call HighLight('clojureCond', 'blue', '', '') +call HighLight('clojureFunc', 'blue', '', '') +call HighLight('clojureMeta', 'blue', '', '') +call HighLight('clojureMacro', 'blue', '', '') +call HighLight('clojureDeref', 'blue', '', '') +call HighLight('clojureQuote', 'blue', '', '') +call HighLight('clojureRepeat', 'blue', '', '') +call HighLight('clojureRepeat', 'blue', '', '') +call HighLight('clojureUnquote', 'blue', '', '') +call HighLight('clojureAnonArg', 'blue', '', '') +call HighLight('clojureDispatch', 'blue', '', '') +call HighLight('clojureString', 'green', '', '') +call HighLight('clojureRegexp', 'green', '', '') +call HighLight('clojureKeyword', 'green', '', '') +call HighLight('clojureDefine', 'purple', '', '') +call HighLight('clojureSpecial', 'purple', '', '') +call HighLight('clojureVariable', 'yellow', '', '') +call HighLight('clojureBoolean', 'orange', '', '') +call HighLight('clojureNumber', 'orange', '', '') +call HighLight('clojureConstant', 'orange', '', '') +call HighLight('clojureCharacter', 'orange', '', '') + +" Scala {{{2 + +call HighLight('scalaPackage', 'red', '', '') +call HighLight('scalaVar', 'cyan', '', '') +call HighLight('scalaDefName', 'blue', '', '') +call HighLight('scalaBackTick', 'blue', '', '') +call HighLight('scalaMethodCall', 'blue', '', '') +call HighLight('scalaXml', 'green', '', '') +call HighLight('scalaString', 'green', '', '') +call HighLight('scalaBackTick', 'green', '', '') +call HighLight('scalaEmptyString', 'green', '', '') +call HighLight('scalaStringEscape', 'green', '', '') +call HighLight('scalaMultiLineString', 'green', '', '') +call HighLight('scalaTypeSpecializer', 'yellow', '', '') +call HighLight('scalaDefSpecializer', 'yellow', '', '') +call HighLight('scalaType', 'yellow', '', '') +call HighLight('scalaCaseType', 'yellow', '', '') +call HighLight('scalaAnnotation', 'orange', '', '') +call HighLight('scalaSymbol', 'orange', '', '') +call HighLight('scalaUnicode', 'orange', '', '') +call HighLight('scalaBoolean', 'orange', '', '') +call HighLight('scalaNumber', 'orange', '', '') +call HighLight('scalaChar', 'orange', '', '') +call HighLight('scalaImport', 'purple', '', '') +call HighLight('scalaDef', 'purple', '', '') +call HighLight('scalaVal', 'purple', '', '') +call HighLight('scalaClass', 'purple', '', '') +call HighLight('scalaTrait', 'purple', '', '') +call HighLight('scalaObject', 'purple', '', '') +call HighLight('scalaKeywordModifier', 'purple', '', '') +call HighLight('scalaDocComment', 'commnt', '', '') +call HighLight('scalaComment', 'commnt', '', '') +call HighLight('scalaDocTags', 'commnt', '', '') +call HighLight('scalaLineComment', 'commnt', '', '') + +" Diff {{{2 + +call HighLight('DiffDelete', 'red', '', '') +call HighLight('DiffChange', 'blue', '', '') +call HighLight('DiffAdd', 'green', '', '') +call HighLight('DiffText', 'line', 'blue', 'bold') + +" Cleanup {{{2 + +" Remove the highlight function as it's no longer needed. +" Will cause problems toggling the theme if not deleted. +delfunction HighLight + +" vim:fdm=marker:et:sts=4:sw=4 diff --git a/home/.vimrc b/home/.vimrc index 0ad1af6a..69f8096d 100644 --- a/home/.vimrc +++ b/home/.vimrc @@ -30,15 +30,24 @@ endif " syntax highlighting syntax enable -if has('termguicolors') && $DISPLAY !=? '' + +if has('termguicolors') && $DISPLAY !=? '' && &t_Co == 256 + + let g:jinx_colors = 'night' " night or day (shift-t to change on the fly) + " true color in the terminal set termguicolors + colorscheme jinx " fix true color in some terminals (nvim doesn't have this issue) if !has('nvim') && !($TERM =~? 'xterm' || &term =~? 'xterm') let $TERM = 'xterm-256color' let &term = 'xterm-256color' endif +else + set nocursorline + set notermguicolors + colorscheme evening endif " change cursor shape for different editing modes (nvim does this by default)