Debian Codegraph @

doc/lualine.txt

raw
1 *lualine.txt* fast and easy to configure statusline plugin for neovim
2
3 ==============================================================================
4 Table of Contents *lualine-table-of-contents*
5
6 1. lualine.nvim |lualine-lualine.nvim|
7 - Contributing |lualine-contributing|
8 - Performance compared to other plugins|lualine-performance-compared-to-other-plugins|
9 - Installation |lualine-installation|
10 - Usage and customization |lualine-usage-and-customization|
11
12 ==============================================================================
13 1. lualine.nvim *lualine-lualine.nvim*
14
15 A blazing fast and easy to configure Neovim statusline written in Lua.
16
17 `lualine.nvim` requires Neovim >= 0.7.
18
19 For previous versions of neovim please use compatability tags for example
20 compat-nvim-0.5
21
22 CONTRIBUTING *lualine-contributing*
23
24 Feel free to create an issue/PR if you want to see anything else implemented.
25 If you have some question or need help with configuration, start a discussion
26 <https://github.com/nvim-lualine/lualine.nvim/discussions>.
27
28 Please read CONTRIBUTING.md <./CONTRIBUTING.md> before opening a PR. You can
29 also help with documentation in the wiki
30 <https://github.com/nvim-lualine/lualine.nvim/wiki>.
31
32 PERFORMANCE COMPARED TO OTHER PLUGINS*lualine-performance-compared-to-other-plugins*
33
34 Unlike other statusline plugins, lualine loads only the components you specify,
35 and nothing else.
36
37 Startup time performance measured with an amazing plugin
38 dstein64/vim-startuptime <https://github.com/dstein64/vim-startuptime>
39
40 Times are measured with a clean `init.vim` with only `vim-startuptime`,
41 `vim-plug` and given statusline plugin installed. In control just
42 `vim-startuptime` and`vim-plug` is installed. And measured time is complete
43 startuptime of vim not time spent on specific plugin. These numbers are the
44 average of 20 runs.
45
46 │control│lualine│lightline│airline│
47 │17.2 ms│24.8 ms│ 25.5 ms │79.9 ms│
48
49
50 Last Updated On: 18-04-2022
51
52 INSTALLATION *lualine-installation*
53
54 |VIM.PACK| (ONLY FOR NEOVIM 0.12) ~
55
56 >
57 vim.pack.add({
58 'https://github.com/nvim-tree/nvim-web-devicons',
59 'https://github.com/nvim-lualine/lualine.nvim'
60 })
61 <
62
63
64 VIM-PLUG <HTTPS://GITHUB.COM/JUNEGUNN/VIM-PLUG> ~
65
66 >
67 Plug 'nvim-lualine/lualine.nvim'
68 " If you want to have icons in your statusline choose one of these
69 Plug 'nvim-tree/nvim-web-devicons'
70 <
71
72
73 PACKER.NVIM <HTTPS://GITHUB.COM/WBTHOMASON/PACKER.NVIM> ~
74
75 >
76 use {
77 'nvim-lualine/lualine.nvim',
78 requires = { 'nvim-tree/nvim-web-devicons', opt = true }
79 }
80 <
81
82
83 LAZY.NVIM <HTTPS://GITHUB.COM/FOLKE/LAZY.NVIM> ~
84
85 >
86 {
87 'nvim-lualine/lualine.nvim',
88 dependencies = { 'nvim-tree/nvim-web-devicons' }
89 }
90 <
91
92
93 You’ll also need to have a patched font if you want icons.
94
95 USAGE AND CUSTOMIZATION *lualine-usage-and-customization*
96
97 Lualine has sections as shown below.
98
99 >
100 +-------------------------------------------------+
101 | A | B | C X | Y | Z |
102 +-------------------------------------------------+
103 <
104
105
106 Each sections holds its components e.g. Vim’s current mode.
107
108 CONFIGURING LUALINE IN INIT.VIM ~
109
110 All the examples below are in lua. You can use the same examples in `.vim`
111 files by wrapping them in lua heredoc like this:
112
113 >
114 lua << END
115 require('lualine').setup()
116 END
117 <
118
119
120 For more information, check out `:help lua-heredoc`.
121
122 *lualine-Default-configuration*
123
124 >
125 require('lualine').setup {
126 options = {
127 icons_enabled = true,
128 theme = 'auto',
129 component_separators = { left = '', right = ''},
130 section_separators = { left = '', right = ''},
131 disabled_filetypes = {
132 statusline = {},
133 winbar = {},
134 },
135 ignore_focus = {},
136 always_divide_middle = true,
137 always_show_tabline = true,
138 globalstatus = false,
139 refresh = {
140 statusline = 1000,
141 tabline = 1000,
142 winbar = 1000,
143 refresh_time = 16, -- ~60fps
144 events = {
145 'WinEnter',
146 'BufEnter',
147 'BufWritePost',
148 'SessionLoadPost',
149 'FileChangedShellPost',
150 'VimResized',
151 'Filetype',
152 'CursorMoved',
153 'CursorMovedI',
154 'ModeChanged',
155 },
156 }
157 },
158 sections = {
159 lualine_a = {'mode'},
160 lualine_b = {'branch', 'diff', 'diagnostics'},
161 lualine_c = {'filename'},
162 lualine_x = {'encoding', 'fileformat', 'filetype'},
163 lualine_y = {'progress'},
164 lualine_z = {'location'}
165 },
166 inactive_sections = {
167 lualine_a = {},
168 lualine_b = {},
169 lualine_c = {'filename'},
170 lualine_x = {'location'},
171 lualine_y = {},
172 lualine_z = {}
173 },
174 tabline = {},
175 winbar = {},
176 inactive_winbar = {},
177 extensions = {}
178 }
179 <
180
181
182 Default configuration If you want to get your current lualine
183 config, you can do so with:
184
185
186 >
187 require('lualine').get_config()
188 <
189
190
191 ------------------------------------------------------------------------------
192
193 STARTING LUALINE ~
194
195 >
196 require('lualine').setup()
197 <
198
199
200 ------------------------------------------------------------------------------
201
202 SETTING A THEME ~
203
204 >
205 options = { theme = 'gruvbox' }
206 <
207
208
209 All available themes are listed in THEMES.md <./THEMES.md>.
210
211 Please create a PR if you managed to port a popular theme before us, here is
212 how to do it <./CONTRIBUTING.md>.
213
214 *lualine-Customizing-themes*
215
216 >
217 local custom_gruvbox = require'lualine.themes.gruvbox'
218
219 -- Change the background of lualine_c section for normal mode
220 custom_gruvbox.normal.c.bg = '#112233'
221
222 require('lualine').setup {
223 options = { theme = custom_gruvbox },
224 ...
225 }
226 <
227
228
229 Customizing themes Theme structure is available here
230 <https://github.com/nvim-lualine/lualine.nvim/wiki/Writing-a-theme>.
231
232
233 ------------------------------------------------------------------------------
234
235 SEPARATORS ~
236
237 lualine defines two kinds of separators:
238
239
240 - `section_separators` - separators between sections
241 - `component_separators` - separators between the different components in sections
242
243
244 **Note**: if viewing this README in a browser, chances are the characters below
245 will not be visible.
246
247 >
248 options = {
249 section_separators = { left = '', right = '' },
250 component_separators = { left = '', right = '' }
251 }
252 <
253
254
255 Here, left refers to the left-most sections (a, b, c), and right refers to the
256 right-most sections (x, y, z).
257
258 *lualine-Disabling-separators*
259
260 >
261 options = { section_separators = '', component_separators = '' }
262 <
263
264
265 ------------------------------------------------------------------------------
266
267 CHANGING COMPONENTS IN LUALINE SECTIONS ~
268
269 >
270 sections = {lualine_a = {'mode'}}
271 <
272
273
274 *lualine-Available-components*
275
276
277 - `branch` (git branch)
278 - `buffers` (shows currently available buffers)
279 - `diagnostics` (diagnostics count from your preferred source)
280 - `diff` (git diff status)
281 - `encoding` (file encoding)
282 - `fileformat` (file format)
283 - `filename`
284 - `filesize`
285 - `filetype`
286 - `hostname`
287 - `location` (location in file in line:column format)
288 - `mode` (vim mode)
289 - `progress` (%progress in file)
290 - `searchcount` (number of search matches when hlsearch is active)
291 - `selectioncount` (number of selected characters or lines)
292 - `tabs` (shows currently available tabs)
293 - `windows` (shows currently available windows)
294 - `lsp_status` (shows active LSPs in the current buffer and a progress spinner)
295
296
297 *lualine-Custom-components*
298
299 LUA FUNCTIONS AS LUALINE COMPONENT
300
301 >
302 local function hello()
303 return [[hello world]]
304 end
305 sections = { lualine_a = { hello } }
306 <
307
308
309 VIM FUNCTIONS AS LUALINE COMPONENT
310
311 >
312 sections = { lualine_a = {'FugitiveHead'} }
313 <
314
315
316 VIM’S STATUSLINE ITEMS AS LUALINE COMPONENT
317
318 >
319 sections = { lualine_c = {'%=', '%t%m', '%3p'} }
320 <
321
322
323 VIM VARIABLES AS LUALINE COMPONENT
324
325 Variables from `g:`, `v:`, `t:`, `w:`, `b:`, `o:`, `to:`, `wo:`, `bo:` scopes
326 can be used.
327
328 See `:h lua-vim-variables` and `:h lua-vim-options` if you are not sure what to
329 use.
330
331 >
332 sections = { lualine_a = { 'g:coc_status', 'bo:filetype' } }
333 <
334
335
336 LUA EXPRESSIONS AS LUALINE COMPONENT
337
338 You can use any valid lua expression as a component including:
339
340
341 - oneliners
342 - global variables
343 - require statements
344
345
346 >
347 sections = { lualine_c = { "os.date('%a')", 'data', "require'lsp-status'.status()" } }
348 <
349
350
351 `data` is a global variable in this example.
352
353 ------------------------------------------------------------------------------
354
355 COMPONENT OPTIONS ~
356
357 Component options can change the way a component behave. There are two kinds of
358 options:
359
360
361 - global options affecting all components
362 - local options affecting specific
363
364
365 Global options can be used as local options (can be applied to specific
366 components) but you cannot use local options as global. Global option used
367 locally overwrites the global, for example:
368
369 >
370 require('lualine').setup {
371 options = { fmt = string.lower },
372 sections = { lualine_a = {
373 { 'mode', fmt = function(str) return str:sub(1,1) end } },
374 lualine_b = {'branch'} }
375 }
376 <
377
378
379 `mode` will be formatted with the passed function so only first char will be
380 shown. On the other hand branch will be formatted with global formatter
381 `string.lower` so it will be showed in lower case.
382
383 *lualine-Available-options*
384
385 *lualine-Global-options*
386
387 Global options These are `options` that are used in
388 options table. They set behavior of
389 lualine.
390
391
392 Values set here are treated as default for other options that work in component
393 level.
394
395 For example even though `icons_enabled` is a general component option. You can
396 set `icons_enabled` to `false` and icons will be disabled on all component. You
397 can still overwrite defaults set in option table by specifying the option value
398 in component.
399
400 >
401 options = {
402 theme = 'auto', -- lualine theme
403 component_separators = { left = '', right = '' },
404 section_separators = { left = '', right = '' },
405 disabled_filetypes = { -- Filetypes to disable lualine for.
406 statusline = {}, -- only ignores the ft for statusline.
407 winbar = {}, -- only ignores the ft for winbar.
408 },
409
410 ignore_focus = {}, -- If current filetype is in this list it'll
411 -- always be drawn as inactive statusline
412 -- and the last window will be drawn as active statusline.
413 -- for example if you don't want statusline of
414 -- your file tree / sidebar window to have active
415 -- statusline you can add their filetypes here.
416 --
417 -- Can also be set to a function that takes the
418 -- currently focused window as its only argument
419 -- and returns a boolean representing whether the
420 -- window's statusline should be drawn as inactive.
421
422 always_divide_middle = true, -- When set to true, left sections i.e. 'a','b' and 'c'
423 -- can't take over the entire statusline even
424 -- if neither of 'x', 'y' or 'z' are present.
425
426 always_show_tabline = true -- When set to true, if you have configured lualine for displaying tabline
427 -- then tabline will always show. If set to false, then tabline will be displayed
428 -- only when there are more than 1 tab. (see :h showtabline)
429
430 globalstatus = false, -- enable global statusline (have a single statusline
431 -- at bottom of neovim instead of one for every window).
432 -- This feature is only available in neovim 0.7 and higher.
433
434 refresh = { -- sets how often lualine should refresh it's contents (in ms)
435 statusline = 100, -- The refresh option sets minimum time that lualine tries
436 tabline = 100, -- to maintain between refresh. It's not guarantied if situation
437 winbar = 100 -- arises that lualine needs to refresh itself before this time
438 -- it'll do it.
439 refresh_time = 16, -- ~60fps the time after which refresh queue is processed. Mininum refreshtime for lualine
440 events = { -- The auto command events at which lualine refreshes
441 'WinEnter',
442 'BufEnter',
443 'BufWritePost',
444 'SessionLoadPost',
445 'FileChangedShellPost',
446 'VimResized',
447 'Filetype',
448 'CursorMoved',
449 'CursorMovedI',
450 'ModeChanged',
451 },
452 -- Also you can force lualine's refresh by calling refresh function
453 -- like require('lualine').refresh()
454 }
455 }
456 <
457
458
459 *lualine-General-component-options*
460
461 General component options These are options that control behavior
462 at component level and are available for
463 all components.
464
465
466 >
467 sections = {
468 lualine_a = {
469 {
470 'mode',
471 icons_enabled = true, -- Enables the display of icons alongside the component.
472 -- Defines the icon to be displayed in front of the component.
473 -- Can be string|table
474 -- As table it must contain the icon as first entry and can use
475 -- color option to custom color the icon. Example:
476 -- {'branch', icon = ''} / {'branch', icon = {'', color={fg='green'}}}
477
478 -- icon position can also be set to the right side from table. Example:
479 -- {'branch', icon = {'', align='right', color={fg='green'}}}
480 icon = nil,
481
482 separator = nil, -- Determines what separator to use for the component.
483 -- Note:
484 -- When a string is provided it's treated as component_separator.
485 -- When a table is provided it's treated as section_separator.
486 -- Passing an empty string disables the separator.
487 --
488 -- These options can be used to set colored separators
489 -- around a component.
490 --
491 -- The options need to be set as such:
492 -- separator = { left = '', right = ''}
493 --
494 -- Where left will be placed on left side of component,
495 -- and right will be placed on its right.
496 --
497
498 cond = nil, -- Condition function, the component is loaded when the function returns `true`.
499
500 draw_empty = false, -- Whether to draw component even if it's empty.
501 -- Might be useful if you want just the separator.
502
503 -- Defines a custom color for the component:
504 --
505 -- 'highlight_group_name' | { fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style' } | function
506 -- Note:
507 -- '|' is synonymous with 'or', meaning a different acceptable format for that placeholder.
508 -- color function has to return one of other color types ('highlight_group_name' | { fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style' })
509 -- color functions can be used to have different colors based on state as shown below.
510 --
511 -- Examples:
512 -- color = { fg = '#ffaa88', bg = 'grey', gui='italic,bold' },
513 -- color = { fg = 204 } -- When fg/bg are omitted, they default to the your theme's fg/bg.
514 -- color = 'WarningMsg' -- Highlight groups can also be used.
515 -- color = function(section)
516 -- return { fg = vim.bo.modified and '#aa3355' or '#33aa88' }
517 -- end,
518 color = nil, -- The default is your theme's color for that section and mode.
519
520 -- Specify what type a component is, if omitted, lualine will guess it for you.
521 --
522 -- Available types are:
523 -- [format: type_name(example)], mod(branch/filename),
524 -- stl(%f/%m), var(g:coc_status/bo:modifiable),
525 -- lua_expr(lua expressions), vim_fun(viml function name)
526 --
527 -- Note:
528 -- lua_expr is short for lua-expression and vim_fun is short for vim-function.
529 type = nil,
530
531 padding = 1, -- Adds padding to the left and right of components.
532 -- Padding can be specified to left or right independently, e.g.:
533 -- padding = { left = left_padding, right = right_padding }
534
535 fmt = nil, -- Format function, formats the component's output.
536 -- This function receives two arguments:
537 -- - string that is going to be displayed and
538 -- that can be changed, enhanced and etc.
539 -- - context object with information you might
540 -- need. E.g. tabnr if used with tabs.
541 on_click = nil, -- takes a function that is called when component is clicked with mouse.
542 -- the function receives several arguments
543 -- - number of clicks in case of multiple clicks
544 -- - mouse button used (l(left)/r(right)/m(middle)/...)
545 -- - modifiers pressed (s(shift)/c(ctrl)/a(alt)/m(meta)...)
546 }
547 }
548 }
549 <
550
551
552 *lualine-Component-specific-options*
553
554 Component specific options These are options that are available on
555 specific components. For example, you
556 have option on `diagnostics` component
557 to specify what your diagnostic sources
558 will be.
559
560
561 *lualine-buffers-component-options*
562
563 >
564 sections = {
565 lualine_a = {
566 {
567 'buffers',
568 show_filename_only = true, -- Shows shortened relative path when set to false.
569 hide_filename_extension = false, -- Hide filename extension when set to true.
570 show_modified_status = true, -- Shows indicator when the buffer is modified.
571
572 mode = 0, -- 0: Shows buffer name
573 -- 1: Shows buffer index
574 -- 2: Shows buffer name + buffer index
575 -- 3: Shows buffer number
576 -- 4: Shows buffer name + buffer number
577
578 max_length = vim.o.columns * 2 / 3, -- Maximum width of buffers component,
579 -- it can also be a function that returns
580 -- the value of `max_length` dynamically.
581 filetype_names = {
582 TelescopePrompt = 'Telescope',
583 dashboard = 'Dashboard',
584 packer = 'Packer',
585 fzf = 'FZF',
586 alpha = 'Alpha'
587 }, -- Shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
588
589 -- Automatically updates active buffer color to match color of other components (will be overidden if buffers_color is set)
590 use_mode_colors = false,
591
592 buffers_color = {
593 -- Same values as the general color option can be used here.
594 active = 'lualine_{section}_normal', -- Color for active buffer.
595 inactive = 'lualine_{section}_inactive', -- Color for inactive buffer.
596 },
597
598 symbols = {
599 modified = ' ●', -- Text to show when the buffer is modified
600 alternate_file = '#', -- Text to show to identify the alternate file
601 directory = '', -- Text to show when the buffer is a directory
602 },
603 }
604 }
605 }
606 <
607
608
609 *lualine-datetime-component-options*
610
611 >
612 sections = {
613 lualine_a = {
614 {
615 'datetime',
616 -- options: default, us, uk, iso, or your own format string ("%H:%M", etc..)
617 style = 'default'
618 }
619 }
620 }
621 <
622
623
624 *lualine-diagnostics-component-options*
625
626 >
627 sections = {
628 lualine_a = {
629 {
630 'diagnostics',
631
632 -- Table of diagnostic sources, available sources are:
633 -- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'.
634 -- or a function that returns a table as such:
635 -- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt }
636 sources = { 'nvim_diagnostic', 'coc' },
637
638 -- Displays diagnostics for the defined severity types
639 sections = { 'error', 'warn', 'info', 'hint' },
640
641 diagnostics_color = {
642 -- Same values as the general color option can be used here.
643 error = 'DiagnosticError', -- Changes diagnostics' error color.
644 warn = 'DiagnosticWarn', -- Changes diagnostics' warn color.
645 info = 'DiagnosticInfo', -- Changes diagnostics' info color.
646 hint = 'DiagnosticHint', -- Changes diagnostics' hint color.
647 },
648 symbols = {error = 'E', warn = 'W', info = 'I', hint = 'H'},
649 colored = true, -- Displays diagnostics status in color if set to true.
650 update_in_insert = false, -- Update diagnostics in insert mode.
651 always_visible = false, -- Show diagnostics even if there are none.
652 }
653 }
654 }
655 <
656
657
658 *lualine-diff-component-options*
659
660 >
661 sections = {
662 lualine_a = {
663 {
664 'diff',
665 colored = true, -- Displays a colored diff status if set to true
666 diff_color = {
667 -- Same color values as the general color option can be used here.
668 added = 'LuaLineDiffAdd', -- Changes the diff's added color
669 modified = 'LuaLineDiffChange', -- Changes the diff's modified color
670 removed = 'LuaLineDiffDelete', -- Changes the diff's removed color you
671 },
672 symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the symbols used by the diff.
673 source = nil, -- A function that works as a data source for diff.
674 -- It must return a table as such:
675 -- { added = add_count, modified = modified_count, removed = removed_count }
676 -- or nil on failure. count <= 0 won't be displayed.
677 }
678 }
679 }
680 <
681
682
683 *lualine-fileformat-component-options*
684
685 >
686 sections = {
687 lualine_a = {
688 {
689 'fileformat',
690 symbols = {
691 unix = '', -- e712
692 dos = '', -- e70f
693 mac = '', -- e711
694 }
695 }
696 }
697 }
698 <
699
700
701 *lualine-filename-component-options*
702
703 >
704 sections = {
705 lualine_a = {
706 {
707 'filename',
708 file_status = true, -- Displays file status (readonly status, modified status)
709 newfile_status = false, -- Display new file status (new file means no write after created)
710 path = 0, -- 0: Just the filename
711 -- 1: Relative path
712 -- 2: Absolute path
713 -- 3: Absolute path, with tilde as the home directory
714 -- 4: Filename and parent dir, with tilde as the home directory
715
716 shorting_target = 40, -- Shortens path to leave 40 spaces in the window
717 -- for other components. (terrible name, any suggestions?)
718 -- It can also be a function that returns
719 -- the value of `shorting_target` dynamically.
720 symbols = {
721 modified = '[+]', -- Text to show when the file is modified.
722 readonly = '[-]', -- Text to show when the file is non-modifiable or readonly.
723 unnamed = '[No Name]', -- Text to show for unnamed buffers.
724 newfile = '[New]', -- Text to show for newly created file before first write
725 }
726 }
727 }
728 }
729 <
730
731
732 *lualine-filetype-component-options*
733
734 >
735 sections = {
736 lualine_a = {
737 {
738 'filetype',
739 colored = true, -- Displays filetype icon in color if set to true
740 icon_only = false, -- Display only an icon for filetype
741 icon = { align = 'right' }, -- Display filetype icon on the right hand side
742 -- icon = {'X', align='right'}
743 -- Icon string ^ in table is ignored in filetype component
744 }
745 }
746 }
747 <
748
749
750 *lualine-encoding-component-options*
751
752 >
753 sections = {
754 lualine_a = {
755 {
756 'encoding',
757 -- Show '[BOM]' when the file has a byte-order mark
758 show_bomb = false,
759 }
760 }
761 }
762 <
763
764
765 *lualine-searchcount-component-options*
766
767 >
768 sections = {
769 lualine_a = {
770 {
771 'searchcount',
772 maxcount = 999,
773 timeout = 500,
774 }
775 }
776 }
777 <
778
779
780 *lualine-tabs-component-options*
781
782 >
783 sections = {
784 lualine_a = {
785 {
786 'tabs',
787 tab_max_length = 40, -- Maximum width of each tab. The content will be shorten dynamically (example: apple/orange -> a/orange)
788 max_length = vim.o.columns / 3, -- Maximum width of tabs component.
789 -- Note:
790 -- It can also be a function that returns
791 -- the value of `max_length` dynamically.
792 mode = 0, -- 0: Shows tab_nr
793 -- 1: Shows tab_name
794 -- 2: Shows tab_nr + tab_name
795
796 path = 0, -- 0: just shows the filename
797 -- 1: shows the relative path and shorten $HOME to ~
798 -- 2: shows the full path
799 -- 3: shows the full path and shorten $HOME to ~
800
801 -- Automatically updates active tab color to match color of other components (will be overidden if buffers_color is set)
802 use_mode_colors = false,
803
804 tabs_color = {
805 -- Same values as the general color option can be used here.
806 active = 'lualine_{section}_normal', -- Color for active tab.
807 inactive = 'lualine_{section}_inactive', -- Color for inactive tab.
808 },
809
810 show_modified_status = true, -- Shows a symbol next to the tab name if the file has been modified.
811 symbols = {
812 modified = '[+]', -- Text to show when the file is modified.
813 },
814
815 fmt = function(name, context)
816 -- Show + if buffer is modified in tab
817 local buflist = vim.fn.tabpagebuflist(context.tabnr)
818 local winnr = vim.fn.tabpagewinnr(context.tabnr)
819 local bufnr = buflist[winnr]
820 local mod = vim.fn.getbufvar(bufnr, '&mod')
821
822 return name .. (mod == 1 and ' +' or '')
823 end
824 }
825 }
826 }
827 <
828
829
830 *lualine-windows-component-options*
831
832 >
833 sections = {
834 lualine_a = {
835 {
836 'windows',
837 show_filename_only = true, -- Shows shortened relative path when set to false.
838 show_modified_status = true, -- Shows indicator when the window is modified.
839
840 mode = 0, -- 0: Shows window name
841 -- 1: Shows window index
842 -- 2: Shows window name + window index
843
844 max_length = vim.o.columns * 2 / 3, -- Maximum width of windows component,
845 -- it can also be a function that returns
846 -- the value of `max_length` dynamically.
847 filetype_names = {
848 TelescopePrompt = 'Telescope',
849 dashboard = 'Dashboard',
850 packer = 'Packer',
851 fzf = 'FZF',
852 alpha = 'Alpha'
853 }, -- Shows specific window name for that filetype ( { `filetype` = `window_name`, ... } )
854
855 disabled_buftypes = { 'quickfix', 'prompt' }, -- Hide a window if its buffer's type is disabled
856
857 -- Automatically updates active window color to match color of other components (will be overidden if buffers_color is set)
858 use_mode_colors = false,
859
860 windows_color = {
861 -- Same values as the general color option can be used here.
862 active = 'lualine_{section}_normal', -- Color for active window.
863 inactive = 'lualine_{section}_inactive', -- Color for inactive window.
864 },
865 }
866 }
867 }
868 <
869
870
871 *lualine-lsp-status-component-options*
872
873 >
874 sections = {
875 lualine_a = {
876 {
877 'lsp_status',
878 icon = '', -- f013
879 symbols = {
880 -- Standard unicode symbols to cycle through for LSP progress:
881 spinner = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' },
882 -- Standard unicode symbol for when LSP is done:
883 done = '✓',
884 -- Delimiter inserted between LSP names:
885 separator = ' ',
886 },
887 -- List of LSP names to ignore (e.g., `null-ls`):
888 ignore_lsp = {},
889 -- Display the LSP name
890 show_name = true,
891 }
892 }
893 }
894 <
895
896
897 ------------------------------------------------------------------------------
898
899 TABLINE ~
900
901 You can use lualine to display components in tabline. The configuration for
902 tabline sections is exactly the same as that of the statusline.
903
904 >
905 tabline = {
906 lualine_a = {},
907 lualine_b = {'branch'},
908 lualine_c = {'filename'},
909 lualine_x = {},
910 lualine_y = {},
911 lualine_z = {}
912 }
913 <
914
915
916 This will show the branch and filename components on top of neovim inside
917 tabline.
918
919 lualine also provides 2 components, buffers and tabs, that you can use to get a
920 more traditional tabline/bufferline.
921
922 >
923 tabline = {
924 lualine_a = {'buffers'},
925 lualine_b = {'branch'},
926 lualine_c = {'filename'},
927 lualine_x = {},
928 lualine_y = {},
929 lualine_z = {'tabs'}
930 }
931 <
932
933
934 WINBAR ~
935
936 From neovim-0.8 you can customize your winbar with lualine. Winbar
937 configuration is similar to statusline.
938
939 >
940 winbar = {
941 lualine_a = {},
942 lualine_b = {},
943 lualine_c = {'filename'},
944 lualine_x = {},
945 lualine_y = {},
946 lualine_z = {}
947 }
948
949 inactive_winbar = {
950 lualine_a = {},
951 lualine_b = {},
952 lualine_c = {'filename'},
953 lualine_x = {},
954 lualine_y = {},
955 lualine_z = {}
956 }
957 <
958
959
960 Just like statusline you can separately specify winbar for active and inactive
961 windows. Any lualine component can be placed in winbar. All kinds of custom
962 components supported in statusline are also supported for winbar too. In
963 general You can treat winbar as another lualine statusline that just appears on
964 top of windows instead of at bottom.
965
966 *lualine-Buffers*
967
968 Buffers Shows currently open buffers. Like
969 bufferline. See
970 |lualine-buffers-options| for all
971 builtin behaviors of buffers component.
972 You can use `:LualineBuffersJump` to
973 jump to buffer based on index of buffer
974 in buffers component. Jumping to
975 non-existent buffer indices generates an
976 error. To avoid these errors
977 `LualineBuffersJump` provides `<bang>`
978 support, meaning that you can call
979 `:LualineBufferJump!` to ignore these
980 errors.
981
982
983 >
984 :LualineBuffersJump 2 " Jumps to 2nd buffer in buffers component.
985 :LualineBuffersJump $ " Jumps to last buffer in buffers component.
986 :LualineBuffersJump! 3 " Attempts to jump to 3rd buffer, if it exists.
987 <
988
989
990 *lualine-Tabs*
991
992 Tabs Shows currently open tab. Like usual
993 tabline. See |lualine-tabs-options| for
994 all builtin behaviors of tabs component.
995 You can also use `:LualineRenameTab` to
996 set a name for a tabpage. For example:
997
998
999 >
1000 :LualineRenameTab Project_K
1001 <
1002
1003
1004 It’s useful when you’re using rendering mode 2/3 in tabs. To unname a
1005 tabpage run `:LualineRenameTab` without argument.
1006
1007 *lualine-Tabline-as-statusline*
1008
1009 Tabline as statusline You can also completely move your
1010 statusline to a tabline by configuring
1011 `lualine.tabline` and disabling
1012 `lualine.sections` and
1013 `lualine.inactive_sections`:
1014
1015
1016 >
1017 tabline = {
1018 ......
1019 },
1020 sections = {},
1021 inactive_sections = {},
1022 <
1023
1024
1025 If you want a more sophisticated tabline you can use other tabline plugins with
1026 lualine too, for example:
1027
1028
1029 - nvim-bufferline <https://github.com/akinsho/nvim-bufferline.lua>
1030 - tabline.nvim <https://github.com/kdheepak/tabline.nvim>
1031
1032
1033 tabline.nvim even uses lualine’s theme by default 🙌 You can find a bigger
1034 list here <https://github.com/rockerBOO/awesome-neovim#tabline>.
1035
1036 ------------------------------------------------------------------------------
1037
1038 EXTENSIONS ~
1039
1040 lualine extensions change statusline appearance for a window/buffer with
1041 specified filetypes.
1042
1043 By default no extensions are loaded to improve performance. You can load
1044 extensions with:
1045
1046 >
1047 extensions = {'quickfix'}
1048 <
1049
1050
1051 *lualine-Available-extensions*
1052
1053
1054 - aerial
1055 - assistant
1056 - avante
1057 - chadtree
1058 - ctrlspace
1059 - fern
1060 - fugitive
1061 - fzf
1062 - lazy
1063 - man
1064 - mason
1065 - mundo
1066 - neo-tree
1067 - nerdtree
1068 - nvim-dap-ui
1069 - nvim-tree
1070 - oil
1071 - overseer
1072 - quickfix
1073 - symbols-outline
1074 - toggleterm
1075 - trouble
1076
1077
1078 *lualine-Custom-extensions*
1079
1080 Custom extensions You can define your own extensions. If
1081 you believe an extension may be useful
1082 to others, then please submit a PR.
1083
1084
1085 >
1086 local my_extension = { sections = { lualine_a = {'mode'} }, filetypes = {'lua'} }
1087 require('lualine').setup { extensions = { my_extension } }
1088 <
1089
1090
1091 ------------------------------------------------------------------------------
1092
1093 REFRESHING LUALINE ~
1094
1095 By default lualine refreshes itself based on timer and some events. You can set
1096 the interval of the timer with refresh option. However you can also force
1097 lualine to refresh at any time by calling `lualine.refresh` function.
1098
1099 >
1100 require('lualine').refresh({
1101 scope = 'tabpage', -- scope of refresh all/tabpage/window
1102 place = { 'statusline', 'winbar', 'tabline' }, -- lualine segment ro refresh.
1103 })
1104 <
1105
1106
1107 The arguments shown here are default values. So not passing any of them will be
1108 treated as if a default value was passed.
1109
1110 So you can simply do
1111
1112 >
1113 require('lualine').refresh()
1114 <
1115
1116
1117 Also, note by default when you call refresh a refresh event is queued in
1118 lualine. It desn’t refresh event immidiately. It’ll refresh on next refresh
1119 check pass. By default this time is set to 16ms to match 60fps. This duration
1120 can be configured with `options.refresh.refresh_time` option. If you want to
1121 bypass the refresh queue and want lualine to process the refresh immmidiately
1122 call refresh with `force=true` parameter set like this.
1123
1124 >
1125 require('lualine').refresh({
1126 force = true, -- do an immidiate refresh
1127 scope = 'tabpage', -- scope of refresh all/tabpage/window
1128 place = { 'statusline', 'winbar', 'tabline' }, -- lualine segment ro refresh.
1129 })
1130 <
1131
1132
1133 Practically, speaking this is almost never needed. Also you should avoid
1134 calling `lualine.refresh` with `force` inside components. Since components are
1135 evaluated during refresh, calling refresh while refreshing can have undesirable
1136 effects.
1137
1138 DISABLING LUALINE ~
1139
1140 You can disable lualine for specific filetypes:
1141
1142 >
1143 options = { disabled_filetypes = {'lua'} }
1144 <
1145
1146
1147 You can also disable lualine completely. Note that you need to call this after
1148 the setup
1149
1150 >
1151 require('lualine').hide({
1152 place = {'statusline', 'tabline', 'winbar'}, -- The segment this change applies to.
1153 unhide = false, -- whether to re-enable lualine again/
1154 })
1155 <
1156
1157
1158 The arguments show for hide above are default values. Which means even if the
1159 hide function is called without arguments it’ll work as if these were passed.
1160
1161 So in short to disable lualine completely you can do
1162
1163 >
1164 require('lualine').hide()
1165 <
1166
1167
1168 To enable it again you can do
1169
1170 >
1171 require('lualine').hide({unhide=true})
1172 <
1173
1174
1175 WIKI ~
1176
1177 Check out the wiki <https://github.com/nvim-lualine/lualine.nvim/wiki> for more
1178 info.
1179
1180 You can find some useful configuration snippets
1181 <https://github.com/nvim-lualine/lualine.nvim/wiki/Component-snippets> here.
1182 You can also share your awesome snippets with others.
1183
1184 If you want to extend lualine with plugins or want to know which ones already
1185 do, wiki/plugins <https://github.com/nvim-lualine/lualine.nvim/wiki/Plugins> is
1186 for you.
1187
1188 Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
1189
1190 vim:tw=78:ts=8:noet:ft=help:norl: