-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheldar.vim
293 lines (250 loc) · 11.6 KB
/
eldar.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
" ---------------------------------------------------------
" ______ _ _
" | ____| | | |
" | |__ | | __| | __ _ _ __
" | __| | |/ _` |/ _` | '__|
" | |____| | (_| | (_| | |
" |______|_|\__,_|\__,_|_|
"
" ---------------------------------------------------------
"
" Maintainer: Alexander Gude
" Email: [email protected]
" File: eldar.vim
" URL: github.com/agude/vim-eldar
" License: MIT
"
" ---------------------------------------------------------
"
" Copyright (c) 2016 Alexander Gude
"
" Permission is hereby granted, free of charge, to any per‐
" son obtaining a copy of this software and associated doc‐
" umentation files (the “Software”), to deal in the Soft‐
" ware without restriction, including without limitation
" the rights to use, copy, modify, merge, publish, distrib‐
" ute, sublicense, and/or sell copies of the Software, and
" to permit persons to whom the Software is furnished to do
" so, subject to the following conditions:
"
" The above copyright notice and this permission notice
" shall be included in all copies or substantial portions
" of the Software.
"
" THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
" KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
" THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU‐
" LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON‐
" TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐
" NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
" THE SOFTWARE.
"
" ---------------------------------------------------------
" Eldar is designed for dark backgrounds
set background=dark
highlight clear
if exists('syntax_on')
syntax reset
endif
let g:colors_name = 'eldar'
" Define colors (Tango is the default)
" GUI colors
let s:red = get(g:, 'eldar_red', '#EF2929')
let s:yellow = get(g:, 'eldar_yellow', '#FCE94F')
" let s:green = get(g:, 'eldar_green', '#06eb78' '#5fd7af')
let s:green = get(g:, 'eldar_green', '#8AE234')
let s:cyan = get(g:, 'eldar_cyan', '#34E2E2')
let s:blue = get(g:, 'eldar_blue', '#729FCF')
let s:magenta = get(g:, 'eldar_magenta', '#AD7FA8')
let s:gui_text = get(g:, 'eldar_text', 'White')
let s:gui_bg = get(g:, 'eldar_background', 'Black')
" Terminal colors
let s:term_text = get(g:, 'eldar_term_text', 'NONE')
let s:term_bg = get(g:, 'eldar_term_background', 'NONE')
" The ColourAssignment map and function to unpack it are from the bandit
" colorscheme by Al Bunden, available here:
" http://www.cgtk.co.uk/vim-scripts/bandit
let s:ColourAssignment = {}
" Unspecified colours default to NONE, EXCEPT cterm(.*) which default to matching gui(.*)
"
" In most cases, only GUIFG is therefore important unless support for Black and White
" terminals is essential
" Editor settings
" ---------------
let s:ColourAssignment['Normal'] = {'GUIFG': s:gui_text, 'GUIBG': s:gui_bg, 'CTERMBG': s:term_bg, 'CTERMFG': s:term_text}
let s:ColourAssignment['Cursor'] = {'GUI': 'Reverse'}
let s:ColourAssignment['CursorLine'] = {'GUI': 'NONE', 'GUIBG': 'Black'}
let s:ColourAssignment['LineNr'] = {'GUIFG': 'DarkGray'}
let s:ColourAssignment['CursorLineNr'] = {'GUIFG': 'White'}
" Number column
" -------------
let s:ColourAssignment['CursorColumn'] = {'GUIBG': 'DarkGrey'}
let s:ColourAssignment['Folded'] = {'GUIFG': 'Cyan', 'GUIBG': 'DarkGrey'}
let s:ColourAssignment['FoldColumn'] = {'GUIBG': 'DarkGrey'}
highlight! link SignColumn FoldColumn
" Window/Tab delimiters
" ---------------------
let s:ColourAssignment['VertSplit'] = {'GUIFG': 'White', 'GUIBG': 'NONE'}
let s:ColourAssignment['ColorColumn'] = {'GUIBG': 'DarkGray'}
let s:ColourAssignment['TabLine'] = {'GUIFG': 'White', 'GUIBG': 'DarkGray'}
let s:ColourAssignment['TabLineFill'] = {'GUIBG': 'DarkGray'}
let s:ColourAssignment['TabLineSel'] = {'GUIFG': 'Black', 'GUIBG': 'Gray'}
" File Navigation / Searching
" ---------------------------
let s:ColourAssignment['Directory'] = {'GUIFG': s:blue, 'CTERMFG': 'Blue', 'GUI': 'Bold'}
let s:ColourAssignment['Search'] = {'GUIFG': 'Black', 'GUIBG': s:yellow, 'CTERMFG': 'yellow', 'CTERMBG': 'black', 'GUI': 'Bold', 'CTERM': 'Reverse,Bold'}
let s:ColourAssignment['IncSearch'] = {'GUI': 'Reverse'}
" Prompt/Status
" -------------
let s:ColourAssignment['StatusLine'] = {'GUIFG': 'White', 'GUIBG': s:gui_bg, 'GUI': 'Bold,Reverse', 'CTERMFG': 'White', 'CTERMBG': s:term_bg}
let s:ColourAssignment['StatusLineNC'] = {'GUIFG': 'White', 'GUIBG': s:gui_bg, 'GUI': 'Reverse', 'CTERMFG': 'White', 'CTERMBG': s:term_bg}
let s:ColourAssignment['WildMenu'] = {'GUIFG': 'White', 'GUIBG': 'DarkGrey', 'GUI': 'Bold'}
let s:ColourAssignment['Question'] = {'GUIFG': s:blue, 'CTERMFG': 'Blue'}
let s:ColourAssignment['Title'] = {'GUI': 'Bold'}
let s:ColourAssignment['ModeMsg'] = {'GUI': 'Bold'}
let s:ColourAssignment['MoreMsg'] = {'GUIFG': s:green, 'CTERMFG': 'SpringGreen2'}
" Visual aid
" ----------
let s:ColourAssignment['MatchParen'] = {'GUIBG': s:cyan, 'CTERMBG': 'cyan'}
let s:ColourAssignment['Visual'] = {'GUIBG': 'DarkGrey'}
highlight! link VisualNOS Visual
let s:ColourAssignment['NonText'] = {'GUIFG': s:blue, 'CTERMFG': 'blue'}
let s:ColourAssignment['Todo'] = {'GUIFG': 'Black', 'GUIBG': s:yellow, 'CTERMBG': 'yellow'}
let s:ColourAssignment['Underlined'] = {'GUIFG': s:cyan, 'CTERMFG': 'cyan', 'GUI': 'Underline'}
let s:ColourAssignment['Error'] = {'GUIFG': s:red, 'GUIBG': 'Black', 'CTERMFG': 'red', 'GUI': 'Reverse,Bold'}
let s:ColourAssignment['ErrorMsg'] = {'GUIFG': s:red, 'GUIBG': 'White', 'CTERMFG': 'red', 'GUI': 'Reverse,Bold'}
let s:ColourAssignment['WarningMsg'] = {'GUIFG': s:red, 'CTERMFG': 'red'}
let s:ColourAssignment['Ignore'] = {'GUIFG': 'bg', 'CTERMFG': 'Black'}
let s:ColourAssignment['SpecialKey'] = {'GUIFG': s:cyan, 'CTERMFG': 'Cyan'}
" Variable types
" --------------
let s:ColourAssignment['Constant'] = {'GUIFG': s:magenta, 'CTERMFG': 'magenta'}
let s:ColourAssignment['Number'] = {'GUIFG': s:red, 'CTERMFG': 'red'}
highlight! link String Constant
highlight! link Boolean Constant
highlight! link Float Number
let s:ColourAssignment['Identifier'] = {'GUIFG': s:green, 'CTERMFG': 'SpringGreen2', 'GUI': 'Bold'}
highlight! link Function Identifier
" Comments
" --------
let s:ColourAssignment['Comment'] = {'GUIFG': s:cyan, 'CTERMFG': 'cyan'}
highlight! link SpecialComment Special
" Language constructs
" -------------------
let s:ColourAssignment['Statement'] = {'GUIFG': s:yellow, 'CTERMFG': 'yellow', 'GUI': 'Bold'}
highlight! link Conditional Statement
highlight! link Repeat Statement
highlight! link Label Statement
highlight! link Operator Statement
highlight! link Keyword Statement
highlight! link Exception Statement
let s:ColourAssignment['Special'] = {'GUIFG': s:red, 'CTERMFG': 'red'}
highlight! link SpecialChar Special
highlight! link Tag Special
highlight! link Delimiter Special
highlight! link Debug Special
" C like
" ------
let s:ColourAssignment['PreProc'] = {'GUIFG': s:blue, 'CTERMFG': 'blue', 'GUI': 'Bold'}
highlight! link Include PreProc
highlight! link Define PreProc
highlight! link Macro PreProc
highlight! link PreCondit PreProc
let s:ColourAssignment['Type'] = {'GUIFG': s:green, 'CTERMFG': 'SpringGreen2', 'GUI': 'Bold'}
let s:ColourAssignment['Structure'] = {'GUIFG': s:magenta, 'CTERMFG': 'magenta'}
highlight! link StorageClass Type
highlight! link Typedef Type
" Diff
" ----
let s:ColourAssignment['DiffAdd'] = {'GUIFG': s:green, 'GUIBG': 'Black', 'CTERMFG': 'Green', 'GUI': 'Reverse,Bold'}
let s:ColourAssignment['DiffChange'] = {'GUIFG': 'NONE'}
let s:ColourAssignment['DiffDelete'] = {'GUIFG': s:red, 'GUIBG': 'Black', 'CTERMFG': 'Red', 'GUI': 'Reverse,Bold'}
let s:ColourAssignment['DiffText'] = {'GUIFG': s:blue, 'GUIBG': 'Black', 'CTERMFG': 'Blue', 'GUI': 'Reverse,Bold'}
" Completion menu
" ---------------
let s:ColourAssignment['Pmenu'] = {'GUIFG': 'Black', 'GUIBG': 'Grey'}
let s:ColourAssignment['PmenuSel'] = {'GUIFG': s:yellow, 'GUIBG': 'DarkGrey', 'GUI': 'Bold', 'CTERMFG': 'yellow'}
let s:ColourAssignment['PmenuThumb'] = {'GUIBG': 'DarkGrey'}
highlight! link PmenuSbar Pmenu
" Spelling
" --------
let s:ColourAssignment['SpellBad'] = {'GUIFG': 'NONE', 'GUISP': s:red, 'CTERMFG': 'red', 'GUI': 'undercurl'}
let s:ColourAssignment['SpellCap'] = {'GUIFG': 'NONE', 'GUISP': s:blue, 'CTERMFG': 'blue', 'GUI': 'undercurl'}
let s:ColourAssignment['SpellLocal'] = {'GUIFG': 'NONE', 'GUISP': s:yellow, 'CTERMFG': 'yellow', 'GUI': 'undercurl'}
let s:ColourAssignment['SpellRare'] = {'GUIFG': 'NONE', 'GUISP': s:green, 'CTERMFG': 'green', 'GUI': 'undercurl'}
" Text Formatting
" ---------------
let s:ColourAssignment['Italic'] = {'GUIFG': 'White', 'GUI': 'Italic'}
let s:ColourAssignment['Bold'] = {'GUIFG': 'White', 'GUI': 'Bold'}
let s:ColourAssignment['BoldItalic'] = {'GUIFG': 'White', 'GUI': 'Italic,Bold'}
highlight! link htmlItalic Italic
highlight! link htmlBold Bold
highlight! link htmlBoldItalic BoldItalic
" Function to translate the ColourAssignments to highlight lines
let s:colours = {}
let s:valid_cterm_colours =
\ [
\ 'Black', 'DarkBlue', 'DarkGreen', 'DarkCyan',
\ 'DarkRed', 'DarkMagenta', 'Brown', 'DarkYellow',
\ 'LightGray', 'LightGrey', 'Gray', 'Grey',
\ 'DarkGray', 'DarkGrey', 'Blue', 'LightBlue',
\ 'Green', 'LightGreen', 'Cyan', 'LightCyan',
\ 'Red', 'LightRed', 'Magenta', 'LightMagenta',
\ 'Yellow', 'LightYellow', 'White',
\ ]
for s:key in keys(s:ColourAssignment)
let s:colours = s:ColourAssignment[s:key]
if has_key(s:colours, 'TERM')
let s:term = s:colours['TERM']
else
let s:term = 'NONE'
endif
if has_key(s:colours, 'GUI')
let s:gui = s:colours['GUI']
else
let s:gui = 'NONE'
endif
if has_key(s:colours, 'GUIFG')
let s:guifg = s:colours['GUIFG']
else
let s:guifg = 'NONE'
endif
if has_key(s:colours, 'GUIBG')
let s:guibg = s:colours['GUIBG']
else
let s:guibg = 'NONE'
endif
if has_key(s:colours, 'CTERM')
let s:cterm = s:colours['CTERM']
else
let s:cterm = s:gui
endif
if has_key(s:colours, 'CTERMFG')
let s:ctermfg = s:colours['CTERMFG']
else
if index(s:valid_cterm_colours, s:guifg) != -1
let s:ctermfg = s:guifg
else
let s:ctermfg = 'NONE'
endif
endif
if has_key(s:colours, 'CTERMBG')
let s:ctermbg = s:colours['CTERMBG']
else
if index(s:valid_cterm_colours, s:guibg) != -1
let s:ctermbg = s:guibg
else
let s:ctermbg = 'NONE'
endif
endif
if has_key(s:colours, 'GUISP')
let s:guisp = s:colours['GUISP']
else
let s:guisp = 'NONE'
endif
if s:key =~# '^\k*$'
execute 'highlight '.s:key.' term='.s:term.' cterm='.s:cterm.' gui='.s:gui.' ctermfg='.s:ctermfg.' guifg='.s:guifg.' ctermbg='.s:ctermbg.' guibg='.s:guibg.' guisp='.s:guisp
endif
endfor