|
| 1 | +" Sets the highlighting for the given group |
| 2 | +fun! s:X(group, fg, bg, attr) |
| 3 | + if a:fg != "" |
| 4 | + exec "silent hi " . a:group . " guifg=#" . a:fg |
| 5 | + endif |
| 6 | + if a:bg != "" |
| 7 | + exec "silent hi " . a:group . " guibg=#" . a:bg |
| 8 | + endif |
| 9 | + if a:attr != "" |
| 10 | + exec "silent hi " . a:group . " gui=" . a:attr |
| 11 | + endif |
| 12 | +endfun |
| 13 | + |
| 14 | +"the original values would be 24 bit color but apparently that is not possible |
| 15 | +let s:brown = "905532" |
| 16 | +let s:aqua = "3AFFDB" |
| 17 | +let s:blue = "519aba" |
| 18 | +let s:darkBlue = "03589c" |
| 19 | +let s:purple = "a074c4" |
| 20 | +let s:darkPurple = "854cc7" |
| 21 | +let s:lightPurple = "834F79" |
| 22 | +let s:juliaPurple = "9558B2" |
| 23 | +let s:red = "cc3e44" |
| 24 | +let s:darkRed = "a90533" |
| 25 | +let s:beige = "F5C06F" |
| 26 | +let s:yellow = "cbcb41" |
| 27 | +let s:orange = "D4843E" |
| 28 | +let s:darkOrange = "e37933" |
| 29 | +let s:pink = "f55385" |
| 30 | +let s:salmon = "EE6E73" |
| 31 | +let s:green = "8dc149" |
| 32 | +let s:darkGreen = "019833" |
| 33 | +let s:lightGreen = "31B53E" |
| 34 | +let s:white = "FFFFFF" |
| 35 | +let s:gray = "6d8086" |
| 36 | +let s:darkGray = "4d5a5e" |
| 37 | + |
| 38 | +let s:file_extension_colors = { |
| 39 | + \ 'styl' : s:green, |
| 40 | + \ 'sass' : s:pink, |
| 41 | + \ 'scss' : s:pink, |
| 42 | + \ 'htm' : s:darkOrange, |
| 43 | + \ 'html' : s:darkOrange, |
| 44 | + \ 'erb' : s:red, |
| 45 | + \ 'slim' : s:orange, |
| 46 | + \ 'ejs' : s:yellow, |
| 47 | + \ 'css' : s:blue, |
| 48 | + \ 'less' : s:darkBlue, |
| 49 | + \ 'md' : s:blue, |
| 50 | + \ 'mdx' : s:blue, |
| 51 | + \ 'markdown' : s:blue, |
| 52 | + \ 'rmd' : s:blue, |
| 53 | + \ 'json' : s:yellow, |
| 54 | + \ 'js' : s:yellow, |
| 55 | + \ 'mjs' : s:yellow, |
| 56 | + \ 'jsx' : s:blue, |
| 57 | + \ 'rb' : s:red, |
| 58 | + \ 'php' : s:purple, |
| 59 | + \ 'py' : s:blue, |
| 60 | + \ 'pyc' : s:blue, |
| 61 | + \ 'pyo' : s:blue, |
| 62 | + \ 'pyd' : s:blue, |
| 63 | + \ 'coffee' : s:brown, |
| 64 | + \ 'mustache' : s:orange, |
| 65 | + \ 'hbs' : s:orange, |
| 66 | + \ 'conf' : s:gray, |
| 67 | + \ 'ini' : s:gray, |
| 68 | + \ 'yml' : s:gray, |
| 69 | + \ 'yaml' : s:gray, |
| 70 | + \ 'toml' : s:gray, |
| 71 | + \ 'bat' : s:gray, |
| 72 | + \ 'jpg' : s:aqua, |
| 73 | + \ 'jpeg' : s:aqua, |
| 74 | + \ 'bmp' : s:aqua, |
| 75 | + \ 'png' : s:aqua, |
| 76 | + \ 'webp' : s:aqua, |
| 77 | + \ 'gif' : s:aqua, |
| 78 | + \ 'ico' : s:aqua, |
| 79 | + \ 'twig' : s:green, |
| 80 | + \ 'cpp' : s:blue, |
| 81 | + \ 'cxx' : s:blue, |
| 82 | + \ 'cc' : s:blue, |
| 83 | + \ 'cp' : s:blue, |
| 84 | + \ 'c' : s:blue, |
| 85 | + \ 'cs' : s:blue, |
| 86 | + \ 'h' : s:blue, |
| 87 | + \ 'hh' : s:blue, |
| 88 | + \ 'hpp' : s:blue, |
| 89 | + \ 'hxx' : s:blue, |
| 90 | + \ 'hs' : s:beige, |
| 91 | + \ 'lhs' : s:beige, |
| 92 | + \ 'lua' : s:blue, |
| 93 | + \ 'java' : s:red, |
| 94 | + \ 'sh' : s:darkGray, |
| 95 | + \ 'fish' : s:green, |
| 96 | + \ 'bash' : s:darkGray, |
| 97 | + \ 'zsh' : s:darkGray, |
| 98 | + \ 'ksh' : s:darkGray, |
| 99 | + \ 'csh' : s:darkGray, |
| 100 | + \ 'awk' : s:white, |
| 101 | + \ 'ps1' : s:darkGray, |
| 102 | + \ 'ml' : s:darkOrange, |
| 103 | + \ 'mli' : s:darkOrange, |
| 104 | + \ 'diff' : s:darkGray, |
| 105 | + \ 'db' : s:pink, |
| 106 | + \ 'sql' : s:pink, |
| 107 | + \ 'dump' : s:pink, |
| 108 | + \ 'clj' : s:green, |
| 109 | + \ 'cljc' : s:green, |
| 110 | + \ 'cljs' : s:green, |
| 111 | + \ 'edn' : s:blue, |
| 112 | + \ 'scala' : s:red, |
| 113 | + \ 'go' : s:blue, |
| 114 | + \ 'dart' : s:darkBlue, |
| 115 | + \ 'xul' : s:darkOrange, |
| 116 | + \ 'sln' : s:darkPurple, |
| 117 | + \ 'suo' : s:darkPurple, |
| 118 | + \ 'pl' : s:blue, |
| 119 | + \ 'pm' : s:blue, |
| 120 | + \ 't' : s:blue, |
| 121 | + \ 'rss' : s:darkOrange, |
| 122 | + \ 'f#' : s:darkBlue, |
| 123 | + \ 'fsscript' : s:blue, |
| 124 | + \ 'fsx' : s:blue, |
| 125 | + \ 'fs' : s:blue, |
| 126 | + \ 'fsi' : s:blue, |
| 127 | + \ 'rs' : s:blue, |
| 128 | + \ 'rlib' : s:blue, |
| 129 | + \ 'd' : s:red, |
| 130 | + \ 'erl' : s:darkRed, |
| 131 | + \ 'hrl' : s:pink, |
| 132 | + \ 'ex' : s:purple, |
| 133 | + \ 'exs' : s:purple, |
| 134 | + \ 'eex' : s:purple, |
| 135 | + \ 'leex' : s:white, |
| 136 | + \ 'vim' : s:darkGreen, |
| 137 | + \ 'ai' : s:darkOrange, |
| 138 | + \ 'psd' : s:darkBlue, |
| 139 | + \ 'psb' : s:darkBlue, |
| 140 | + \ 'ts' : s:blue, |
| 141 | + \ 'tsx' : s:blue, |
| 142 | + \ 'jl' : s:juliaPurple, |
| 143 | + \ 'pp' : s:white, |
| 144 | + \ 'vue' : s:green, |
| 145 | + \ 'elm' : s:white, |
| 146 | + \ 'swift' : s:darkOrange, |
| 147 | + \ 'xcplayground' : s:orange |
| 148 | +\} |
| 149 | + |
| 150 | +let s:file_node_exact_matches = { |
| 151 | + \ 'gruntfile.coffee' : s:yellow, |
| 152 | + \ 'gruntfile.js' : s:yellow, |
| 153 | + \ 'gruntfile.ls' : s:yellow, |
| 154 | + \ 'gulpfile.coffee' : s:pink, |
| 155 | + \ 'gulpfile.js' : s:pink, |
| 156 | + \ 'gulpfile.ls' : s:pink, |
| 157 | + \ 'mix.lock' : s:white, |
| 158 | + \ 'dropbox' : s:blue, |
| 159 | + \ '.ds_store' : s:white, |
| 160 | + \ '.gitconfig' : s:white, |
| 161 | + \ '.gitignore' : s:white, |
| 162 | + \ '.gitlab-ci.yml' : s:orange, |
| 163 | + \ '.bashrc' : s:white, |
| 164 | + \ '.zshrc' : s:white, |
| 165 | + \ '.vimrc' : s:green, |
| 166 | + \ '.gvimrc' : s:green, |
| 167 | + \ '_vimrc' : s:green, |
| 168 | + \ '_gvimrc' : s:green, |
| 169 | + \ '.bashprofile' : s:white, |
| 170 | + \ 'favicon.ico' : s:yellow, |
| 171 | + \ 'license' : s:white, |
| 172 | + \ 'node_modules' : s:green, |
| 173 | + \ 'react.jsx' : s:blue, |
| 174 | + \ 'typescript.jsx' : s:blue, |
| 175 | + \ 'typescript.tsx' : s:blue, |
| 176 | + \ 'procfile' : s:purple, |
| 177 | + \ 'dockerfile' : s:blue, |
| 178 | + \ 'docker-compose.yml' : s:blue, |
| 179 | + \ 'makefile' : s:white, |
| 180 | + \ 'cmakelists.txt' : s:white |
| 181 | +\} |
| 182 | + |
| 183 | +let s:file_node_pattern_matches = { |
| 184 | + \ '.*jquery.*\.js$' : s:blue, |
| 185 | + \ '.*angular.*\.js$' : s:red, |
| 186 | + \ '.*backbone.*\.js$' : s:darkBlue, |
| 187 | + \ '.*require.*\.js$' : s:blue, |
| 188 | + \ '.*materialize.*\.js$' : s:salmon, |
| 189 | + \ '.*materialize.*\.css$' : s:salmon, |
| 190 | + \ '.*mootools.*\.js$' : s:white, |
| 191 | + \ '.*vimrc.*' : s:green, |
| 192 | + \ 'Vagrantfile$' : s:blue |
| 193 | +\} |
| 194 | + |
| 195 | +" let s:characters = '[ a-zA-Z0-9_\#\-\+\*\%\!\~\(\)\{\}\&\.\$\@]' |
| 196 | +" substitute will 'eliminate' single backlashes on the string |
| 197 | +" let s:chars_double_lashes = substitute(s:characters, '\\', '\\\\', 'g') |
| 198 | + |
| 199 | +if !exists('g:BufTabLineHiColor') |
| 200 | + let g:BufTabLineHiColor = {} |
| 201 | +endif |
| 202 | + |
| 203 | +for [key, val] in items(s:file_extension_colors) |
| 204 | + if !has_key(g:BufTabLineHiColor, key) |
| 205 | + let g:BufTabLineHiColor[key] = val |
| 206 | + endif |
| 207 | +endfor |
| 208 | + |
| 209 | +for [key, val] in items(g:BufTabLineHiColor) |
| 210 | + let icon_identifier = 'buftablineIcon_'.key |
| 211 | + " let regexp = '\v'.s:characters.'+\.'.substitute(key, '\W', '\\\0', 'g') |
| 212 | + |
| 213 | + if exists('g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols["'.key.'"]') |
| 214 | + let icon = g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols[key] |
| 215 | + " exec 'silent syn match '.icon_identifier.' \zs'.icon.'\ze.\+\.'.key.'$' |
| 216 | + " exec 'silent syn match '.icon_identifier.' \zs'.icon.'\ze.\+\.'.key.'\W*\*$' |
| 217 | + exec 'silent syn match '.icon_identifier.' "\zs'.icon.'\ze"' |
| 218 | + exec 'hi def link '.icon_identifier.' BufTabLineNumCurrent' |
| 219 | + endif |
| 220 | + |
| 221 | + if val != '' |
| 222 | + call s:X(icon_identifier, val, '', '') |
| 223 | + endif |
| 224 | +endfor |
| 225 | + |
| 226 | + |
0 commit comments