├── .gitignore ├── LICENSE ├── README.markdown ├── autoload ├── color_helper.vim └── indent_guides.vim ├── doc └── indent_guides.txt ├── plugin └── indent_guides.vim └── test-files ├── test-ts2sw0et.txt ├── test-ts2sw2et.txt ├── test-ts2sw2noet.txt ├── test-ts2sw4noet.txt ├── test-ts4sw4et.txt ├── test-ts4sw4noet.txt ├── test-ts8sw2noet.txt ├── test-ts8sw8et.txt └── test-ts8sw8noet.txt /.gitignore: -------------------------------------------------------------------------------- 1 | doc/tags 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2020 Nate Kane, Yuto Tokunaga 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # Neovim Indent Guides 2 | Neovim Indent Guides is a plugin for visually displaying indent levels in neovim, **even on blank lines**. 3 | 4 | [![Image from Gyazo](https://i.gyazo.com/89d08604557fb199808c08ac6a164662.png)](https://gyazo.com/89d08604557fb199808c08ac6a164662) 5 | 6 | Forked from [nathanaelkane/vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides). Thank you [u/lukas-reineke](https://www.reddit.com/user/lukas-reineke/) ([Indent guides on blank lines with virtual text 7 | ](https://www.reddit.com/r/neovim/comments/fxjjqh/indent_guides_on_blank_lines_with_virtual_text/)) 8 | 9 | ## Help 10 | `:help indent-guides` 11 | -------------------------------------------------------------------------------- /autoload/color_helper.vim: -------------------------------------------------------------------------------- 1 | " Author: Nate Kane 2 | " Homepage: http://github.com/nathanaelkane/vim-indent-guides 3 | 4 | " 5 | " Return hex string equivalent to given decimal string or number. 6 | " 7 | " Example: color_helper#dec_to_hex(255, 2) 8 | " Returns: 'FF' 9 | " 10 | " Example: color_helper#dec_to_hex(255, 5) 11 | " Returns: '000FF' 12 | " 13 | function! color_helper#dec_to_hex(arg, padding) 14 | return toupper(printf('%0' . a:padding . 'x', a:arg + 0)) 15 | endfunction 16 | 17 | " 18 | " Return number equivalent to given hex string ('0x' is optional). 19 | " 20 | " Example: color_helper#hex_to_dec('FF') 21 | " Returns: 255 22 | " 23 | " Example: color_helper#hex_to_dec('88') 24 | " Returns: 136 25 | " 26 | " Example: color_helper#hex_to_dec('00') 27 | " Returns: 0 28 | " 29 | function! color_helper#hex_to_dec(arg) 30 | return (a:arg =~? '^0x') ? a:arg + 0 : ('0x'.a:arg) + 0 31 | endfunction 32 | 33 | " 34 | " Converts a given hex color string into an rgb list (eg. [red, green, blue]). 35 | " 36 | " Example: color_helper#hex_color_to_rgb('#0088FF') 37 | " Returns: [0, 136, 255] 38 | " 39 | function! color_helper#hex_color_to_rgb(hex_color) 40 | let l:rgb = [] 41 | 42 | if a:hex_color =~ g:indent_guides_color_hex_pattern 43 | let l:red = color_helper#hex_to_dec(strpart(a:hex_color, 1, 2)) 44 | let l:green = color_helper#hex_to_dec(strpart(a:hex_color, 3, 2)) 45 | let l:blue = color_helper#hex_to_dec(strpart(a:hex_color, 5, 2)) 46 | let l:rgb = [l:red, l:green, l:blue] 47 | end 48 | 49 | return l:rgb 50 | endfunction 51 | 52 | " 53 | " Converts a given rgb list (eg. [red, green, blue]) into a hex color string. 54 | " 55 | " Example: color_helper#rgb_color_to_hex([0, 136, 255]) 56 | " Returns: '#0088FF' 57 | " 58 | function! color_helper#rgb_color_to_hex(rgb_color) 59 | let l:hex_color = '#' 60 | let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[0], 2) " red 61 | let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[1], 2) " green 62 | let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[2], 2) " blue 63 | 64 | return l:hex_color 65 | endfunction 66 | 67 | " 68 | " Returns a ligtened color using the given color and the percent to lighten it 69 | " by. 70 | " 71 | " Example: color_helper#hex_color_lighten('#000000', 0.10) 72 | " Returns: '#191919' 73 | " 74 | function! color_helper#hex_color_lighten(color, percent) 75 | let l:rgb = color_helper#hex_color_to_rgb(a:color) 76 | let l:rgb_lightened = [] 77 | 78 | for i in l:rgb 79 | call add(l:rgb_lightened, float2nr(i + ((255 - i) * a:percent))) 80 | endfor 81 | 82 | return color_helper#rgb_color_to_hex(l:rgb_lightened) 83 | endfunction 84 | 85 | " 86 | " Returns a darkened color using the given color and the percent to darken it 87 | " by. 88 | " 89 | " Example: color_helper#hex_color_darken('#FFFFFF', 0.10) 90 | " Returns: '#E5E5E5' 91 | " 92 | function! color_helper#hex_color_darken(color, percent) 93 | let l:rgb = color_helper#hex_color_to_rgb(a:color) 94 | let l:rgb_darkened = [] 95 | 96 | for i in l:rgb 97 | call add(l:rgb_darkened, float2nr(i * (1 - a:percent))) 98 | endfor 99 | 100 | return color_helper#rgb_color_to_hex(l:rgb_darkened) 101 | endfunction 102 | 103 | " 104 | " Returns a hex color code for the given color name. 105 | " 106 | " Example: color_helper#color_name_to_hex('darkslategray') 107 | " Returns: '#2F4F4F' 108 | " 109 | function! color_helper#color_name_to_hex(color_name) 110 | let l:hex_code = '' 111 | let l:color_name = tolower(a:color_name) 112 | 113 | let l:color_list = { 114 | \ 'alice blue' : '#F0F8FF', 115 | \ 'aliceblue' : '#F0F8FF', 116 | \ 'antique white' : '#FAEBD7', 117 | \ 'antiquewhite' : '#FAEBD7', 118 | \ 'antiquewhite1' : '#FFEFDB', 119 | \ 'antiquewhite2' : '#EEDFCC', 120 | \ 'antiquewhite3' : '#CDC0B0', 121 | \ 'antiquewhite4' : '#8B8378', 122 | \ 'aquamarine' : '#7FFFD4', 123 | \ 'aquamarine1' : '#7FFFD4', 124 | \ 'aquamarine2' : '#76EEC6', 125 | \ 'aquamarine3' : '#66CDAA', 126 | \ 'aquamarine4' : '#458B74', 127 | \ 'azure' : '#F0FFFF', 128 | \ 'azure1' : '#F0FFFF', 129 | \ 'azure2' : '#E0EEEE', 130 | \ 'azure3' : '#C1CDCD', 131 | \ 'azure4' : '#838B8B', 132 | \ 'beige' : '#F5F5DC', 133 | \ 'bisque' : '#FFE4C4', 134 | \ 'bisque1' : '#FFE4C4', 135 | \ 'bisque2' : '#EED5B7', 136 | \ 'bisque3' : '#CDB79E', 137 | \ 'bisque4' : '#8B7D6B', 138 | \ 'black' : '#000000', 139 | \ 'blanched almond' : '#FFEBCD', 140 | \ 'blanchedalmond' : '#FFEBCD', 141 | \ 'blue violet' : '#8A2BE2', 142 | \ 'blue' : '#0000FF', 143 | \ 'blue1' : '#0000FF', 144 | \ 'blue2' : '#0000EE', 145 | \ 'blue3' : '#0000CD', 146 | \ 'blue4' : '#00008B', 147 | \ 'blueviolet' : '#8A2BE2', 148 | \ 'brown' : '#A52A2A', 149 | \ 'brown1' : '#FF4040', 150 | \ 'brown2' : '#EE3B3B', 151 | \ 'brown3' : '#CD3333', 152 | \ 'brown4' : '#8B2323', 153 | \ 'burlywood' : '#DEB887', 154 | \ 'burlywood1' : '#FFD39B', 155 | \ 'burlywood2' : '#EEC591', 156 | \ 'burlywood3' : '#CDAA7D', 157 | \ 'burlywood4' : '#8B7355', 158 | \ 'cadet blue' : '#5F9EA0', 159 | \ 'cadetblue' : '#5F9EA0', 160 | \ 'cadetblue1' : '#98F5FF', 161 | \ 'cadetblue2' : '#8EE5EE', 162 | \ 'cadetblue3' : '#7AC5CD', 163 | \ 'cadetblue4' : '#53868B', 164 | \ 'chartreuse' : '#7FFF00', 165 | \ 'chartreuse1' : '#7FFF00', 166 | \ 'chartreuse2' : '#76EE00', 167 | \ 'chartreuse3' : '#66CD00', 168 | \ 'chartreuse4' : '#458B00', 169 | \ 'chocolate' : '#D2691E', 170 | \ 'chocolate1' : '#FF7F24', 171 | \ 'chocolate2' : '#EE7621', 172 | \ 'chocolate3' : '#CD661D', 173 | \ 'chocolate4' : '#8B4513', 174 | \ 'coral' : '#FF7F50', 175 | \ 'coral1' : '#FF7256', 176 | \ 'coral2' : '#EE6A50', 177 | \ 'coral3' : '#CD5B45', 178 | \ 'coral4' : '#8B3E2F', 179 | \ 'cornflower blue' : '#6495ED', 180 | \ 'cornflowerblue' : '#6495ED', 181 | \ 'cornsilk' : '#FFF8DC', 182 | \ 'cornsilk1' : '#FFF8DC', 183 | \ 'cornsilk2' : '#EEE8CD', 184 | \ 'cornsilk3' : '#CDC8B1', 185 | \ 'cornsilk4' : '#8B8878', 186 | \ 'cyan' : '#00FFFF', 187 | \ 'cyan1' : '#00FFFF', 188 | \ 'cyan2' : '#00EEEE', 189 | \ 'cyan3' : '#00CDCD', 190 | \ 'cyan4' : '#008B8B', 191 | \ 'dark blue' : '#00008B', 192 | \ 'dark cyan' : '#008B8B', 193 | \ 'dark goldenrod' : '#B8860B', 194 | \ 'dark gray' : '#A9A9A9', 195 | \ 'dark green' : '#006400', 196 | \ 'dark grey' : '#A9A9A9', 197 | \ 'dark khaki' : '#BDB76B', 198 | \ 'dark magenta' : '#8B008B', 199 | \ 'dark olive green' : '#556B2F', 200 | \ 'dark orange' : '#FF8C00', 201 | \ 'dark orchid' : '#9932CC', 202 | \ 'dark red' : '#8B0000', 203 | \ 'dark salmon' : '#E9967A', 204 | \ 'dark sea green' : '#8FBC8F', 205 | \ 'dark slate blue' : '#483D8B', 206 | \ 'dark slate gray' : '#2F4F4F', 207 | \ 'dark slate grey' : '#2F4F4F', 208 | \ 'dark turquoise' : '#00CED1', 209 | \ 'dark violet' : '#9400D3', 210 | \ 'dark yellow' : '#BBBB00', 211 | \ 'darkblue' : '#00008B', 212 | \ 'darkcyan' : '#008B8B', 213 | \ 'darkgoldenrod' : '#B8860B', 214 | \ 'darkgoldenrod1' : '#FFB90F', 215 | \ 'darkgoldenrod2' : '#EEAD0E', 216 | \ 'darkgoldenrod3' : '#CD950C', 217 | \ 'darkgoldenrod4' : '#8B6508', 218 | \ 'darkgray' : '#A9A9A9', 219 | \ 'darkgreen' : '#006400', 220 | \ 'darkgrey' : '#A9A9A9', 221 | \ 'darkkhaki' : '#BDB76B', 222 | \ 'darkmagenta' : '#8B008B', 223 | \ 'darkolivegreen' : '#556B2F', 224 | \ 'darkolivegreen1' : '#CAFF70', 225 | \ 'darkolivegreen2' : '#BCEE68', 226 | \ 'darkolivegreen3' : '#A2CD5A', 227 | \ 'darkolivegreen4' : '#6E8B3D', 228 | \ 'darkorange' : '#FF8C00', 229 | \ 'darkorange1' : '#FF7F00', 230 | \ 'darkorange2' : '#EE7600', 231 | \ 'darkorange3' : '#CD6600', 232 | \ 'darkorange4' : '#8B4500', 233 | \ 'darkorchid' : '#9932CC', 234 | \ 'darkorchid1' : '#BF3EFF', 235 | \ 'darkorchid2' : '#B23AEE', 236 | \ 'darkorchid3' : '#9A32CD', 237 | \ 'darkorchid4' : '#68228B', 238 | \ 'darkred' : '#8B0000', 239 | \ 'darksalmon' : '#E9967A', 240 | \ 'darkseagreen' : '#8FBC8F', 241 | \ 'darkseagreen1' : '#C1FFC1', 242 | \ 'darkseagreen2' : '#B4EEB4', 243 | \ 'darkseagreen3' : '#9BCD9B', 244 | \ 'darkseagreen4' : '#698B69', 245 | \ 'darkslateblue' : '#483D8B', 246 | \ 'darkslategray' : '#2F4F4F', 247 | \ 'darkslategray1' : '#97FFFF', 248 | \ 'darkslategray2' : '#8DEEEE', 249 | \ 'darkslategray3' : '#79CDCD', 250 | \ 'darkslategray4' : '#528B8B', 251 | \ 'darkslategrey' : '#2F4F4F', 252 | \ 'darkturquoise' : '#00CED1', 253 | \ 'darkviolet' : '#9400D3', 254 | \ 'darkyellow' : '#BBBB00', 255 | \ 'deep pink' : '#FF1493', 256 | \ 'deep sky blue' : '#00BFFF', 257 | \ 'deeppink' : '#FF1493', 258 | \ 'deeppink1' : '#FF1493', 259 | \ 'deeppink2' : '#EE1289', 260 | \ 'deeppink3' : '#CD1076', 261 | \ 'deeppink4' : '#8B0A50', 262 | \ 'deepskyblue' : '#00BFFF', 263 | \ 'deepskyblue1' : '#00BFFF', 264 | \ 'deepskyblue2' : '#00B2EE', 265 | \ 'deepskyblue3' : '#009ACD', 266 | \ 'deepskyblue4' : '#00688B', 267 | \ 'dim gray' : '#696969', 268 | \ 'dim grey' : '#696969', 269 | \ 'dimgray' : '#696969', 270 | \ 'dimgrey' : '#696969', 271 | \ 'dodger blue' : '#1E90FF', 272 | \ 'dodgerblue' : '#1E90FF', 273 | \ 'dodgerblue1' : '#1E90FF', 274 | \ 'dodgerblue2' : '#1C86EE', 275 | \ 'dodgerblue3' : '#1874CD', 276 | \ 'dodgerblue4' : '#104E8B', 277 | \ 'firebrick' : '#B22222', 278 | \ 'firebrick1' : '#FF3030', 279 | \ 'firebrick2' : '#EE2C2C', 280 | \ 'firebrick3' : '#CD2626', 281 | \ 'firebrick4' : '#8B1A1A', 282 | \ 'floral white' : '#FFFAF0', 283 | \ 'floralwhite' : '#FFFAF0', 284 | \ 'forest green' : '#228B22', 285 | \ 'forestgreen' : '#228B22', 286 | \ 'gainsboro' : '#DCDCDC', 287 | \ 'ghost white' : '#F8F8FF', 288 | \ 'ghostwhite' : '#F8F8FF', 289 | \ 'gold' : '#FFD700', 290 | \ 'gold1' : '#FFD700', 291 | \ 'gold2' : '#EEC900', 292 | \ 'gold3' : '#CDAD00', 293 | \ 'gold4' : '#8B7500', 294 | \ 'goldenrod' : '#DAA520', 295 | \ 'goldenrod1' : '#FFC125', 296 | \ 'goldenrod2' : '#EEB422', 297 | \ 'goldenrod3' : '#CD9B1D', 298 | \ 'goldenrod4' : '#8B6914', 299 | \ 'gray' : '#BEBEBE', 300 | \ 'gray0' : '#000000', 301 | \ 'gray1' : '#030303', 302 | \ 'gray10' : '#1A1A1A', 303 | \ 'gray100' : '#FFFFFF', 304 | \ 'gray11' : '#1C1C1C', 305 | \ 'gray12' : '#1F1F1F', 306 | \ 'gray13' : '#212121', 307 | \ 'gray14' : '#242424', 308 | \ 'gray15' : '#262626', 309 | \ 'gray16' : '#292929', 310 | \ 'gray17' : '#2B2B2B', 311 | \ 'gray18' : '#2E2E2E', 312 | \ 'gray19' : '#303030', 313 | \ 'gray2' : '#050505', 314 | \ 'gray20' : '#333333', 315 | \ 'gray21' : '#363636', 316 | \ 'gray22' : '#383838', 317 | \ 'gray23' : '#3B3B3B', 318 | \ 'gray24' : '#3D3D3D', 319 | \ 'gray25' : '#404040', 320 | \ 'gray26' : '#424242', 321 | \ 'gray27' : '#454545', 322 | \ 'gray28' : '#474747', 323 | \ 'gray29' : '#4A4A4A', 324 | \ 'gray3' : '#080808', 325 | \ 'gray30' : '#4D4D4D', 326 | \ 'gray31' : '#4F4F4F', 327 | \ 'gray32' : '#525252', 328 | \ 'gray33' : '#545454', 329 | \ 'gray34' : '#575757', 330 | \ 'gray35' : '#595959', 331 | \ 'gray36' : '#5C5C5C', 332 | \ 'gray37' : '#5E5E5E', 333 | \ 'gray38' : '#616161', 334 | \ 'gray39' : '#636363', 335 | \ 'gray4' : '#0A0A0A', 336 | \ 'gray40' : '#666666', 337 | \ 'gray41' : '#696969', 338 | \ 'gray42' : '#6B6B6B', 339 | \ 'gray43' : '#6E6E6E', 340 | \ 'gray44' : '#707070', 341 | \ 'gray45' : '#737373', 342 | \ 'gray46' : '#757575', 343 | \ 'gray47' : '#787878', 344 | \ 'gray48' : '#7A7A7A', 345 | \ 'gray49' : '#7D7D7D', 346 | \ 'gray5' : '#0D0D0D', 347 | \ 'gray50' : '#7F7F7F', 348 | \ 'gray51' : '#828282', 349 | \ 'gray52' : '#858585', 350 | \ 'gray53' : '#878787', 351 | \ 'gray54' : '#8A8A8A', 352 | \ 'gray55' : '#8C8C8C', 353 | \ 'gray56' : '#8F8F8F', 354 | \ 'gray57' : '#919191', 355 | \ 'gray58' : '#949494', 356 | \ 'gray59' : '#969696', 357 | \ 'gray6' : '#0F0F0F', 358 | \ 'gray60' : '#999999', 359 | \ 'gray61' : '#9C9C9C', 360 | \ 'gray62' : '#9E9E9E', 361 | \ 'gray63' : '#A1A1A1', 362 | \ 'gray64' : '#A3A3A3', 363 | \ 'gray65' : '#A6A6A6', 364 | \ 'gray66' : '#A8A8A8', 365 | \ 'gray67' : '#ABABAB', 366 | \ 'gray68' : '#ADADAD', 367 | \ 'gray69' : '#B0B0B0', 368 | \ 'gray7' : '#121212', 369 | \ 'gray70' : '#B3B3B3', 370 | \ 'gray71' : '#B5B5B5', 371 | \ 'gray72' : '#B8B8B8', 372 | \ 'gray73' : '#BABABA', 373 | \ 'gray74' : '#BDBDBD', 374 | \ 'gray75' : '#BFBFBF', 375 | \ 'gray76' : '#C2C2C2', 376 | \ 'gray77' : '#C4C4C4', 377 | \ 'gray78' : '#C7C7C7', 378 | \ 'gray79' : '#C9C9C9', 379 | \ 'gray8' : '#141414', 380 | \ 'gray80' : '#CCCCCC', 381 | \ 'gray81' : '#CFCFCF', 382 | \ 'gray82' : '#D1D1D1', 383 | \ 'gray83' : '#D4D4D4', 384 | \ 'gray84' : '#D6D6D6', 385 | \ 'gray85' : '#D9D9D9', 386 | \ 'gray86' : '#DBDBDB', 387 | \ 'gray87' : '#DEDEDE', 388 | \ 'gray88' : '#E0E0E0', 389 | \ 'gray89' : '#E3E3E3', 390 | \ 'gray9' : '#171717', 391 | \ 'gray90' : '#E5E5E5', 392 | \ 'gray91' : '#E8E8E8', 393 | \ 'gray92' : '#EBEBEB', 394 | \ 'gray93' : '#EDEDED', 395 | \ 'gray94' : '#F0F0F0', 396 | \ 'gray95' : '#F2F2F2', 397 | \ 'gray96' : '#F5F5F5', 398 | \ 'gray97' : '#F7F7F7', 399 | \ 'gray98' : '#FAFAFA', 400 | \ 'gray99' : '#FCFCFC', 401 | \ 'green yellow' : '#ADFF2F', 402 | \ 'green' : '#00FF00', 403 | \ 'green1' : '#00FF00', 404 | \ 'green2' : '#00EE00', 405 | \ 'green3' : '#00CD00', 406 | \ 'green4' : '#008B00', 407 | \ 'greenyellow' : '#ADFF2F', 408 | \ 'grey' : '#BEBEBE', 409 | \ 'grey0' : '#000000', 410 | \ 'grey1' : '#030303', 411 | \ 'grey10' : '#1A1A1A', 412 | \ 'grey100' : '#FFFFFF', 413 | \ 'grey11' : '#1C1C1C', 414 | \ 'grey12' : '#1F1F1F', 415 | \ 'grey13' : '#212121', 416 | \ 'grey14' : '#242424', 417 | \ 'grey15' : '#262626', 418 | \ 'grey16' : '#292929', 419 | \ 'grey17' : '#2B2B2B', 420 | \ 'grey18' : '#2E2E2E', 421 | \ 'grey19' : '#303030', 422 | \ 'grey2' : '#050505', 423 | \ 'grey20' : '#333333', 424 | \ 'grey21' : '#363636', 425 | \ 'grey22' : '#383838', 426 | \ 'grey23' : '#3B3B3B', 427 | \ 'grey24' : '#3D3D3D', 428 | \ 'grey25' : '#404040', 429 | \ 'grey26' : '#424242', 430 | \ 'grey27' : '#454545', 431 | \ 'grey28' : '#474747', 432 | \ 'grey29' : '#4A4A4A', 433 | \ 'grey3' : '#080808', 434 | \ 'grey30' : '#4D4D4D', 435 | \ 'grey31' : '#4F4F4F', 436 | \ 'grey32' : '#525252', 437 | \ 'grey33' : '#545454', 438 | \ 'grey34' : '#575757', 439 | \ 'grey35' : '#595959', 440 | \ 'grey36' : '#5C5C5C', 441 | \ 'grey37' : '#5E5E5E', 442 | \ 'grey38' : '#616161', 443 | \ 'grey39' : '#636363', 444 | \ 'grey4' : '#0A0A0A', 445 | \ 'grey40' : '#666666', 446 | \ 'grey41' : '#696969', 447 | \ 'grey42' : '#6B6B6B', 448 | \ 'grey43' : '#6E6E6E', 449 | \ 'grey44' : '#707070', 450 | \ 'grey45' : '#737373', 451 | \ 'grey46' : '#757575', 452 | \ 'grey47' : '#787878', 453 | \ 'grey48' : '#7A7A7A', 454 | \ 'grey49' : '#7D7D7D', 455 | \ 'grey5' : '#0D0D0D', 456 | \ 'grey50' : '#7F7F7F', 457 | \ 'grey51' : '#828282', 458 | \ 'grey52' : '#858585', 459 | \ 'grey53' : '#878787', 460 | \ 'grey54' : '#8A8A8A', 461 | \ 'grey55' : '#8C8C8C', 462 | \ 'grey56' : '#8F8F8F', 463 | \ 'grey57' : '#919191', 464 | \ 'grey58' : '#949494', 465 | \ 'grey59' : '#969696', 466 | \ 'grey6' : '#0F0F0F', 467 | \ 'grey60' : '#999999', 468 | \ 'grey61' : '#9C9C9C', 469 | \ 'grey62' : '#9E9E9E', 470 | \ 'grey63' : '#A1A1A1', 471 | \ 'grey64' : '#A3A3A3', 472 | \ 'grey65' : '#A6A6A6', 473 | \ 'grey66' : '#A8A8A8', 474 | \ 'grey67' : '#ABABAB', 475 | \ 'grey68' : '#ADADAD', 476 | \ 'grey69' : '#B0B0B0', 477 | \ 'grey7' : '#121212', 478 | \ 'grey70' : '#B3B3B3', 479 | \ 'grey71' : '#B5B5B5', 480 | \ 'grey72' : '#B8B8B8', 481 | \ 'grey73' : '#BABABA', 482 | \ 'grey74' : '#BDBDBD', 483 | \ 'grey75' : '#BFBFBF', 484 | \ 'grey76' : '#C2C2C2', 485 | \ 'grey77' : '#C4C4C4', 486 | \ 'grey78' : '#C7C7C7', 487 | \ 'grey79' : '#C9C9C9', 488 | \ 'grey8' : '#141414', 489 | \ 'grey80' : '#CCCCCC', 490 | \ 'grey81' : '#CFCFCF', 491 | \ 'grey82' : '#D1D1D1', 492 | \ 'grey83' : '#D4D4D4', 493 | \ 'grey84' : '#D6D6D6', 494 | \ 'grey85' : '#D9D9D9', 495 | \ 'grey86' : '#DBDBDB', 496 | \ 'grey87' : '#DEDEDE', 497 | \ 'grey88' : '#E0E0E0', 498 | \ 'grey89' : '#E3E3E3', 499 | \ 'grey9' : '#171717', 500 | \ 'grey90' : '#E5E5E5', 501 | \ 'grey91' : '#E8E8E8', 502 | \ 'grey92' : '#EBEBEB', 503 | \ 'grey93' : '#EDEDED', 504 | \ 'grey94' : '#F0F0F0', 505 | \ 'grey95' : '#F2F2F2', 506 | \ 'grey96' : '#F5F5F5', 507 | \ 'grey97' : '#F7F7F7', 508 | \ 'grey98' : '#FAFAFA', 509 | \ 'grey99' : '#FCFCFC', 510 | \ 'honeydew' : '#F0FFF0', 511 | \ 'honeydew1' : '#F0FFF0', 512 | \ 'honeydew2' : '#E0EEE0', 513 | \ 'honeydew3' : '#C1CDC1', 514 | \ 'honeydew4' : '#838B83', 515 | \ 'hot pink' : '#FF69B4', 516 | \ 'hotpink' : '#FF69B4', 517 | \ 'hotpink1' : '#FF6EB4', 518 | \ 'hotpink2' : '#EE6AA7', 519 | \ 'hotpink3' : '#CD6090', 520 | \ 'hotpink4' : '#8B3A62', 521 | \ 'indian red' : '#CD5C5C', 522 | \ 'indianred' : '#CD5C5C', 523 | \ 'indianred1' : '#FF6A6A', 524 | \ 'indianred2' : '#EE6363', 525 | \ 'indianred3' : '#CD5555', 526 | \ 'indianred4' : '#8B3A3A', 527 | \ 'ivory' : '#FFFFF0', 528 | \ 'ivory1' : '#FFFFF0', 529 | \ 'ivory2' : '#EEEEE0', 530 | \ 'ivory3' : '#CDCDC1', 531 | \ 'ivory4' : '#8B8B83', 532 | \ 'khaki' : '#F0E68C', 533 | \ 'khaki1' : '#FFF68F', 534 | \ 'khaki2' : '#EEE685', 535 | \ 'khaki3' : '#CDC673', 536 | \ 'khaki4' : '#8B864E', 537 | \ 'lavender blush' : '#FFF0F5', 538 | \ 'lavender' : '#E6E6FA', 539 | \ 'lavenderblush' : '#FFF0F5', 540 | \ 'lavenderblush1' : '#FFF0F5', 541 | \ 'lavenderblush2' : '#EEE0E5', 542 | \ 'lavenderblush3' : '#CDC1C5', 543 | \ 'lavenderblush4' : '#8B8386', 544 | \ 'lawn green' : '#7CFC00', 545 | \ 'lawngreen' : '#7CFC00', 546 | \ 'lemon chiffon' : '#FFFACD', 547 | \ 'lemonchiffon' : '#FFFACD', 548 | \ 'lemonchiffon1' : '#FFFACD', 549 | \ 'lemonchiffon2' : '#EEE9BF', 550 | \ 'lemonchiffon3' : '#CDC9A5', 551 | \ 'lemonchiffon4' : '#8B8970', 552 | \ 'light blue' : '#ADD8E6', 553 | \ 'light coral' : '#F08080', 554 | \ 'light cyan' : '#E0FFFF', 555 | \ 'light goldenrod yellow' : '#FAFAD2', 556 | \ 'light goldenrod' : '#EEDD82', 557 | \ 'light gray' : '#D3D3D3', 558 | \ 'light green' : '#90EE90', 559 | \ 'light grey' : '#D3D3D3', 560 | \ 'light magenta' : '#FFBBFF', 561 | \ 'light pink' : '#FFB6C1', 562 | \ 'light red' : '#FFBBBB', 563 | \ 'light salmon' : '#FFA07A', 564 | \ 'light sea green' : '#20B2AA', 565 | \ 'light sky blue' : '#87CEFA', 566 | \ 'light slate blue' : '#8470FF', 567 | \ 'light slate gray' : '#778899', 568 | \ 'light slate grey' : '#778899', 569 | \ 'light steel blue' : '#B0C4DE', 570 | \ 'light yellow' : '#FFFFE0', 571 | \ 'lightblue' : '#ADD8E6', 572 | \ 'lightblue1' : '#BFEFFF', 573 | \ 'lightblue2' : '#B2DFEE', 574 | \ 'lightblue3' : '#9AC0CD', 575 | \ 'lightblue4' : '#68838B', 576 | \ 'lightcoral' : '#F08080', 577 | \ 'lightcyan' : '#E0FFFF', 578 | \ 'lightcyan1' : '#E0FFFF', 579 | \ 'lightcyan2' : '#D1EEEE', 580 | \ 'lightcyan3' : '#B4CDCD', 581 | \ 'lightcyan4' : '#7A8B8B', 582 | \ 'lightgoldenrod' : '#EEDD82', 583 | \ 'lightgoldenrod1' : '#FFEC8B', 584 | \ 'lightgoldenrod2' : '#EEDC82', 585 | \ 'lightgoldenrod3' : '#CDBE70', 586 | \ 'lightgoldenrod4' : '#8B814C', 587 | \ 'lightgoldenrodyellow' : '#FAFAD2', 588 | \ 'lightgray' : '#D3D3D3', 589 | \ 'lightgreen' : '#90EE90', 590 | \ 'lightgrey' : '#D3D3D3', 591 | \ 'lightmagenta' : '#FFBBFF', 592 | \ 'lightpink' : '#FFB6C1', 593 | \ 'lightpink1' : '#FFAEB9', 594 | \ 'lightpink2' : '#EEA2AD', 595 | \ 'lightpink3' : '#CD8C95', 596 | \ 'lightpink4' : '#8B5F65', 597 | \ 'lightred' : '#FFBBBB', 598 | \ 'lightsalmon' : '#FFA07A', 599 | \ 'lightsalmon1' : '#FFA07A', 600 | \ 'lightsalmon2' : '#EE9572', 601 | \ 'lightsalmon3' : '#CD8162', 602 | \ 'lightsalmon4' : '#8B5742', 603 | \ 'lightseagreen' : '#20B2AA', 604 | \ 'lightskyblue' : '#87CEFA', 605 | \ 'lightskyblue1' : '#B0E2FF', 606 | \ 'lightskyblue2' : '#A4D3EE', 607 | \ 'lightskyblue3' : '#8DB6CD', 608 | \ 'lightskyblue4' : '#607B8B', 609 | \ 'lightslateblue' : '#8470FF', 610 | \ 'lightslategray' : '#778899', 611 | \ 'lightslategrey' : '#778899', 612 | \ 'lightsteelblue' : '#B0C4DE', 613 | \ 'lightsteelblue1' : '#CAE1FF', 614 | \ 'lightsteelblue2' : '#BCD2EE', 615 | \ 'lightsteelblue3' : '#A2B5CD', 616 | \ 'lightsteelblue4' : '#6E7B8B', 617 | \ 'lightyellow' : '#FFFFE0', 618 | \ 'lightyellow1' : '#FFFFE0', 619 | \ 'lightyellow2' : '#EEEED1', 620 | \ 'lightyellow3' : '#CDCDB4', 621 | \ 'lightyellow4' : '#8B8B7A', 622 | \ 'lime green' : '#32CD32', 623 | \ 'limegreen' : '#32CD32', 624 | \ 'linen' : '#FAF0E6', 625 | \ 'magenta' : '#FF00FF', 626 | \ 'magenta1' : '#FF00FF', 627 | \ 'magenta2' : '#EE00EE', 628 | \ 'magenta3' : '#CD00CD', 629 | \ 'magenta4' : '#8B008B', 630 | \ 'maroon' : '#B03060', 631 | \ 'maroon1' : '#FF34B3', 632 | \ 'maroon2' : '#EE30A7', 633 | \ 'maroon3' : '#CD2990', 634 | \ 'maroon4' : '#8B1C62', 635 | \ 'medium aquamarine' : '#66CDAA', 636 | \ 'medium blue' : '#0000CD', 637 | \ 'medium orchid' : '#BA55D3', 638 | \ 'medium purple' : '#9370DB', 639 | \ 'medium sea green' : '#3CB371', 640 | \ 'medium slate blue' : '#7B68EE', 641 | \ 'medium spring green' : '#00FA9A', 642 | \ 'medium turquoise' : '#48D1CC', 643 | \ 'medium violet red' : '#C71585', 644 | \ 'mediumaquamarine' : '#66CDAA', 645 | \ 'mediumblue' : '#0000CD', 646 | \ 'mediumorchid' : '#BA55D3', 647 | \ 'mediumorchid1' : '#E066FF', 648 | \ 'mediumorchid2' : '#D15FEE', 649 | \ 'mediumorchid3' : '#B452CD', 650 | \ 'mediumorchid4' : '#7A378B', 651 | \ 'mediumpurple' : '#9370DB', 652 | \ 'mediumpurple1' : '#AB82FF', 653 | \ 'mediumpurple2' : '#9F79EE', 654 | \ 'mediumpurple3' : '#8968CD', 655 | \ 'mediumpurple4' : '#5D478B', 656 | \ 'mediumseagreen' : '#3CB371', 657 | \ 'mediumslateblue' : '#7B68EE', 658 | \ 'mediumspringgreen' : '#00FA9A', 659 | \ 'mediumturquoise' : '#48D1CC', 660 | \ 'mediumvioletred' : '#C71585', 661 | \ 'midnight blue' : '#191970', 662 | \ 'midnightblue' : '#191970', 663 | \ 'mint cream' : '#F5FFFA', 664 | \ 'mintcream' : '#F5FFFA', 665 | \ 'misty rose' : '#FFE4E1', 666 | \ 'mistyrose' : '#FFE4E1', 667 | \ 'mistyrose1' : '#FFE4E1', 668 | \ 'mistyrose2' : '#EED5D2', 669 | \ 'mistyrose3' : '#CDB7B5', 670 | \ 'mistyrose4' : '#8B7D7B', 671 | \ 'moccasin' : '#FFE4B5', 672 | \ 'navajo white' : '#FFDEAD', 673 | \ 'navajowhite' : '#FFDEAD', 674 | \ 'navajowhite1' : '#FFDEAD', 675 | \ 'navajowhite2' : '#EECFA1', 676 | \ 'navajowhite3' : '#CDB38B', 677 | \ 'navajowhite4' : '#8B795E', 678 | \ 'navy blue' : '#000080', 679 | \ 'navy' : '#000080', 680 | \ 'navyblue' : '#000080', 681 | \ 'old lace' : '#FDF5E6', 682 | \ 'oldlace' : '#FDF5E6', 683 | \ 'olive drab' : '#6B8E23', 684 | \ 'olivedrab' : '#6B8E23', 685 | \ 'olivedrab1' : '#C0FF3E', 686 | \ 'olivedrab2' : '#B3EE3A', 687 | \ 'olivedrab3' : '#9ACD32', 688 | \ 'olivedrab4' : '#698B22', 689 | \ 'orange red' : '#FF4500', 690 | \ 'orange' : '#FFA500', 691 | \ 'orange1' : '#FFA500', 692 | \ 'orange2' : '#EE9A00', 693 | \ 'orange3' : '#CD8500', 694 | \ 'orange4' : '#8B5A00', 695 | \ 'orangered' : '#FF4500', 696 | \ 'orangered1' : '#FF4500', 697 | \ 'orangered2' : '#EE4000', 698 | \ 'orangered3' : '#CD3700', 699 | \ 'orangered4' : '#8B2500', 700 | \ 'orchid' : '#DA70D6', 701 | \ 'orchid1' : '#FF83FA', 702 | \ 'orchid2' : '#EE7AE9', 703 | \ 'orchid3' : '#CD69C9', 704 | \ 'orchid4' : '#8B4789', 705 | \ 'pale goldenrod' : '#EEE8AA', 706 | \ 'pale green' : '#98FB98', 707 | \ 'pale turquoise' : '#AFEEEE', 708 | \ 'pale violet red' : '#DB7093', 709 | \ 'palegoldenrod' : '#EEE8AA', 710 | \ 'palegreen' : '#98FB98', 711 | \ 'palegreen1' : '#9AFF9A', 712 | \ 'palegreen2' : '#90EE90', 713 | \ 'palegreen3' : '#7CCD7C', 714 | \ 'palegreen4' : '#548B54', 715 | \ 'paleturquoise' : '#AFEEEE', 716 | \ 'paleturquoise1' : '#BBFFFF', 717 | \ 'paleturquoise2' : '#AEEEEE', 718 | \ 'paleturquoise3' : '#96CDCD', 719 | \ 'paleturquoise4' : '#668B8B', 720 | \ 'palevioletred' : '#DB7093', 721 | \ 'palevioletred1' : '#FF82AB', 722 | \ 'palevioletred2' : '#EE799F', 723 | \ 'palevioletred3' : '#CD6889', 724 | \ 'palevioletred4' : '#8B475D', 725 | \ 'papaya whip' : '#FFEFD5', 726 | \ 'papayawhip' : '#FFEFD5', 727 | \ 'peach puff' : '#FFDAB9', 728 | \ 'peachpuff' : '#FFDAB9', 729 | \ 'peachpuff1' : '#FFDAB9', 730 | \ 'peachpuff2' : '#EECBAD', 731 | \ 'peachpuff3' : '#CDAF95', 732 | \ 'peachpuff4' : '#8B7765', 733 | \ 'peru' : '#CD853F', 734 | \ 'pink' : '#FFC0CB', 735 | \ 'pink1' : '#FFB5C5', 736 | \ 'pink2' : '#EEA9B8', 737 | \ 'pink3' : '#CD919E', 738 | \ 'pink4' : '#8B636C', 739 | \ 'plum' : '#DDA0DD', 740 | \ 'plum1' : '#FFBBFF', 741 | \ 'plum2' : '#EEAEEE', 742 | \ 'plum3' : '#CD96CD', 743 | \ 'plum4' : '#8B668B', 744 | \ 'powder blue' : '#B0E0E6', 745 | \ 'powderblue' : '#B0E0E6', 746 | \ 'purple' : '#A020F0', 747 | \ 'purple1' : '#9B30FF', 748 | \ 'purple2' : '#912CEE', 749 | \ 'purple3' : '#7D26CD', 750 | \ 'purple4' : '#551A8B', 751 | \ 'red' : '#FF0000', 752 | \ 'red1' : '#FF0000', 753 | \ 'red2' : '#EE0000', 754 | \ 'red3' : '#CD0000', 755 | \ 'red4' : '#8B0000', 756 | \ 'rosy brown' : '#BC8F8F', 757 | \ 'rosybrown' : '#BC8F8F', 758 | \ 'rosybrown1' : '#FFC1C1', 759 | \ 'rosybrown2' : '#EEB4B4', 760 | \ 'rosybrown3' : '#CD9B9B', 761 | \ 'rosybrown4' : '#8B6969', 762 | \ 'royal blue' : '#4169E1', 763 | \ 'royalblue' : '#4169E1', 764 | \ 'royalblue1' : '#4876FF', 765 | \ 'royalblue2' : '#436EEE', 766 | \ 'royalblue3' : '#3A5FCD', 767 | \ 'royalblue4' : '#27408B', 768 | \ 'saddle brown' : '#8B4513', 769 | \ 'saddlebrown' : '#8B4513', 770 | \ 'salmon' : '#FA8072', 771 | \ 'salmon1' : '#FF8C69', 772 | \ 'salmon2' : '#EE8262', 773 | \ 'salmon3' : '#CD7054', 774 | \ 'salmon4' : '#8B4C39', 775 | \ 'sandy brown' : '#F4A460', 776 | \ 'sandybrown' : '#F4A460', 777 | \ 'sea green' : '#2E8B57', 778 | \ 'seagreen' : '#2E8B57', 779 | \ 'seagreen1' : '#54FF9F', 780 | \ 'seagreen2' : '#4EEE94', 781 | \ 'seagreen3' : '#43CD80', 782 | \ 'seagreen4' : '#2E8B57', 783 | \ 'seashell' : '#FFF5EE', 784 | \ 'seashell1' : '#FFF5EE', 785 | \ 'seashell2' : '#EEE5DE', 786 | \ 'seashell3' : '#CDC5BF', 787 | \ 'seashell4' : '#8B8682', 788 | \ 'sienna' : '#A0522D', 789 | \ 'sienna1' : '#FF8247', 790 | \ 'sienna2' : '#EE7942', 791 | \ 'sienna3' : '#CD6839', 792 | \ 'sienna4' : '#8B4726', 793 | \ 'sky blue' : '#87CEEB', 794 | \ 'skyblue' : '#87CEEB', 795 | \ 'skyblue1' : '#87CEFF', 796 | \ 'skyblue2' : '#7EC0EE', 797 | \ 'skyblue3' : '#6CA6CD', 798 | \ 'skyblue4' : '#4A708B', 799 | \ 'slate blue' : '#6A5ACD', 800 | \ 'slate gray' : '#708090', 801 | \ 'slate grey' : '#708090', 802 | \ 'slateblue' : '#6A5ACD', 803 | \ 'slateblue1' : '#836FFF', 804 | \ 'slateblue2' : '#7A67EE', 805 | \ 'slateblue3' : '#6959CD', 806 | \ 'slateblue4' : '#473C8B', 807 | \ 'slategray' : '#708090', 808 | \ 'slategray1' : '#C6E2FF', 809 | \ 'slategray2' : '#B9D3EE', 810 | \ 'slategray3' : '#9FB6CD', 811 | \ 'slategray4' : '#6C7B8B', 812 | \ 'slategrey' : '#708090', 813 | \ 'snow' : '#FFFAFA', 814 | \ 'snow1' : '#FFFAFA', 815 | \ 'snow2' : '#EEE9E9', 816 | \ 'snow3' : '#CDC9C9', 817 | \ 'snow4' : '#8B8989', 818 | \ 'spring green' : '#00FF7F', 819 | \ 'springgreen' : '#00FF7F', 820 | \ 'springgreen1' : '#00FF7F', 821 | \ 'springgreen2' : '#00EE76', 822 | \ 'springgreen3' : '#00CD66', 823 | \ 'springgreen4' : '#008B45', 824 | \ 'steel blue' : '#4682B4', 825 | \ 'steelblue' : '#4682B4', 826 | \ 'steelblue1' : '#63B8FF', 827 | \ 'steelblue2' : '#5CACEE', 828 | \ 'steelblue3' : '#4F94CD', 829 | \ 'steelblue4' : '#36648B', 830 | \ 'tan' : '#D2B48C', 831 | \ 'tan1' : '#FFA54F', 832 | \ 'tan2' : '#EE9A49', 833 | \ 'tan3' : '#CD853F', 834 | \ 'tan4' : '#8B5A2B', 835 | \ 'thistle' : '#D8BFD8', 836 | \ 'thistle1' : '#FFE1FF', 837 | \ 'thistle2' : '#EED2EE', 838 | \ 'thistle3' : '#CDB5CD', 839 | \ 'thistle4' : '#8B7B8B', 840 | \ 'tomato' : '#FF6347', 841 | \ 'tomato1' : '#FF6347', 842 | \ 'tomato2' : '#EE5C42', 843 | \ 'tomato3' : '#CD4F39', 844 | \ 'tomato4' : '#8B3626', 845 | \ 'turquoise' : '#40E0D0', 846 | \ 'turquoise1' : '#00F5FF', 847 | \ 'turquoise2' : '#00E5EE', 848 | \ 'turquoise3' : '#00C5CD', 849 | \ 'turquoise4' : '#00868B', 850 | \ 'violet red' : '#D02090', 851 | \ 'violet' : '#EE82EE', 852 | \ 'violetred' : '#D02090', 853 | \ 'violetred1' : '#FF3E96', 854 | \ 'violetred2' : '#EE3A8C', 855 | \ 'violetred3' : '#CD3278', 856 | \ 'violetred4' : '#8B2252', 857 | \ 'wheat' : '#F5DEB3', 858 | \ 'wheat1' : '#FFE7BA', 859 | \ 'wheat2' : '#EED8AE', 860 | \ 'wheat3' : '#CDBA96', 861 | \ 'wheat4' : '#8B7E66', 862 | \ 'white smoke' : '#F5F5F5', 863 | \ 'white' : '#FFFFFF', 864 | \ 'whitesmoke' : '#F5F5F5', 865 | \ 'yellow green' : '#9ACD32', 866 | \ 'yellow' : '#FFFF00', 867 | \ 'yellow1' : '#FFFF00', 868 | \ 'yellow2' : '#EEEE00', 869 | \ 'yellow3' : '#CDCD00', 870 | \ 'yellow4' : '#8B8B00', 871 | \ 'yellowgreen' : '#9ACD32', 872 | \} 873 | 874 | if has_key(l:color_list, l:color_name) 875 | let l:hex_code = l:color_list[l:color_name] 876 | endif 877 | 878 | return l:hex_code 879 | endfunction 880 | -------------------------------------------------------------------------------- /autoload/indent_guides.vim: -------------------------------------------------------------------------------- 1 | " Author: Nate Kane 2 | " Homepage: http://github.com/nathanaelkane/vim-indent-guides 3 | 4 | " 5 | " Toggles the indent guides on and off. 6 | " 7 | function! indent_guides#toggle() 8 | call indent_guides#init_matches() 9 | 10 | if empty(w:indent_guides_matches) 11 | call indent_guides#enable() 12 | else 13 | call indent_guides#disable() 14 | endif 15 | endfunction 16 | 17 | " 18 | " Called from autocmds, keeps indent guides enabled or disabled when entering 19 | " other buffers and windows. 20 | " 21 | function! indent_guides#process_autocmds() 22 | if g:indent_guides_autocmds_enabled 23 | call indent_guides#enable() 24 | else 25 | call indent_guides#disable() 26 | end 27 | endfunction 28 | 29 | " 30 | " Enables the indent guides for the current buffer and any other buffer upon 31 | " entering it. 32 | " 33 | function! indent_guides#enable() 34 | let g:indent_guides_autocmds_enabled = 1 35 | 36 | if &diff || indent_guides#exclude_filetype() 37 | call indent_guides#clear_matches() 38 | return 39 | end 40 | 41 | call indent_guides#init_script_vars() 42 | call indent_guides#highlight_colors() 43 | call indent_guides#clear_matches() 44 | 45 | " loop through each indent level and define a highlight pattern 46 | " will automagically figure out whether to use tabs or spaces 47 | for l:level in range(s:start_level, s:indent_levels) 48 | let l:group = 'IndentGuides' . ((l:level % 2 == 0) ? 'Even' : 'Odd') 49 | let l:column_start = (l:level - 1) * s:indent_size + 1 50 | 51 | " define the higlight patterns and add to matches list 52 | if g:indent_guides_space_guides 53 | let l:soft_pattern = indent_guides#indent_highlight_pattern(g:indent_guides_soft_pattern, l:column_start, s:guide_size) 54 | call add(w:indent_guides_matches, matchadd(l:group, l:soft_pattern)) 55 | end 56 | if g:indent_guides_tab_guides 57 | let l:hard_pattern = indent_guides#indent_highlight_pattern('\t', l:column_start, s:indent_size) 58 | call add(w:indent_guides_matches, matchadd(l:group, l:hard_pattern)) 59 | end 60 | endfor 61 | 62 | let l:view = winsaveview() 63 | call cursor(1, 1) 64 | call nvim_buf_clear_namespace(0, s:ns, 1, -1) 65 | while v:true 66 | let l:line = search('^$', 'W') 67 | if l:line ==# 0 68 | break 69 | endif 70 | 71 | let l:indent = cindent(l:line) 72 | if l:indent ==# 0 73 | continue 74 | endif 75 | 76 | let l:guides = [[repeat(' ', s:indent_size - 1), '']] 77 | for l:level in range(l:indent / s:indent_size) 78 | let l:guide = repeat(' ', s:indent_size) 79 | if l:level % 2 == 0 80 | call add(l:guides, [l:guide, 'IndentGuidesEven']) 81 | else 82 | call add(l:guides, [l:guide, 'IndentGuidesOdd']) 83 | endif 84 | endfor 85 | call nvim_buf_set_virtual_text(0, s:ns, l:line - 1, l:guides, {}) 86 | endwhile 87 | call winrestview(l:view) 88 | endfunction 89 | 90 | " 91 | " Disables the indent guides for the current buffer and any other buffer upon 92 | " entering it. 93 | " 94 | function! indent_guides#disable() 95 | let g:indent_guides_autocmds_enabled = 0 96 | call indent_guides#clear_matches() 97 | endfunction 98 | 99 | " 100 | " Clear all highlight matches for the current window. 101 | " 102 | function! indent_guides#clear_matches() 103 | call indent_guides#init_matches() 104 | if !empty(w:indent_guides_matches) 105 | let l:index = 0 106 | for l:match_id in w:indent_guides_matches 107 | try 108 | call matchdelete(l:match_id) 109 | catch /E803:/ 110 | " Do nothing 111 | endtry 112 | call remove(w:indent_guides_matches, l:index) 113 | let l:index += l:index 114 | endfor 115 | endif 116 | endfunction 117 | 118 | " 119 | " Automagically calculates and defines the indent highlight colors. 120 | " 121 | function! indent_guides#highlight_colors() 122 | if s:auto_colors 123 | if has('gui_running') || has('nvim') 124 | call indent_guides#gui_highlight_colors() 125 | else 126 | call indent_guides#basic_highlight_colors() 127 | endif 128 | endif 129 | endfunction 130 | 131 | " 132 | " Defines some basic indent highlight colors that work for Terminal Vim and 133 | " gVim when colors can't be automatically calculated. 134 | " 135 | function! indent_guides#basic_highlight_colors() 136 | let l:cterm_colors = (&g:background == 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white'] 137 | let l:gui_colors = (&g:background == 'dark') ? ['grey15', 'grey30'] : ['grey70', 'grey85'] 138 | 139 | exe 'hi IndentGuidesEven guibg=' . l:gui_colors[0] . ' guifg=' . l:gui_colors[1] . ' ctermbg=' . l:cterm_colors[0] . ' ctermfg=' . l:cterm_colors[1] 140 | exe 'hi IndentGuidesOdd guibg=' . l:gui_colors[1] . ' guifg=' . l:gui_colors[0] . ' ctermbg=' . l:cterm_colors[1] . ' ctermfg=' . l:cterm_colors[0] 141 | endfunction 142 | 143 | " 144 | " Automagically calculates and defines the indent highlight colors for gui 145 | " vim. 146 | " 147 | function! indent_guides#gui_highlight_colors() 148 | let l:hi_normal_guibg = '' 149 | 150 | " capture the backgroud color from the normal highlight 151 | if s:hi_normal =~ s:color_hex_bg_pat 152 | " hex color code is being used, eg. '#FFFFFF' 153 | let l:hi_normal_guibg = matchstr(s:hi_normal, s:color_hex_bg_pat) 154 | 155 | elseif s:hi_normal =~ s:color_name_bg_pat 156 | " color name is being used, eg. 'white' 157 | let l:color_name = matchstr(s:hi_normal, s:color_name_bg_pat) 158 | let l:hi_normal_guibg = color_helper#color_name_to_hex(l:color_name) 159 | 160 | else 161 | " background color could not be detected, default to basic colors 162 | call indent_guides#basic_highlight_colors() 163 | endif 164 | 165 | if l:hi_normal_guibg =~ s:color_hex_pat 166 | " calculate the highlight background colors 167 | let l:hi_odd_bg = indent_guides#lighten_or_darken_color(l:hi_normal_guibg) 168 | let l:hi_even_bg = indent_guides#lighten_or_darken_color(l:hi_odd_bg) 169 | 170 | " define the new highlights 171 | exe 'hi IndentGuidesOdd guibg=' . l:hi_odd_bg . ' guifg=' . l:hi_even_bg 172 | exe 'hi IndentGuidesEven guibg=' . l:hi_even_bg . ' guifg=' . l:hi_odd_bg 173 | end 174 | endfunction 175 | 176 | " 177 | " Takes a color and darkens or lightens it depending on whether a dark or light 178 | " colorscheme is being used. 179 | " 180 | function! indent_guides#lighten_or_darken_color(color) 181 | let l:new_color = '' 182 | 183 | if (&g:background == 'dark') 184 | let l:new_color = color_helper#hex_color_lighten(a:color, s:change_percent) 185 | else 186 | let l:new_color = color_helper#hex_color_darken (a:color, s:change_percent) 187 | endif 188 | 189 | return l:new_color 190 | endfunction 191 | 192 | " 193 | " Define default highlights. 194 | " 195 | function! indent_guides#define_default_highlights() 196 | hi default clear IndentGuidesOdd 197 | hi default clear IndentGuidesEven 198 | endfunction 199 | 200 | " 201 | " Init the w:indent_guides_matches variable. 202 | " 203 | function! indent_guides#init_matches() 204 | let w:indent_guides_matches = exists('w:indent_guides_matches') ? w:indent_guides_matches : [] 205 | endfunction 206 | 207 | " 208 | " We need to initialize these vars every time a buffer is entered while the 209 | " plugin is enabled. 210 | " 211 | function! indent_guides#init_script_vars() 212 | if &l:shiftwidth > 0 && &l:expandtab 213 | let s:indent_size = &l:shiftwidth 214 | else 215 | let s:indent_size = &l:tabstop 216 | endif 217 | let s:guide_size = indent_guides#calculate_guide_size() 218 | let s:hi_normal = indent_guides#capture_highlight('Normal') 219 | let s:ns = nvim_create_namespace('neovim-indent-guides') 220 | 221 | " remove 'font=' from the s:hi_normal string (only seems to happen on Vim startup in Windows) 222 | let s:hi_normal = substitute(s:hi_normal, ' font=[A-Za-z0-9:]\+', "", "") 223 | 224 | " shortcuts to the global variables - this makes the code easier to read 225 | let s:debug = g:indent_guides_debug 226 | let s:indent_levels = g:indent_guides_indent_levels 227 | let s:auto_colors = g:indent_guides_auto_colors 228 | let s:color_hex_pat = g:indent_guides_color_hex_pattern 229 | let s:color_hex_bg_pat = g:indent_guides_color_hex_guibg_pattern 230 | let s:color_name_bg_pat = g:indent_guides_color_name_guibg_pattern 231 | let s:start_level = g:indent_guides_start_level 232 | 233 | " str2float not available in vim versions <= 7.1 234 | if has('float') 235 | let s:change_percent = g:indent_guides_color_change_percent / str2float('100.0') 236 | else 237 | let s:change_percent = g:indent_guides_color_change_percent / 100.0 238 | endif 239 | 240 | if s:debug 241 | echo 's:indent_size = ' . s:indent_size 242 | echo 's:guide_size = ' . s:guide_size 243 | echo 's:hi_normal = ' . s:hi_normal 244 | echo 's:indent_levels = ' . s:indent_levels 245 | echo 's:auto_colors = ' . s:auto_colors 246 | echo 's:change_percent = ' . string(s:change_percent) 247 | echo 's:color_hex_pat = ' . s:color_hex_pat 248 | echo 's:color_hex_bg_pat = ' . s:color_hex_bg_pat 249 | echo 's:color_name_bg_pat = ' . s:color_name_bg_pat 250 | echo 's:start_level = ' . s:start_level 251 | endif 252 | endfunction 253 | 254 | " 255 | " Calculate the indent guide size. Ensures the guide size is less than or 256 | " equal to the actual indent size, otherwise some weird things can occur. 257 | " 258 | " NOTE: Currently, this only works when soft-tabs are being used. 259 | " 260 | function! indent_guides#calculate_guide_size() 261 | let l:guide_size = g:indent_guides_guide_size 262 | 263 | if l:guide_size == 0 || l:guide_size > s:indent_size 264 | let l:guide_size = s:indent_size 265 | endif 266 | 267 | return l:guide_size 268 | endfunction 269 | 270 | " 271 | " Captures and returns the output of highlight group definitions. 272 | " 273 | " Example: indent_guides#capture_highlight('normal') 274 | " Returns: 'Normal xxx guifg=#323232 guibg=#ffffff' 275 | " 276 | function! indent_guides#capture_highlight(group_name) 277 | redir => l:output 278 | exe "silent hi " . a:group_name 279 | redir END 280 | 281 | let l:output = substitute(l:output, "\n", "", "") 282 | return l:output 283 | endfunction 284 | 285 | " 286 | " Returns a regex pattern for highlighting an indent level. 287 | " 288 | " Example: indent_guides#indent_highlight_pattern(' ', 1, 4) 289 | " Returns: /^ *\%1v\zs *\%5v\ze/ 290 | " 291 | " Example: indent_guides#indent_highlight_pattern('\s', 5, 2) 292 | " Returns: /^\s*\%5v\zs\s*\%7v\ze/ 293 | " 294 | " Example: indent_guides#indent_highlight_pattern('\t', 9, 2) 295 | " Returns: /^\t*\%9v\zs\t*\%11v\ze/ 296 | " 297 | function! indent_guides#indent_highlight_pattern(indent_pattern, column_start, indent_size) 298 | let l:pattern = '^' . a:indent_pattern . '*\%' . a:column_start . 'v\zs' 299 | let l:pattern .= a:indent_pattern . '*\%' . (a:column_start + a:indent_size) . 'v' 300 | let l:pattern .= '\ze' 301 | return l:pattern 302 | endfunction 303 | 304 | " 305 | " Detect if any of the buffer filetypes should be excluded. 306 | " 307 | function! indent_guides#exclude_filetype() 308 | for ft in split(&ft, '\.') 309 | if index(g:indent_guides_exclude_filetypes, ft) > -1 310 | return 1 311 | end 312 | endfor 313 | return 0 314 | endfunction 315 | -------------------------------------------------------------------------------- /doc/indent_guides.txt: -------------------------------------------------------------------------------- 1 | *indent_guides.txt* A plugin for visually displaying indent levels in Vim. 2 | 3 | *indent-guides* 4 | ____ __ __ ______ _ __ 5 | / _/____ ____/ /___ ____ / /_ / ____/__ __(_)____/ /___ _____ 6 | / / / __ \/ __ // _ \/ __ \/ __/ / / __ / / / / // __ // _ \/ ___/ 7 | _/ / / / / / /_/ // __/ / / / /_ / /_/ // /_/ / // /_/ // __(__ ) 8 | /___//_/ /_/\__,_/ \___/_/ /_/\__/ \____/ \__,_/_/ \__,_/ \___/____/ 9 | 10 | 11 | Author: Nate Kane 12 | Version: 1.7 13 | Last Change: 07 Mar 2013 14 | 15 | ============================================================================== 16 | CONTENTS *indent-guides-contents* 17 | 18 | 1. Introduction.......................... |indent-guides-introduction| 19 | 2. Commands.............................. |indent-guides-commands| 20 | 3. Options............................... |indent-guides-options| 21 | 4. Mappings.............................. |indent-guides-mappings| 22 | 5. Terminal Vim.......................... |indent-guides-terminal-vim| 23 | 6. About................................. |indent-guides-about| 24 | 7. Changelog............................. |indent-guides-changelog| 25 | 8. License............................... |indent-guides-license| 26 | 27 | ============================================================================== 28 | 1. INTRODUCTION *indent-guides-introduction* 29 | 30 | Indent Guides is a plugin for visually displaying indent levels in Vim. 31 | 32 | This plugin should work with gVim out of the box, no configuration needed. 33 | 34 | Features:~ 35 | * Can detect both tab and space indent styles. 36 | * Automatically inspects your colorscheme and picks appropriate colors (gVim 37 | only). 38 | * Will highlight indent levels with alternating colors. 39 | * Full support for gVim and basic support for Terminal Vim. 40 | * Seems to work on Windows gVim 7.3 (haven't done any extensive tests 41 | though). 42 | * Customizable size for indent guides, eg. skinny guides (soft-tabs only). 43 | * Customizable start indent level. 44 | * Highlight support for files with a mixture of tab and space indent styles. 45 | 46 | ============================================================================== 47 | 2. COMMANDS *indent-guides-commands* 48 | 49 | ------------------------------------------------------------------------------ 50 | :IndentGuidesToggle *:IndentGuidesToggle* 51 | Toggles the indent guides on and off. 52 | 53 | ------------------------------------------------------------------------------ 54 | :IndentGuidesEnable *:IndentGuidesEnable* 55 | Enables the indent guides for the current buffer and any other buffer upon 56 | entering it. 57 | 58 | ------------------------------------------------------------------------------ 59 | :IndentGuidesDisable *:IndentGuidesDisable* 60 | Disables the indent guides for the current buffer and any other buffer upon 61 | entering it. 62 | 63 | ============================================================================== 64 | 3. OPTIONS *indent-guides-options* 65 | 66 | ------------------------------------------------------------------------------ 67 | *'indent_guides_indent_levels'* 68 | Use this option to control how many indent levels to display guides for. 69 | 70 | Default: 30. Values: integer. 71 | > 72 | let g:indent_guides_indent_levels = 30 73 | < 74 | 75 | ------------------------------------------------------------------------------ 76 | *'indent_guides_auto_colors'* 77 | Use this option to control whether or not the plugin automatically calculates 78 | the highlight colors. Will use the current colorscheme's background color as a 79 | base color. 80 | 81 | Default: 1. Values: 0 or 1. 82 | > 83 | let g:indent_guides_auto_colors = 1 84 | < 85 | 86 | If you set this option to 0, be sure to manually define some highlight colors 87 | in an autocmd. 88 | > 89 | let g:indent_guides_auto_colors = 0 90 | autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3 91 | autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4 92 | < 93 | 94 | Alternatively you can add the following lines to your colorscheme file. 95 | > 96 | hi IndentGuidesOdd guibg=red ctermbg=3 97 | hi IndentGuidesEven guibg=green ctermbg=4 98 | < 99 | 100 | ------------------------------------------------------------------------------ 101 | *'indent_guides_color_change_percent'* 102 | Use this option to control the percent at which the highlight colors will be 103 | lightened or darkened. 104 | 105 | Default: 10 (10%). Values: between 0 and 100. 106 | > 107 | let g:indent_guides_color_change_percent = 10 108 | < 109 | 110 | ------------------------------------------------------------------------------ 111 | *'indent_guides_guide_size'* 112 | Use this option to customize the size of the indent guide. By default the 113 | value is set to 0, which will set the guide size to be the same as the 114 | |shiftwidth|. Setting this value to be larger than the |shiftwidth| is essentially 115 | the same as setting it to 0. 116 | 117 | A common use of this setting is to create skinny indent guides, which look 118 | great with a |shiftwidth| of 4 or more. 119 | 120 | NOTE: This option only works for soft-tabs (spaces) and not hard-tabs. 121 | 122 | Default: 0. Values: between 0 and |shiftwidth|. 123 | > 124 | let g:indent_guides_guide_size = 1 125 | < 126 | 127 | ------------------------------------------------------------------------------ 128 | *'indent_guides_start_level'* 129 | Use this option to control which indent level to start showing guides from. 130 | 131 | Default: 1. Values: between 1 and g:|indent_guides_indent_levels|. 132 | > 133 | let g:indent_guides_start_level = 2 134 | < 135 | 136 | ------------------------------------------------------------------------------ 137 | *'indent_guides_space_guides'* 138 | Use this option to control whether the plugin considers spaces as indention. 139 | 140 | Default: 1. Values: 0 or 1. 141 | > 142 | let g:indent_guides_space_guides = 0 143 | < 144 | 145 | ------------------------------------------------------------------------------ 146 | *'indent_guides_tab_guides'* 147 | Use this option to control whether the plugin considers tabs as indention. 148 | 149 | Default: 1. Values: 0 or 1. 150 | > 151 | let g:indent_guides_tab_guides = 0 152 | < 153 | 154 | ------------------------------------------------------------------------------ 155 | *'indent_guides_soft_pattern'* 156 | Use this option to explicitly specify a pattern for soft indentation. For 157 | example to match spaces only in the beginning of line use ' ' pattern. 158 | 159 | Default: '\s'. Values: Vim regexp. 160 | > 161 | let g:indent_guides_soft_pattern = ' ' 162 | < 163 | 164 | ------------------------------------------------------------------------------ 165 | *'indent_guides_enable_on_vim_startup'* 166 | Use this option to control whether the plugin is enabled on Vim startup. 167 | 168 | Default: 1. Values: 0 or 1. 169 | > 170 | let g:indent_guides_enable_on_vim_startup = 1 171 | < 172 | 173 | ------------------------------------------------------------------------------ 174 | *'indent_guides_exclude_filetypes'* 175 | Use this option to specify a list of filetypes to disable the plugin for. 176 | 177 | Default: ['help']. Values: list of strings. 178 | > 179 | let g:indent_guides_exclude_filetypes = ['help', 'nerdtree'] 180 | < 181 | 182 | ------------------------------------------------------------------------------ 183 | *'indent_guides_default_mapping'* 184 | Use this option to control whether the default mapping (ig) gets set. 185 | 186 | Default: 1. Values: 0 or 1. 187 | > 188 | let g:indent_guides_default_mapping = 0 189 | < 190 | 191 | ============================================================================== 192 | 4. MAPPINGS *indent-guides-mappings* 193 | 194 | The default mapping for toggling indent guides is ig. You can easily 195 | map it to other keys. For example: 196 | > 197 | :nmap ig IndentGuidesToggle 198 | < 199 | 200 | You can also map some other commands that are not mapped by default. For 201 | example: 202 | > 203 | :nmap ie IndentGuidesEnable 204 | :nmap id IndentGuidesDisable 205 | < 206 | 207 | ============================================================================== 208 | 5. TERMINAL VIM *indent-guides-terminal-vim* 209 | 210 | At the moment Terminal Vim only has basic support. This means is that colors 211 | won't be automatically calculated based on your colorscheme. Instead, some 212 | preset colors are used depending on whether `background` is set to `dark` or 213 | `light`. 214 | 215 | When `set background=dark` is used, the following highlight colors will be 216 | defined: 217 | > 218 | hi IndentGuidesOdd ctermbg=black 219 | hi IndentGuidesEven ctermbg=darkgrey 220 | < 221 | 222 | Alternatively, when `set background=light` is used, the following highlight 223 | colors will be defined: 224 | > 225 | hi IndentGuidesOdd ctermbg=white 226 | hi IndentGuidesEven ctermbg=lightgrey 227 | < 228 | 229 | If for some reason it's incorrectly defining light highlight colors instead of 230 | dark ones or vice versa, the first thing you should check is that the 231 | `background` value is being set correctly for your colorscheme. Sometimes it's 232 | best to manually set the `background` value in your `.vimrc`, for example: 233 | > 234 | colorscheme desert256 235 | set background=dark 236 | < 237 | 238 | Alternatively you can manually setup the highlight colors yourself, see 239 | |indent_guides_auto_colors| for an example. 240 | 241 | ============================================================================== 242 | 6. ABOUT *indent-guides-about* 243 | 244 | Why did I build this plugin?~ 245 | * I believe indent guides make nested code easier to read and understand. 246 | * Other editors have them and it's high time Vim did. 247 | * None of the existing indent guide plugins on the market suited my needs. 248 | * I wanted to learn me some VimL. 249 | 250 | Links:~ 251 | * Github: https://github.com/nathanaelkane/vim-indent-guides 252 | * Bugs & Issues: https://github.com/nathanaelkane/vim-indent-guides/issues 253 | 254 | Credits:~ 255 | * Matt Wozniski (godlygeek) for letting me use the list of color names and 256 | hex codes from his CSApprox plugin. 257 | 258 | Contact:~ 259 | * Twitter: @nathanaelkane 260 | * Email: 261 | 262 | Bug reports, feedback, suggestions etc are welcomed. 263 | 264 | ============================================================================== 265 | 7. CHANGELOG *indent-guides-changelog* 266 | 267 | 1.8 (pending release)~ 268 | * Added option g:|indent_guides_soft_pattern| to control the pattern for 269 | soft indentation (thanks @sergey-vlasov). 270 | * Added option g:|indent_guides_default_mapping| to control whether the 271 | default mapping (ig) gets set (thanks @suy). 272 | * Set size of indent guide to `tabstop` value when `shiftwidth=0` or 273 | `noexpandtab` is used (thanks @darkfeline and @wilywampa). 274 | * Don't load plugin in unsupported versions of Vim (thanks @dersaidin). 275 | * Added option g:|indent_guides_tab_guides| to control whether tabs are 276 | considered as indention (thanks @amerlyq). 277 | 278 | 1.7~ 279 | * Added way to override the default mapping (thanks @xuhdev). 280 | * Added option g:|indent_guides_exclude_filetypes| to specify a list of 281 | filetypes to disable the plugin for. 282 | * Disable the plugin when in a diff. 283 | * Various bug fixes. 284 | 285 | 1.6~ 286 | * Added option g:|indent_guides_space_guides| to control whether spaces are 287 | considered as indention (thanks @scoz). 288 | * Added 'doc/tags' to gitignore (thanks @lenniboy). 289 | * Fixed E803 ID not found spam (thanks @mutewinter). 290 | * Fixed str2float issue with Vim 7.1 (thanks @acx0). 291 | 292 | 1.5~ 293 | * Added highlight support for files with a mixture of tab and space indent 294 | styles (thanks @graywh). 295 | * Added -bar to all the :commands so they can chain with other :commands 296 | (thanks @graywh). 297 | * No longer overriding pre-defined custom highlight colors (thanks @graywh). 298 | * Using str2float to work around a float bug in some versions of Vim 7.2 299 | (thanks @voidus). 300 | 301 | 1.4~ 302 | * Added the new plugin option g:|indent_guides_enable_on_vim_startup|. 303 | * Improved Windows support. 304 | 305 | 1.3~ 306 | * Changed the default value of g:|indent_guides_color_change_percent| to 10. 307 | * Added support for gVim themes that don't specify a `hi Normal guibg` 308 | color. 309 | 310 | 1.2~ 311 | * Customizable size for indent guides, eg. skinny guides (soft-tabs only). 312 | * Customizable start indent level. 313 | * Refactored some internal logic. 314 | 315 | 1.1~ 316 | * Added basic support for Terminal Vim. See |indent-guides-terminal-vim| for 317 | more information. 318 | * Cut down on rgb to hex color conversions by adding a big dictionary of 319 | color names and hex codes. 320 | * Various bug fixes. 321 | 322 | 1.0~ 323 | * First public version. 324 | 325 | ============================================================================== 326 | 8. LICENSE *indent-guides-license* 327 | 328 | The MIT Licence 329 | http://www.opensource.org/licenses/mit-license.php 330 | 331 | Copyright (c) 2010-2013 Nate Kane 332 | 333 | Permission is hereby granted, free of charge, to any person obtaining a copy 334 | of this software and associated documentation files (the "Software"), to deal 335 | in the Software without restriction, including without limitation the rights 336 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 337 | copies of the Software, and to permit persons to whom the Software is 338 | furnished to do so, subject to the following conditions: 339 | 340 | The above copyright notice and this permission notice shall be included in 341 | all copies or substantial portions of the Software. 342 | 343 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 344 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 345 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 346 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 347 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 348 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 349 | THE SOFTWARE. 350 | 351 | vim:tw=78:ts=2:ft=help:norl: 352 | -------------------------------------------------------------------------------- /plugin/indent_guides.vim: -------------------------------------------------------------------------------- 1 | " Author: Nate Kane 2 | " Homepage: http://github.com/nathanaelkane/vim-indent-guides 3 | 4 | " Do not load if vim is too old 5 | if (v:version == 701 && !exists('*matchadd')) || (v:version < 701) 6 | finish 7 | endif 8 | 9 | if exists('g:loaded_indent_guides') || &cp 10 | finish 11 | endif 12 | let g:loaded_indent_guides = 1 13 | call indent_guides#define_default_highlights() 14 | 15 | function! s:IndentGuidesToggle() 16 | call indent_guides#toggle() 17 | endfunction 18 | 19 | function! s:IndentGuidesEnable() 20 | call indent_guides#enable() 21 | endfunction 22 | 23 | function! s:IndentGuidesDisable() 24 | call indent_guides#disable() 25 | endfunction 26 | 27 | " Commands 28 | command! -bar IndentGuidesToggle call s:IndentGuidesToggle() 29 | command! -bar IndentGuidesEnable call s:IndentGuidesEnable() 30 | command! -bar IndentGuidesDisable call s:IndentGuidesDisable() 31 | 32 | " 33 | " Initializes a given variable to a given value. The variable is only 34 | " initialized if it does not exist prior. 35 | " 36 | function s:InitVariable(var, value) 37 | if !exists(a:var) 38 | if type(a:value) == type("") 39 | exec 'let ' . a:var . ' = ' . "'" . a:value . "'" 40 | else 41 | exec 'let ' . a:var . ' = ' . a:value 42 | endif 43 | endif 44 | endfunction 45 | 46 | " Fixed global variables 47 | let g:indent_guides_autocmds_enabled = 0 48 | let g:indent_guides_color_hex_pattern = '#[0-9A-Fa-f]\{6\}' 49 | let g:indent_guides_color_hex_guibg_pattern = 'guibg=\zs' . g:indent_guides_color_hex_pattern . '\ze' 50 | let g:indent_guides_color_name_guibg_pattern = "guibg='\\?\\zs[0-9A-Za-z ]\\+\\ze'\\?" 51 | 52 | " Configurable global variables 53 | call s:InitVariable('g:indent_guides_indent_levels', 30) 54 | call s:InitVariable('g:indent_guides_auto_colors', 1) 55 | call s:InitVariable('g:indent_guides_color_change_percent', 10) " ie. 10% 56 | call s:InitVariable('g:indent_guides_guide_size', 0) 57 | call s:InitVariable('g:indent_guides_start_level', 1) 58 | call s:InitVariable('g:indent_guides_enable_on_vim_startup', 1) 59 | call s:InitVariable('g:indent_guides_debug', 0) 60 | call s:InitVariable('g:indent_guides_space_guides', 1) 61 | call s:InitVariable('g:indent_guides_tab_guides', 1) 62 | call s:InitVariable('g:indent_guides_soft_pattern', '\s') 63 | call s:InitVariable('g:indent_guides_default_mapping', 1) 64 | 65 | if !exists('g:indent_guides_exclude_filetypes') 66 | let g:indent_guides_exclude_filetypes = ['help'] 67 | endif 68 | 69 | " Default mapping 70 | if !hasmapto('IndentGuidesToggle', 'n') && maparg('ig', 'n') == '' 71 | \ && g:indent_guides_default_mapping != 0 72 | nmap ig IndentGuidesToggle 73 | endif 74 | 75 | " Plug mappings 76 | nnoremap