annotate runtime/syntax/dircolors.vim @ 31833:3516e35f409f v9.0.1249

patch 9.0.1249: cannot export an abstract class Commit: https://github.com/vim/vim/commit/657aea7fc47fb919ce76fad64ba0ec55a1af80f1 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 27 13:16:19 2023 +0000 patch 9.0.1249: cannot export an abstract class Problem: Cannot export an abstract class. (Ernie Rael) Solution: Add the EX_EXPORT flag to :abstract. (closes https://github.com/vim/vim/issues/11884)
author Bram Moolenaar <Bram@vim.org>
date Fri, 27 Jan 2023 14:30:04 +0100
parents acd7eaa13d2b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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>
13341
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9027
diff changeset
5 " Latest Revision: 2018-02-19
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
375
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
375
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
11 let s:cpo_save = &cpo
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
12 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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
756bed568f5d updated for version 7.1b
vimboss
parents: 839
diff changeset
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
9027
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
47 let s:termguicolors = {}
375
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
48
9027
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
49 let s:termguicolors[0] = "Black"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
50 let s:termguicolors[1] = "DarkRed"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
51 let s:termguicolors[2] = "DarkGreen"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
52 let s:termguicolors[3] = "DarkYellow"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
53 let s:termguicolors[4] = "DarkBlue"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
54 let s:termguicolors[5] = "DarkMagenta"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
55 let s:termguicolors[6] = "DarkCyan"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
56 let s:termguicolors[7] = "Gray"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
57 let s:termguicolors[8] = "DarkGray"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
58 let s:termguicolors[9] = "Red"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
59 let s:termguicolors[10] = "Green"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
60 let s:termguicolors[11] = "Yellow"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
61 let s:termguicolors[12] = "Blue"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
62 let s:termguicolors[13] = "Magenta"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
63 let s:termguicolors[14] = "Cyan"
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
64 let s:termguicolors[15] = "White"
5362
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
9027
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
73 let s:termguicolors[cur_col] = '#' . r . g . b
5362
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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
9027
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
81 let s:termguicolors[i + 232] = '#' . g . g . g
5362
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')
9027
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 5362
diff changeset
88 return ' gui' . a:place . '=' . s:termguicolors[a:color]
5362
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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')
13341
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9027
diff changeset
138 elseif item >= 90 && item <= 97
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9027
diff changeset
139 " ANSI SGR+8 foreground color (xterm 16-color support)
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9027
diff changeset
140 let hi_str .= s:get_hi_str(item - 82, 'fg')
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9027
diff changeset
141 elseif item >= 100 && item <= 107
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9027
diff changeset
142 " ANSI SGR+8 background color (xterm 16-color support)
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9027
diff changeset
143 let hi_str .= s:get_hi_str(item - 92, 'bg')
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
144 elseif item == 38
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
145 " 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
146 let color = s:get_256color(colors)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
147 if color == -1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
148 break
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
149 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
150 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
151 elseif item == 48
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
152 " 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
153 let color = s:get_256color(colors)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
154 if color == -1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
155 break
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
156 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
157 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
158 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
159 endwhile
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
160
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
161 if hi_str == '' && empty(hi_attrs)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
162 return
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
163 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
164
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
165 " 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
166 redir => s:currentmatch
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
167 silent! execute 'syntax list'
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
168 redir END
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
169
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
170 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
171 " 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
172 " buffers interfering
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
173 let bufnr = bufnr('%')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
174 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
175 \ ' "\_s\zs' . colordef . '\ze\_s"'
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
176 let hi_attrs_str = ''
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
177 if !empty(hi_attrs)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
178 if has('gui_running')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
179 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
180 else
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
181 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
182 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
183 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
184 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
185 \ bufnr . hi_str . hi_attrs_str
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
186 let b:dc_next_index += 1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
187 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
188 endfunction
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
189
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
190 " Avoid accumulating too many definitions while editing
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
191 function! s:reset_colors() abort
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
192 if b:dc_next_index > 0
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
193 let bufnr = bufnr('%')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
194 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
195 execute 'syntax clear dircolorsColor' . i . '_' . bufnr
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
196 execute 'highlight clear dircolorsColor' . i . '_' . bufnr
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 let b:dc_next_index = 0
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
199 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
200
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
201 for linenr in range(1, line('$'))
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
202 call s:preview_color(linenr)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
203 endfor
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
204 endfunction
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
205
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
206 let b:dc_next_index = 0
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
207
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
208 if has('gui_running')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
209 call s:set_guicolors()
375
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
210 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
212 if has('gui_running') || &t_Co != ''
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
213 call s:reset_colors()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
215 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
216 autocmd CursorHold,CursorHoldI <buffer> call s:reset_colors()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 let b:current_syntax = "dircolors"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
375
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
221 let &cpo = s:cpo_save
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
222 unlet s:cpo_save