-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
airline.nix
297 lines (254 loc) · 9.03 KB
/
airline.nix
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
294
295
296
297
{
lib,
config,
helpers,
pkgs,
...
}:
with lib;
with helpers.vim-plugin;
mkVimPlugin config {
name = "airline";
originalName = "vim-airline";
defaultPackage = pkgs.vimPlugins.vim-airline;
globalPrefix = "airline_";
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"sectionA"
"sectionB"
"sectionC"
"sectionX"
"sectionY"
"sectionZ"
"experimental"
"leftSep"
"rightSep"
"detectModified"
"detectPaste"
"detectCrypt"
"detectSpell"
"detectSpelllang"
"detectIminsert"
"inactiveCollapse"
"inactiveAltSep"
"theme"
"themePatchFunc"
"powerlineFonts"
"symbolsAscii"
"modeMap"
"excludeFilenames"
"excludeFiletypes"
"filetypeOverrides"
"excludePreview"
"disableStatusline"
"skipEmptySections"
"highlightingCache"
"focuslostInactive"
"statuslineOntop"
"stlPathStyle"
"sectionCOnlyFilename"
"symbols"
];
settingsOptions =
(listToAttrs (
map
(
name:
nameValuePair "section_${name}" (
helpers.mkNullOrOption (
with helpers.nixvimTypes;
oneOf [
rawLua
str
(listOf str)
(attrsOf anything)
]
) "Configuration for this section."
)
)
[
"a"
"b"
"c"
"x"
"y"
"z"
]
))
// {
experimental = helpers.defaultNullOpts.mkBool true ''
Enable experimental features.
Currently: Enable Vim9 Script implementation.
'';
left_sep = helpers.defaultNullOpts.mkStr ">" ''
The separator used on the left side.
'';
right_sep = helpers.defaultNullOpts.mkStr "<" ''
The separator used on the right side.
'';
detect_modified = helpers.defaultNullOpts.mkBool true ''
Enable modified detection.
'';
detect_paste = helpers.defaultNullOpts.mkBool true ''
Enable paste detection.
'';
detect_crypt = helpers.defaultNullOpts.mkBool true ''
Enable crypt detection.
'';
detect_spell = helpers.defaultNullOpts.mkBool true ''
Enable spell detection.
'';
detect_spelllang =
helpers.defaultNullOpts.mkNullable
(
with helpers.nixvimTypes;
oneOf [
rawLua
bool
(enum [ "flag" ])
]
)
true
''
Display spelling language when spell detection is enabled (if enough space is
available).
Set to 'flag' to get a unicode icon of the relevant country flag instead of the
'spelllang' itself.
'';
detect_iminsert = helpers.defaultNullOpts.mkBool false ''
Enable iminsert detection.
'';
inactive_collapse = helpers.defaultNullOpts.mkBool true ''
Determine whether inactive windows should have the left section collapsed to only the
filename of that buffer.
'';
inactive_alt_sep = helpers.defaultNullOpts.mkBool true ''
Use alternative separators for the statusline of inactive windows.
'';
theme = helpers.defaultNullOpts.mkStr "dark" ''
Themes are automatically selected based on the matching colorscheme.
This can be overridden by defining a value.
Note: Only the dark theme is distributed with vim-airline.
For more themes, checkout the vim-airline-themes repository
(https://github.com/vim-airline/vim-airline-themes)
'';
theme_patch_func = helpers.mkNullOrStr ''
If you want to patch the airline theme before it gets applied, you can supply the name of
a function where you can modify the palette.
Example: "AirlineThemePatch"
Then, define this function using `extraConfigVim`:
```nix
extraConfigVim = \'\'
function! AirlineThemePatch(palette)
if g:airline_theme == 'badwolf'
for colors in values(a:palette.inactive)
let colors[3] = 245
endfor
endif
endfunction
\'\';
```
'';
powerline_fonts = helpers.defaultNullOpts.mkBool false ''
By default, airline will use unicode symbols if your encoding matches utf-8.
If you want the powerline symbols set this variable to `true`.
'';
symbols_ascii = helpers.defaultNullOpts.mkBool false ''
By default, airline will use unicode symbols if your encoding matches utf-8.
If you want to use plain ascii symbols, set this variable: >
'';
mode_map = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (attrsOf str)) ''
Define the set of text to display for each mode.
Default: see source
'';
exclude_filenames = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf str)) ''
Define the set of filename match queries which excludes a window from having its
statusline modified.
Default: see source for current list
'';
exclude_filetypes = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf str)) ''
Define the set of filetypes which are excluded from having its window statusline modified.
Default: see source for current list
'';
filetype_overrides =
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (attrsOf (listOf str)))
''
Define the set of names to be displayed instead of a specific filetypes.
Example:
```nix
{
coc-explorer = ["CoC Explorer" ""];
defx = ["defx" "%{b:defx.paths[0]}"];
fugitive = ["fugitive" "%{airline#util#wrap(airline#extensions#branch#get_head(),80)}"];
gundo = ["Gundo" "" ];
help = ["Help" "%f"];
minibufexpl = ["MiniBufExplorer" ""];
startify = ["startify" ""];
vim-plug = ["Plugins" ""];
vimfiler = ["vimfiler" "%{vimfiler#get_status_string()}"];
vimshell = ["vimshell" "%{vimshell#get_status_string()}"];
vaffle = ["Vaffle" "%{b:vaffle.dir}"];
}
```
'';
exclude_preview = helpers.defaultNullOpts.mkBool false ''
Defines whether the preview window should be excluded from having its window statusline
modified (may help with plugins which use the preview window heavily).
'';
disable_statusline = helpers.defaultNullOpts.mkBool false ''
Disable the Airline statusline customization globally.
This setting disables setting the 'statusline' option.
This allows to use e.g. the tabline extension (`|airline-tabline|`) but keep the
'statusline' option totally configurable by a custom configuration.
'';
skip_empty_sections = helpers.defaultNullOpts.mkBool true ''
Do not draw separators for empty sections (only for the active window).
'';
highlighting_cache = helpers.defaultNullOpts.mkBool false ''
Caches the changes to the highlighting groups, should therefore be faster.
Set this to one, if you experience a sluggish Vim.
'';
focuslost_inactive = helpers.defaultNullOpts.mkBool false ''
Disable airline on FocusLost autocommand (e.g. when Vim loses focus).
'';
statusline_ontop = helpers.defaultNullOpts.mkBool false ''
Display the statusline in the tabline (first top line).
Setting this option, allows to use the statusline option to be used by a custom function
or another plugin, since airline won't change it.
Note: This setting is experimental and works on a best effort approach.
Updating the statusline might not always happen as fast as needed, but that is a
limitation, that comes from Vim.
airline tries to force an update if needed, but it might not always work as expected.
To force updating the tabline on mode changes, call `airline#check_mode()` in your custom
statusline setting: `:set stl=%!airline#check_mode(winnr())` will correctly update the
tabline on mode changes.
'';
stl_path_style = helpers.defaultNullOpts.mkStr "short" ''
Display a short path in statusline.
'';
section_c_only_filename = helpers.defaultNullOpts.mkBool true ''
Display a only file name in statusline.
'';
symbols = helpers.mkNullOrOption (with types; attrsOf str) ''
Customize airline symbols.
Example:
```nix
{
branch = "";
colnr = " ℅:";
readonly = "";
linenr = " :";
maxlinenr = "☰ ";
dirty= "⚡";
}
```
'';
};
settingsExample = {
powerline_fonts = true;
theme = "base16";
skip_empty_sections = true;
};
}