-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
glyph-palette.txt
230 lines (190 loc) Β· 8.34 KB
/
glyph-palette.txt
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
*glyph-palette.txt* Universally apply colors on Nerd Fonts glyph
Author: Alisue <lambdalisue@hashnote.net>
License: MIT license
=============================================================================
CONTENTS *glyph-palette-contents*
INTRODUCTION |glyph-palette-introduction|
USAGE |glyph-palette-usage|
INTERFACE |glyph-palette-interface|
VARIABLE |glyph-palette-variable|
FUNCTION |glyph-palette-function|
HIGHLIGHT |glyph-palette-highlight|
TOOLS |glyph-palette-tools|
=============================================================================
INTRODUCTION *glyph-palette-introduction*
*glyph-palette.vim* (Glyph palette) is a plugin to universally apply colors on
Nerd Fonts (https://github.com/ryanoasis/nerd-fonts).
With this plugin, the following (and potentially more) Nerd Fonts integrations
will be nicely highlighted.
- https://github.com/ryanoasis/vim-devicons
- https://github.com/lambdalisue/nerdfont.vim
- https://github.com/lambdalisue/fern-renderer-nerdfont.vim
=============================================================================
USAGE *glyph-palette-usage*
First of all, make sure that you are using one of Nerd Fonts Patched Fonts.
You will see nice Vim glyph on ξ« if the current font is properly patched.
See https://github.com/ryanoasis/nerd-fonts for more detail.
After that, call |glyph_palette#apply()| on a target buffer like:
>
augroup my-glyph-palette
autocmd!
autocmd FileType fern call glyph_palette#apply()
autocmd FileType nerdtree call glyph_palette#apply()
autocmd FileType startify call glyph_palette#apply()
augroup END
<
Then glyphs in |g:glyph_palette#palette| on the buffer will be highlighted by
predefined highlight groups (|glyph-palette-highlight|).
To customize the palette, modify |g:glyph_palette#palette|.
To customize the color, change group name (key) in the palette or directly
overwrite highlgihts in |glyph-palette-highlight|.
=============================================================================
INTERFACE *glyph-palette-interface*
-----------------------------------------------------------------------------
VARIABLE *glyph-palette-variable*
*g:glyph_palette#palette*
A palette |Dictionary| which key is a |highlight-group| and value is
a |List| of glyphs.
To produce palette from names in nerdfont.vim or vim-devicons, see
|glyph-palette-tools|.
Note that the variable does not exists so copy palette from
|g:glyph_palette#defaults#palette| to extend the default palette like:
>
let g:glyph_palette#palette = copy(g:glyph_palette#defaults#palette)
let g:glyph_palette#palette['GlyphPalette0'] += ['ξ']
<
*g:glyph_palette#defaults#palette*
A default palette which is assigned to |g:glyph_palette#palette|.
Note that the default value has constructed based defx-icons.
https://github.com/kristijanhusak/defx-icons
-----------------------------------------------------------------------------
FUNCTION *glyph-palette-function*
*glyph_palette#apply()*
glyph_palette#apply([{palette}])
Apply palette on the current buffer. Use |autocmd| to call this
function automatically like:
>
augroup my-glyph-palette
autocmd! *
autocmd FileType fern call glyph_palette#apply()
autocmd FileType nerdtree,startify call glyph_palette#apply()
augroup END
<
DEPRECATED~
The clear function returned from this function has deprecated. Use
|glyph_palette#clear()| on applied buffer instead to clear highlgihts.
*glyph_palette#clear()*
glyph_palette#clear()
Clear applied glyph palette highlight on the buffer.
It also clear highlights on other windows which shows the buffer as
well.
-----------------------------------------------------------------------------
HIGHLIGHT *glyph-palette-highlight*
Overwrite the following predfeined |highlight| to change colorset.
GlyphPalette0 Black *hl-GlyphPalette0*
GlyphPalette1 Red *hl-GlyphPalette1*
GlyphPalette2 Green *hl-GlyphPalette2*
GlyphPalette3 Yellow *hl-GlyphPalette3*
GlyphPalette4 Blue *hl-GlyphPalette4*
GlyphPalette5 Magenta *hl-GlyphPalette5*
GlyphPalette6 Cyan *hl-GlyphPalette6*
GlyphPalette7 White *hl-GlyphPalette7*
GlyphPalette8 Bright Black *hl-GlyphPalette8*
GlyphPalette9 Bright Red *hl-GlyphPalette9*
GlyphPalette10 Bright Green *hl-GlyphPalette10*
GlyphPalette11 Bright Yellow *hl-GlyphPalette11*
GlyphPalette12 Bright Blue *hl-GlyphPalette12*
GlyphPalette13 Bright Magenta *hl-GlyphPalette13*
GlyphPalette14 Bright Cyan *hl-GlyphPalette14*
GlyphPalette15 Bright White *hl-GlyphPalette15*
Note that the default colorset was copied from iceberg.vim
https://github.com/cocopon/iceberg.vim
=============================================================================
TOOLS *glyph-palette-tools*
Glyph palette provides the following tool functions
*glyph_palette#tools#palette_from()*
glyph_palette#tools#palette_from({settings}, {glyph_map})
Create a palette |Dictionary| from {settings} |Dictionary| through
{glyph_map} |Dictionary|.
The key of {settings} is a |highlight-group| and the value is a |List|
of a glyph character itself or a key of {glyph_map}.
When a key of {glyph_map} is specified, a corresponding value of
{glyph_map} is used in a result palette.
All duplicated characters in a result palette will be removed.
>
echo glyph_palette#tools#palette_from({
\ 'Function': ['ξ', 'ξ«', 'vim', 'key'],
\}, {
\ 'key': 'ξ ,
\ 'vim': 'ξ«',
\})
" { 'Function': ['ξ', 'ξ«', 'ξ'] }
<
Use this function to construct |g:glyph_palette#palette| from human
readable names and glyph map or use this function with
|glyph_pattern#tools#print_palette()| to avoid runtime construction.
*glyph_palette#tools#palette_from_nerdfont()*
glyph_palette#tools#palette_from_nerdfont({settings})
Create {glyph_map} of |glyph_palette#tools#palette_from()| from the
following nerdfont.vim variables and return palette.
- g:nerdfont#path#extension#defaults
- g:nerdfont#path#basename#defaults
https://github.com/lambdalisue/nerdfont.vim
*glyph_palette#tools#palette_from_devicons()*
glyph_palette#tools#palette_from_devicons({settings})
Create {glyph_map} of |glyph_palette#tools#palette_from()| from the
following vim-devicons variables and return palette.
- g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols
- g:WebDevIconsUnicodeDecorateFileNodesExactSymbols
https://github.com/ryanoasis/vim-devicons
*glyph_palette#tools#print_colors()*
glyph_palette#tools#print_colors({index_colors})
Create and open a non-file buffer to print |highlight| expressions
from {index_colors} for copy-and-paste.
The {index_colors} is a |List| which has 16 items and each item
indicates terminal indexed colors.
Users can use this function to create them original colorset from
Vim/Neovim terminal color settings like:
>
" Vim
call glyph_palette#tools#print_colors(g:terminal_ansi_colors)
" Neovim
call glyph_palette#tools#print_colors([
\ g:terminal_color_0,
\ g:terminal_color_1,
\ g:terminal_color_2,
\ g:terminal_color_3,
\ g:terminal_color_4,
\ g:terminal_color_5,
\ g:terminal_color_6,
\ g:terminal_color_7,
\ g:terminal_color_8,
\ g:terminal_color_9,
\ g:terminal_color_10,
\ g:terminal_color_11,
\ g:terminal_color_12,
\ g:terminal_color_13,
\ g:terminal_color_14,
\ g:terminal_color_15,
\])
<
*glyph_palette#tools#print_palette()*
glyph_palette#tools#print_palette({palette})
Open a non-file buffer to print {palette} for copy-and-paste.
Mainly to avoid runtime palette construction from settings.
*glyph_palette#tools#show_palette()*
glyph_palette#tools#show_palette([{palette}])
Open a non-file buffer to visualize {palette} for human. It shows the
{palette} like:
>
GlyphPalette1(ctermfg=1 guifg=#e27878) ξ· ξ ξ―
GlyphPalette2(ctermfg=2 guifg=#b4be82) ξ ξ ξ« ξ¨ ξͺ σΏ΅
GlyphPalette3(ctermfg=3 guifg=#e2a478) Ξ» ξ ξ ξ ξ ξ ξ ξ
GlyphPalette4(ctermfg=4 guifg=#84a0c6) ξ ξ ξ ξ¨ ξ ξ© ξ§ ξΈ ξΊ
GlyphPalette6(ctermfg=6 guifg=#89b8c2) ξ
GlyphPalette7(ctermfg=7 guifg=#c6c8d1) ξ ξ ξ¨ ξ ο½ ο
GlyphPalette8(ctermfg=8 guifg=#6b7089) ξΎ ξΏ ξ ο
GlyphPalette9(ctermfg=9 guifg=#e98989) ξ ξ ξ ξ€ ξ ξ ξΈ ξ ξ±
<
=============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl