Mercurial > vim
annotate runtime/syntax/dircolors.vim @ 5808:e5f1f2ea0b4a v7.4.248
updated for version 7.4.248
Problem: Cannot distinguish between NL and NUL in output of system().
Solution: Add systemlist(). (ZyX)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 05 Apr 2014 19:44:40 +0200 |
parents | ab1508486b12 |
children | 773d627cac0b |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
2 " Language: dircolors(1) input file |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
3 " Maintainer: Jan Larres <jan@majutsushi.net> |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
4 " Previous Maintainer: Nikolai Weibull <now@bitwi.se> |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
5 " Latest Revision: 2013-08-17 |
7 | 6 |
375 | 7 if exists("b:current_syntax") |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
8 finish |
7 | 9 endif |
10 | |
375 | 11 let s:cpo_save = &cpo |
12 set cpo&vim | |
7 | 13 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
14 syntax keyword dircolorsTodo FIXME TODO XXX NOTE contained |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
15 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
16 syntax region dircolorsComment start='#' end='$' contains=dircolorsTodo,@Spell |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
17 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
18 syntax keyword dircolorsKeyword TERM LEFT LEFTCODE RIGHT RIGHTCODE END ENDCODE |
375 | 19 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
20 syntax keyword dircolorsKeyword NORMAL NORM FILE RESET DIR LNK LINK SYMLINK |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
21 \ MULTIHARDLINK FIFO SOCK DOOR BLK CHR ORPHAN |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
22 \ MISSING PIPE BLOCK CHR EXEC SETUID SETGID |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
23 \ CAPABILITY STICKY_OTHER_WRITABLE |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
24 \ OTHER_WRITABLE STICKY |
7 | 25 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
26 " Slackware only, ignored by GNU dircolors. |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
27 syntax keyword dircolorsKeyword COLOR OPTIONS EIGHTBIT |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
28 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
29 syntax match dircolorsExtension '^\s*\zs[.*]\S\+' |
375 | 30 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
31 syntax match dircolorsEscape '\\[abefnrtv?_\\^#]' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
32 syntax match dircolorsEscape '\\[0-9]\{3}' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
33 syntax match dircolorsEscape '\\x[0-9a-f]\{3}' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
34 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
35 if !has('gui_running') && &t_Co == '' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
36 syntax match dircolorsNumber '\<\d\+\>' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
37 highlight default link dircolorsNumber Number |
7 | 38 endif |
39 | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
40 highlight default link dircolorsTodo Todo |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
41 highlight default link dircolorsComment Comment |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
42 highlight default link dircolorsKeyword Keyword |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
43 highlight default link dircolorsExtension Identifier |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
44 highlight default link dircolorsEscape Special |
1222 | 45 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
46 function! s:set_guicolors() abort |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
47 let s:guicolors = {} |
375 | 48 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
49 let s:guicolors[0] = "Black" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
50 let s:guicolors[1] = "DarkRed" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
51 let s:guicolors[2] = "DarkGreen" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
52 let s:guicolors[3] = "DarkYellow" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
53 let s:guicolors[4] = "DarkBlue" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
54 let s:guicolors[5] = "DarkMagenta" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
55 let s:guicolors[6] = "DarkCyan" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
56 let s:guicolors[7] = "Gray" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
57 let s:guicolors[8] = "DarkGray" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
58 let s:guicolors[9] = "Red" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
59 let s:guicolors[10] = "Green" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
60 let s:guicolors[11] = "Yellow" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
61 let s:guicolors[12] = "Blue" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
62 let s:guicolors[13] = "Magenta" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
63 let s:guicolors[14] = "Cyan" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
64 let s:guicolors[15] = "White" |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
65 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
66 let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"] |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
67 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
68 let cur_col = 16 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
69 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
70 for r in xterm_palette |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
71 for g in xterm_palette |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
72 for b in xterm_palette |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
73 let s:guicolors[cur_col] = '#' . r . g . b |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
74 let cur_col += 1 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
75 endfor |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
76 endfor |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
77 endfor |
7 | 78 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
79 for i in range(24) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
80 let g = i * 0xa + 8 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
81 let s:guicolors[i + 232] = '#' . g . g . g |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
82 endfor |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
83 endfunction |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
84 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
85 function! s:get_hi_str(color, place) abort |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
86 if a:color >= 0 && a:color <= 255 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
87 if has('gui_running') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
88 return ' gui' . a:place . '=' . s:guicolors[a:color] |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
89 elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
90 return ' cterm' . a:place . '=' . a:color |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
91 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
92 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
93 return '' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
94 endfunction |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
95 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
96 function! s:get_256color(colors) abort |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
97 if len(a:colors) >= 2 " May be fewer while editing |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
98 let [_five, color] = remove(a:colors, 0, 1) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
99 if _five != '5' || color == '' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
100 return -1 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
101 else |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
102 return str2nr(color) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
103 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
104 else |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
105 return -1 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
106 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
107 endfunction |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
108 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
109 function! s:preview_color(linenr) abort |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
110 let line = getline(a:linenr) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
111 let defline = matchlist(line, '^\v([A-Z_]+|[*.]\S+)\s+([0-9;]+)') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
112 if empty(defline) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
113 return |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
114 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
115 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
116 let colordef = defline[2] |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
117 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
118 let colors = split(colordef, ';') |
7 | 119 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
120 let hi_str = '' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
121 let hi_attrs = [] |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
122 while len(colors) > 0 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
123 let item = str2nr(remove(colors, 0)) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
124 if item == 1 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
125 call add(hi_attrs, 'bold') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
126 elseif item == 3 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
127 call add(hi_attrs, 'italic') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
128 elseif item == 4 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
129 call add(hi_attrs, 'underline') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
130 elseif item == 7 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
131 call add(hi_attrs, 'inverse') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
132 elseif item >= 30 && item <= 37 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
133 " ANSI SGR foreground color |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
134 let hi_str .= s:get_hi_str(item - 30, 'fg') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
135 elseif item >= 40 && item <= 47 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
136 " ANSI SGR background color |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
137 let hi_str .= s:get_hi_str(item - 40, 'bg') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
138 elseif item == 38 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
139 " Foreground for terminals with 88/256 color support |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
140 let color = s:get_256color(colors) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
141 if color == -1 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
142 break |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
143 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
144 let hi_str .= s:get_hi_str(color, 'fg') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
145 elseif item == 48 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
146 " Background for terminals with 88/256 color support |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
147 let color = s:get_256color(colors) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
148 if color == -1 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
149 break |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
150 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
151 let hi_str .= s:get_hi_str(color, 'bg') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
152 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
153 endwhile |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
154 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
155 if hi_str == '' && empty(hi_attrs) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
156 return |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
157 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
158 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
159 " Check whether we have already defined this color |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
160 redir => s:currentmatch |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
161 silent! execute 'syntax list' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
162 redir END |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
163 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
164 if s:currentmatch !~# '\/\\_s\\zs' . colordef . '\\ze\\_s\/' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
165 " Append the buffer number to avoid problems with other dircolors |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
166 " buffers interfering |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
167 let bufnr = bufnr('%') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
168 execute 'syntax match dircolorsColor' . b:dc_next_index . '_' . bufnr . |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
169 \ ' "\_s\zs' . colordef . '\ze\_s"' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
170 let hi_attrs_str = '' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
171 if !empty(hi_attrs) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
172 if has('gui_running') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
173 let hi_attrs_str = ' gui=' . join(hi_attrs, ',') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
174 else |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
175 let hi_attrs_str = ' cterm=' . join(hi_attrs, ',') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
176 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
177 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
178 execute 'highlight default dircolorsColor' . b:dc_next_index . '_' . |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
179 \ bufnr . hi_str . hi_attrs_str |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
180 let b:dc_next_index += 1 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
181 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
182 endfunction |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
183 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
184 " Avoid accumulating too many definitions while editing |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
185 function! s:reset_colors() abort |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
186 if b:dc_next_index > 0 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
187 let bufnr = bufnr('%') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
188 for i in range(b:dc_next_index) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
189 execute 'syntax clear dircolorsColor' . i . '_' . bufnr |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
190 execute 'highlight clear dircolorsColor' . i . '_' . bufnr |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
191 endfor |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
192 let b:dc_next_index = 0 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
193 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
194 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
195 for linenr in range(1, line('$')) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
196 call s:preview_color(linenr) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
197 endfor |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
198 endfunction |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
199 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
200 let b:dc_next_index = 0 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
201 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
202 if has('gui_running') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
203 call s:set_guicolors() |
375 | 204 endif |
7 | 205 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
206 if has('gui_running') || &t_Co != '' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
207 call s:reset_colors() |
7 | 208 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
209 autocmd CursorMoved,CursorMovedI <buffer> call s:preview_color('.') |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
3492
diff
changeset
|
210 autocmd CursorHold,CursorHoldI <buffer> call s:reset_colors() |
7 | 211 endif |
212 | |
213 let b:current_syntax = "dircolors" | |
214 | |
375 | 215 let &cpo = s:cpo_save |
216 unlet s:cpo_save |