This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
feline.txt
888 lines (684 loc) · 35.6 KB
/
feline.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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
*feline.txt* minimal, stylish and customizable statusline for neovim
==============================================================================
Table of Contents *feline-table-of-contents*
- About |feline-about|
- Features |feline-features|
- Requirements |feline-requirements|
- Usage |feline-usage|
- Providers |feline-providers|
- Help |feline-help|
- LICENSE |feline-license|
ABOUT *feline-about*
Feline is a Lua statusline that prioritizes speed, customizability and
minimalism. It’s blazing fast and never gets in your way. Feline only
provides you with the necessary tools that you need to customize the statusline
to your liking and avoids feature-bloat. It’s also extremely customizable and
allows you to configure it in any way you wish to. Feline also has reasonable
defaults for those who don’t want to configure things and just want a good
out of the box experience.
FEATURES *feline-features*
- Ease-of-use.
- Complete customizability over every component.
- |feline-built-in-providers| such as:
- Vi-mode
- File info
- Cursor position
- Diagnostics (using |Neovim’s built-in LSP|)
- Git branch and diffs (using gitsigns.nvim <https://github.com/lewis6991/gitsigns.nvim/>)
and many more
- Minimalistic, only provides the bare minimum and allows the user to build their
own components very easily.
REQUIREMENTS *feline-requirements*
- Necessary
- Neovim v0.5 or greater
- Truecolor support for Neovim (do `:help 'termguicolors'` in Neovim for more info)
- Optional
- nvim-web-devicons <https://github.com/kyazdani42/nvim-web-devicons/> - For icon support
- A patched font <https://github.com/ryanoasis/nerd-fonts/> - For icon support
- gitsigns.nvim <https://github.com/lewis6991/gitsigns.nvim/> - For |feline-git-providers|
USAGE *feline-usage*
Once you’ve installed Feline, it’s very easy to start using it. Here are
the following options for using Feline:
1. USING DEFAULT STATUSLINE ~
If you want an opinionated statusline that "just works", then you can just use
Feline’s default statusline, for which you just have to add the `setup()`
function to your config:
>
require('feline').setup()
<
In case you don’t like icons and want to use the default statusline
configuration without icons, just do:
>
require('feline').setup({
preset = 'noicon'
})
<
NOTE: This is also the configuration used by default if you don’t have
`nvim-web-devicons`. You don’t have to specify it manually in case you
don’t have `nvim-web-devicons`. In that case, Feline will detect that you
don’t have `nvim-web-devicons` and automatically pick the `noicon` preset.
You can also make minor tweaks like changing the default foreground and
background color like this:
>
require('feline').setup {
colors = {
fg = '#D0D0D0',
bg = '#1F1F23'
}
}
<
2. BUILDING YOUR OWN STATUSLINE ~
If you don’t mind getting your hands dirty, then I recommend making your own
statusline, it’s very easy to do so, but for that you have to first
understand how Feline works.<br><br>Feline has a statusline generator that
takes a `components` value, which is a Lua table that needs to contain the
statusline components.
*feline-Components*
Components Inside the `components` table, there
needs to be two tables, `active` and
`inactive`, which will dictate whether
the component is a part of the
statusline when it’s in an active
window or an inactive window. And inside
each of the `active` and `inactive`
tables, you can put any amount of
tables, each of which will indicate a
section of the statusline. For example,
if you want two sections (left and
right), you can put two tables inside
each of the `active` and `inactive`
tables. If you want three sections
(left, mid and right), you can put three
tables inside each of the `active` and
`inactive` tables. There is no limit to
the amount of sections you can have.
It’s also possible to have a different
amount of sections for the `active` and
`inactive` statuslines.
So first, in your init.lua file, you have to initialize the components table
>
-- Initialize the components table
local components = {
active = {},
inactive = {}
}
<
You can then add new sections to the statusline by adding an element to the
`active` or `inactive` tables. For example:
>
-- Insert three sections (left, mid and right) for the active statusline
table.insert(components.active, {})
table.insert(components.active, {})
table.insert(components.active, {})
-- Insert two sections (left and right) for the inactive statusline
table.insert(components.inactive, {})
table.insert(components.inactive, {})
<
Now you can add statusline components to each of those sections by adding
elements to the sections. For example:
>
-- Insert a component that will be on the left side of the statusline
-- when the window is active:
table.insert(components.active[1], {
-- Component info here
})
-- Insert another component that will be on the left side of the statusline
-- when the window is active:
table.insert(components.active[1], {
-- Component info here
})
-- Insert a component that will be on the middle of the statusline
-- when the window is active:
table.insert(components.active[2], {
-- Component info here
})
-- Insert a component that will be on the right side of the statusline
-- when the window is active:
table.insert(components.active[3], {
-- Component info here
})
-- Insert a component that will be on the left side of the statusline
-- when the window is inactive:
table.insert(components.inactive[1], {
-- Component info here
})
-- Insert a component that will be on the right side of the statusline
-- when the window is inactive:
table.insert(components.inactive[2], {
-- Component info here
})
<
Alternatively you can also use Lua table indices instead of table.insert, like:
>
-- Insert a component that will be on the right side of the statusline
-- when the window is active:
components.active[3][1] = {
-- Component info here
}
-- Insert another component that will be on the right side of the statusline
-- when the window is active:
components.active[3][2] = {
-- Component info here
}
<
**NOTE:** If you use the index instead of table.insert, remember to put the
correct index. Also keep in mind that unlike most other programming languages,
Lua indices start at `1` instead of `0`.
You can customize each component to your liking. Most values that a component
requires can also use a function. However, these functions cannot take any
arguments, with the exception of the `provider` and `enabled` values, which can
take arguments (more about that below).
Feline will automatically evaluate the function if it is one. But in case a
function is provided, the type of the value the function returns must be the
same as the type of value required by the component. For example, since
`enabled` requires a boolean value, if you set it to a function, the function
must also return a boolean value.
Note that you can omit all of the component values except `provider`, in which
case the defaults would be used instead. A component can have the following
values:
- `provider` (string or function): If it’s a string, it represents the text to show. If it’s a function, it must return a string when called. As a function it may also optionally return an `icon` component alongside the string when called, which would represent the provider’s icon, possibly along with the icon highlight group configuration. The function can take either no arguments, or one argument which would contain the component itself, or it can take two arguments, the component and the window handler of the window for which the statusline is being generated.
>
-- Provider that shows current line in file
provider = function()
return string.format('%d:%d', vim.fn.line('.'), vim.fn.col('.'))
end
-- Providers can also take the component as an argument
provider = function(component)
if component.icon then
return component.icon
else
return ''
end
end
-- Providers can also take the window handler as an argument
provider = function(component, winid)
return (component.icon or '') .. tostring(vim.api.nvim_win_get_buf(winid))
end
-- If you only need the window handler, you can avoid using the component value like this:
provider = function(_, winid)
return vim.api.nvim_win_get_cursor(winid)[1]
end
-- Providers can also simply just contain a string, such as:
provider = 'some text here'
<
There are also some |feline-default-providers|, to use them, you just use the
provider name like this:
>
provider = 'position' -- This will use the default file position provider.
<
Note that you can also use your |feline-manually-added-providers| the same way
- `enabled` (boolean or function): Determines if the component is enabled. If false, the component is not shown in the statusline. If it’s a function that returns a boolean value, it can take either the window handler as an argument, or it can take no arguments. For example:
>
-- Enable if opened file has a valid size
enabled = function()
return vim.fn.getfsize(vim.fn.expand('%:p')) > 0
end
-- Enable if current window width is higher than 80
enabled = function(winid)
return vim.api.nvim_win_get_width(winid) > 80
end
<
- `icon` (table or string): Some inbuilt providers such as `git_branch` provide default icons. If you either don’t have a patched font or don’t like the default icon that Feline provides, or if you want an icon for a component that doesn’t have any default icons, you may set this value to use any icon you want instead. By default, the icon inherits the component’s highlight, but you can also change the highlight specifically for the icon. To do this, you need to pass a table containing `str` and `hl`, where `str` would represent the icon and `hl` would represent the icon highlight. The icon’s highlight works just like the `hl` component’s values. For example:
>
-- Setting icon to a string
icon = ' + '
-- Setting icon to a function
icon = function() return ' - ' end
-- Setting icon to a table
icon = {
str = ' ~ ',
hl = { fg = 'orange' },
}
<
- `hl` (table or string): Determines the highlight settings.<br>
If a string, it’ll use the given string as the name of the component highlight group. In that case, this highlight group must be defined elsewhere (i.e. in your colorscheme or your nvim config).<br>
If it’s a table, it’ll automatically generate a highlight group for you based on the given values. The hl table can have three values:
- `hl.fg` (string): RGB hex or |feline-name| of foreground color. (eg: `'#FFFFFF'`, `'white'`).<br>By default it uses the default foreground color provided in the `setup()` function.
- `hl.bg` (string): RGB hex or |feline-name| of background color. (eg: `#000000'`, `'black'`).<br>By default it uses the default background color provided in the `setup()` function.
- `hl.style` (string): Formatting style of text. (eg: `'bold,undercurl'`).<br>By default it is set to `'NONE'`
- `hl.name` (string): Name of highlight group created by Feline (eg: `'StatusComponentVimInsert'`).<br><br>Note that if `hl` is a function that can return different values, the highlight is not redefined if the name stays the same. Feline only creates highlights when they don’t exist, it never redefines existing highlights. So if `hl` is a function that can return different values for `hl.fg`, `hl.bg` or `hl.style`, make sure to return a different value for `hl.name` as well if you want the highlight to actually change. If a name is not provided, Feline automatically generates a unique name for the highlight group based on the other values. So you can also just omit the `name` and Feline will create new highlights for you when required.<br><br>Setting `hl.name` may provide a performance improvement since Feline caches highlight names and doesn’t take the time to generate a name if the name is already provided by the user.
An example of using the hl group:
>
-- As a table
hl = {
fg = 'skyblue'
}
-- As a string
hl = "MyStatuslineHLGroup"
-- As a function returning a table
hl = function()
return {
name = require('feline.providers.vi_mode').get_mode_highlight_name(),
fg = require('feline.providers.vi_mode').get_mode_color(),
style = 'bold'
}
end
-- As a function returning a string
hl = function()
if require("feline.providers.vi_mode").get_vim_mode() == "NORMAL" then
return "MyStatuslineNormal"
else
return "MyStatuslineOther"
end
end
<
<br>
**NOTE:** Some providers may also have special component values unique to them,
such as the `file_info` provider having a `file_modified_icon` value that you
can set. For more info, see: |feline-default-providers|. <br><br>
SEPARATORS
There are two types of separator values that you can put in a component, which
are `left_sep` and `right_sep`, which represent the separator on the left and
the right side of the component, respectively.
The value of `left_sep` and `right_sep` can just be set to a string that’s
displayed. You can use a function that returns a string just like the other
component values. The value can also be equal to the name of one of the
|feline-separator-presets|.
The value of `left_sep` and `right_sep` can also be a table or a function
returning a table. Inside the table there can be three values, `str`, `hl` and
`always_visible`. `str` represents the separator string and `hl` represents the
separator highlight. The separator’s highlight works just like the
component’s `hl` value. The only difference is that the separator’s `hl` by
default uses the parent’s background color as its foreground color.
By default, Feline doesn’t show the separator if the value returned by the
provider is empty. If you want the separator to be shown even when the
component string is empty, you can set the `always_visible` value in the
separator table to `true`. If unset or set to `false`, the separator is not
shown if the component string is empty.
You can also set `left_sep` and `right_sep` to be a `table` containing multiple
separator elements. It’s useful if you want to have different highlights for
different parts of the left/right separator of the same component, or if you
want to always show certain parts of the separator regardless of whether the
component string is empty, or if you just want to better organize the
component’s separator.
For example:
>
-- Setting sep to a string
left_sep = ' '
-- Setting sep to a separator preset
left_sep = 'slant_right'
-- Setting sep to a table with highlight
left_sep = {
str = 'slant_left',
hl = {
fg = 'oceanblue',
bg = 'bg'
}
}
-- Making sep always visible
right_sep = {
str = ' ',
always_visible = true
}
-- Setting sep to a function
right_sep = function()
local values = { 'right_rounded', 'right_filled', 'right' }
return values[math.random(#values)]
end
-- Setting sep to a list separator elements
right_sep = {
{
str = ' ',
hl = {
fg = 'NONE',
bg = 'oceanblue'
},
always_visible = true
},
-- The line below is equivalent to { str = 'slant_right' }
'slant_right'
}
<
COMPONENT EXAMPLE
Now that we know of the possible values you can set in a component, let’s
make some actual components to show you how it all looks like together:
Component example
>
-- Component that shows Vi mode with highlight
components.active[1][1] = {
provider = 'vi_mode',
hl = function()
return {
name = require('feline.providers.vi_mode').get_mode_highlight_name(),
fg = require('feline.providers.vi_mode').get_mode_color(),
style = 'bold'
}
end,
right_sep = ' '
}
-- Component that shows file info
components.active[1][2] = {
provider = 'file_info',
hl = {
fg = 'white',
bg = 'oceanblue',
style = 'bold'
},
left_sep = {' ', 'slant_left_2'},
right_sep = {'slant_right_2', ' '},
-- Uncomment the next line to disable file icons
-- icon = ''
}
-- Component that shows current file size
components.active[1][3] = {
provider = 'file_size',
right_sep = {
' ',
{
str = 'slant_left_2_thin',
hl = {
fg = 'fg',
bg = 'bg'
}
},
' '
}
}
-- Component that shows file encoding
components.active[2][1] = {
provider = 'file_encoding'
}
-- Component that shows current git branch
components.active[3][1] = {
provider = 'git_branch',
hl = {
fg = 'white',
bg = 'black',
style = 'bold'
},
right_sep = {
str = ' ',
hl = {
fg = 'NONE',
bg = 'black'
}
}
}
<
[**NOTE:** Remember to initialize the components table before assigning
anything to it]
VALUE PRESETS
Value presets are names for colors and separators that you can use instead of
the hex code or separator string, respectively.
For your ease of use, Feline has some default color and separator values set.
You can manually access them through `require('feline.defaults').colors` and
`require('feline.defaults').separators` respectively. But there’s a much
easier way to use them, which is to just directly assign the name of the color
or separator to the value, eg:
>
hl = {bg = 'oceanblue'},
right_sep = 'slant_right'
<
Not only that, you can add your own custom colors and separators through
|feline-the-setup-function| which allows you to just use the name of the color
or separator to refer to it.
Below is a list of all the default value names and their values:
DEFAULT COLORS
│ Name │ Value │
│fg │'#D0D0D0' │
│bg │'#1F1F23' │
│black │'#1B1B1B' │
│skyblue │'#50B0F0' │
│cyan │'#009090' │
│green │'#60A040' │
│oceanblue │'#0066cc' │
│magenta │'#C26BDB' │
│orange │'#FF9000' │
│red │'#D10000' │
│violet │'#9E93E8' │
│white │'#FFFFFF' │
│yellow │'#E1E120' │
DEFAULT SEPARATORS
│ Name │ Value │
│vertical_bar │'┃' │
│vertical_bar_thin │'│' │
│left │'' │
│right │'' │
│block │'█' │
│left_filled │'' │
│right_filled │'' │
│slant_left │'' │
│slant_left_thin │'' │
│slant_right │'' │
│slant_right_thin │'' │
│slant_left_2 │'' │
│slant_left_2_thin │'' │
│slant_right_2 │'' │
│slant_right_2_thin │'' │
│left_rounded │'' │
│left_rounded_thin │'' │
│right_rounded │'' │
│right_rounded_thin │'' │
│circle │'●' │
*feline-Setup-function*
Setup function Now that we’ve learned to set up both
the components table, it’s finally
time to revisit the setup function. The
setup function takes a table that can
have the following values:
- `preset` - Set it to use a preconfigured statusline. Currently it can be equal to either `default` for the default statusline or `noicon` for the default statusline without icons. You don’t have to put any of the other values if you use a preset, but if you do, your settings will override the preset’s settings. To see more info such as how to modify a preset to build a statusline, see: |feline-modifying-an-existing-preset|
- `components` - The components table.
- `colors` - A table containing custom |feline-color-value-presets|. The value of `colors.fg` and `colors.bg` also represent the default foreground and background colors, respectively.
- `separators` - A table containing custom |feline-separator-value-presets|.
- `update_triggers` - A list of autocmds that trigger an update of the statusline in inactive windows.<br>
Default: `{'VimEnter', 'WinEnter', 'WinClosed', 'FileChangedShellPost'}`
- `force_inactive` - A table that determines which buffers should always have the inactive statusline, even when they are active. It can have 3 values inside of it, `filetypes`, `buftypes` and `bufnames`, all three of them are tables which contain file types, buffer types and buffer names respectively.<br><br>
Default:
>
{
filetypes = {
'NvimTree',
'packer',
'startify',
'fugitive',
'fugitiveblame',
'qf',
'help'
},
buftypes = {
'terminal'
},
bufnames = {}
}
<
- `disable` - Similar to `force_inactive`, except the statusline is disabled completely. Configured the same way as `force_inactive`. Feline doesn’t disable the statusline on anything by default.
- `vi_mode_colors` - A table containing colors associated with Vi modes. It can later be used to get the color associated with the current Vim mode using `require('feline.providers.vi_mode').get_mode_color()`. For more info on it see the |feline-vi-mode| section.<br><br>
Here is a list of all possible vi_mode names used with the default color associated with them:
│ Mode │ Description │ Value │
│NORMAL │Normal mode │'green' │
│OP │Operator pending mode│'green' │
│INSERT │Insert mode │'red' │
│VISUAL │Visual mode │'skyblue' │
│LINES │Visual lines mode │'skyblue' │
│BLOCK │Visual block mode │'skyblue' │
│REPLACE │Replace mode │'violet' │
│V-REPLACE │Virtual Replace mode │'violet' │
│ENTER │Enter mode │'cyan' │
│MORE │More mode │'cyan' │
│SELECT │Select mode │'orange' │
│COMMAND │Command mode │'green' │
│SHELL │Shell mode │'green' │
│TERM │Terminal mode │'green' │
│NONE │None │'yellow' │
*feline-Example-configuration*
Example configuration Now that you know how to create Feline
components, you can check out the code
in the default preset
<lua/feline/presets/default.lua> to see
how the components in it are set up so
you can get a good practical idea of how
to use the tools that Feline gives you.
3. MODIFYING AN EXISTING PRESET ~
If you like the defaults for the most part but there’s some things you want
to change, then you’d be glad to know that it’s easy to just modify an
existing preset to get the statusline configuration you want. Just do:
>
-- Substitute preset_name with the name of the preset you want to modify.
-- eg: "default" or "noicon"
local components = require('feline.presets')[preset_name].components
<
After that, you can just modify the components and call
|feline-the-setup-function| with the preset as you normally would.
PROVIDERS *feline-providers*
DEFAULT PROVIDERS ~
Feline by default has some built-in providers to make your life easy. They are:
│ Name │ Description │
│|feline-vi_mode| │Current vim mode │
│position │Get line and column number of cursor │
│line_percentage │Current line percentage │
│scroll_bar │Scroll bar that shows file progress │
│|feline-file_info| │Get file icon, name and modified status │
│file_size │Get file size │
│file_type │Get file type │
│file_encoding │Get file encoding │
│|feline-git_branch| │Shows current git branch │
│|feline-git_diff_added| │Git diff added count │
│|feline-git_diff_removed| │Git diff removed count │
│|feline-git_diff_changed| │Git diff changed count │
│lsp_client_names │Name of LSP clients attached to current buf│
│ │fer │
│|feline-diagnostic_errors| │Diagnostics errors count │
│ │ │
│|feline-diagnostic_warnings| │Diagnostics warnings count │
│ │ │
│|feline-diagnostic_hints| │Diagnostics hints count │
│|feline-diagnostic_info| │Diagnostics info count │
*feline-Vi-mode*
Vi-mode The vi-mode provider by itself only
shows an icon. To actually indicate the
current Vim mode, you have to use
`require('feline.providers.vi_mode').get_mode_color()`
for the component’s `hl.fg`.
Note that this is different if you set the `icon` value of the component to
`''`, in that case it’ll use the name of the mode instead of an icon, which
is what the `noicon` preset uses.
Here is the simplest method to make a component with proper Vi-mode indication:
>
-- Remember to change "components.active[1][1]" according to the rest of your config
components.active[1][1] = {
provider = 'vi_mode',
hl = function()
return {
name = require('feline.providers.vi_mode').get_mode_highlight_name(),
fg = require('feline.providers.vi_mode').get_mode_color(),
style = 'bold'
}
end,
right_sep = ' ',
-- Uncomment the next line to disable icons for this component and use the mode name instead
-- icon = ''
}
<
The Vi-mode provider also provides a helper function
`get_mode_highlight_name()` which can be used through
`require('feline.providers.vi_mode').get_mode_highlight_name()`, it returns the
highlight name for the current mode, which you can then use for the
provider’s `hl.name` to give its highlight groups meaningful names.
*feline-File-Info*
File Info The `file_info` provider has some
special component values:
- `colored_icon` (boolean): Determines whether file icon should use color
inherited from `nvim-web-devicons`.<br> Default: `true`
- `file_modified_icon` (string): The icon that is shown when a file is
modified.<br> Default:`'●'`
- `file_readonly_icon` (string): The icon that is shown when a file is
read-only.<br> Default:`'🔒'`
- `type` (string): Determines which parts of the filename are shown. Its value
can be one of:
- `'full-path'`: Full path of the file (eg: `'/home/user/.config/nvim/init.lua'`)
- `'short-path'`: Shortened path of the file (eg: `'/h/u/.c/n/init.lua'`)
- `'base-only'`: Show only base filename and extension (eg: `'init.lua'`)
- `'relative'`: File path relative to the current directory.
- `'relative-short'`: Combination of `'relative'` and `'short-path'`.
- `'unique'`: Unique substring of the full path.<br>
For example: If you have three buffers with the paths `'/home/user/file.lua'`, `'/home/user/dir1/file.lua'` and `'/home/user/dir2/file.lua'`, Feline will show the names `'user/file.lua'`, `'dir1/file.lua'` and `'dir2/file.lua'` for them, respectively.<br>
If there’s no files that share the same name, it behaves the same as `'base-only'`.
- `'unique-short'`: Combination of `'unique'` and `'short-path'`.
<br>Default: `'base-only'`
*feline-Git*
Git The git providers all require
gitsigns.nvim
<https://github.com/lewis6991/gitsigns.nvim/>,
make sure you have it installed when you
use those providers, otherwise they’ll
have no output.
The git provider also provides a utility function
`require('feline.providers.git').git_info_exists(winid)` (where `winid` is the
window handler) for checking if any git information exists in the window
through this utility function.
*feline-Diagnostics*
Diagnostics The diagnostics and LSP providers all
require the Neovim built-in LSP to be
configured and at least one LSP client
to be attached to the current buffer,
else they’ll have no output.
The diagnostics provider also provides a utility function
`require('feline.providers.lsp').diagnostics_exist(type, winid)` (where `type`
represents the type of diagnostic and `winid` is the window handler) for
checking if any diagnostics of the provided type exists in the window. The
values of `type` must be one of `'Error'`, `'Warning'`, `'Hint'` or
`'Information'`.
ADDING YOUR OWN PROVIDER ~
In case none of the default providers do what you want, it’s very easy to add
your own provider. Just call `require('feline.providers').add_provider(name,
function)` where `name` is the name of the provider and `function` is the
function associated with the provider, you can then use your provider the same
way you use the other providers. Remember, the function has to take either no
argument, or one argument that contains the component and its values.
HELP *feline-help*
COMMON ISSUES ~
Feline crashes or disappears for seemingly no reason
This can be caused if you forget to remove your other statusline plugins after
installing Feline. Make sure all other statusline plugins are removed before
you install Feline, that should fix the issue.
TIPS AND TRICKS ~
*feline-Reset-highlight*
Reset highlight If, for some reason, you want to clear
all highlights that Feline sets (useful
if you want to reload your entire Neovim
config which may mess up highlights),
you can do:
>
require('feline').reset_highlights()
<
And then Feline will automatically regenerate those highlights when it needs
them, so you don’t have to worry about setting the highlights yourself.
*feline-Thin-line-for-horizontal-splits*
Thin line for horizontal splits If you want, you can have a thin line
instead of the inactive statusline to
separate your windows, like the vertical
window split separator, except in this
case it would act as a horizontal window
separator of sorts. You can do this
through:
>
local nvim_exec = vim.api.nvim_exec
-- Get highlight of inactive statusline by parsing the style, fg and bg of VertSplit
local InactiveStatusHL = {
fg = nvim_exec("highlight VertSplit", true):match("guifg=(#[0-9A-Fa-f]+)") or "#444444",
bg = nvim_exec("highlight VertSplit", true):match("guibg=(#[0-9A-Fa-f]+)") or "#1E1E1E",
style = nvim_exec("highlight VertSplit", true):match("gui=(#[0-9A-Fa-f]+)") or "",
}
-- Add underline to inactive statusline highlight style
-- in order to have a thin line instead of the statusline
if InactiveStatusHL.style == '' then
InactiveStatusHL.style = 'underline'
else
InactiveStatusHL.style = InactiveStatusHL.style .. ',underline'
end
-- Apply the highlight to the statusline
-- by having an empty provider with the highlight
components.inactive = {
{
{
provider = '',
hl = InactiveStatusHL
}
}
}
<
LICENSE *feline-license*
Feline is licensed under GNU GPLv3. For more info, see: LICENSE.md
<LICENSE.md>.
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
vim:tw=78:ts=8:noet:ft=help:norl: