diff --git a/CHANGELOG.md b/CHANGELOG.md index bdf50b9f..e2fc5c36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,9 +49,9 @@ This is the Changelog for the vim-airline project. - The branch extensions now also displays whether the repository is in a clean state (will append a ! or ⚡if the repository is considered dirty). - The whitespace extensions will also check for conflict markers - - `:AirlineRefresh` command now takes an additional `!` attribute, that **skips** + - `:AirlineRefresh` command now takes an additional `!` attribute, that **skips** recreating the highlighting groups (which might have a serious performance - impact if done very often, as might be the case when the configuration variable + impact if done very often, as might be the case when the configuration variable `airline_skip_empty_sections` is active). - airline can now also detect multiple cursor mode (issue [#1933](https://github.com/vim-airline/vim-airline/issues/1933)) - expose hunks output using the function `airline#extensions#hunks#get_raw_hunks()` to the outside [#1877](https://github.com/vim-airline/vim-airline/pull/1877) diff --git a/README.md b/README.md index d69803ee..d45d86cb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# vim-airline +# vim-airline [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/cb%40256bit.org) [![reviewdog](https://github.com/vim-airline/vim-airline/workflows/reviewdog/badge.svg?branch=master&event=push)](https://github.com/vim-airline/vim-airline/actions?query=workflow%3Areviewdog+event%3Apush+branch%3Amaster) diff --git a/autoload/airline.vim b/autoload/airline.vim index 641a3360..a544d37d 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -232,21 +232,21 @@ function! airline#check_mode(winnr) if get(w:, 'airline_active', 1) let m = mode(1) - " Refer :help mode() to see the list of modes - " NB: 'let mode' here refers to the display colour _groups_, + " Refer :help mode() to see the list of modes + " NB: 'let mode' here refers to the display colour _groups_, " not the literal mode's code (i.e., m). E.g., Select modes " v, S and ^V use 'visual' since they are of similar ilk. - " Some modes do not get recognised for status line purposes: + " Some modes do not get recognised for status line purposes: " no, nov, noV, no^V, !, cv, and ce. - " Mode name displayed is handled in init.vim (g:airline_mode_map). - " + " Mode name displayed is handled in init.vim (g:airline_mode_map). + " if m[0] ==# "i" let mode = ['insert'] " Insert modes + submodes (i, ic, ix) - elseif m[0] == "R" + elseif m[0] == "R" let mode = ['replace'] " Replace modes + submodes (R, Rc, Rv, Rx) (NB: case sensitive as 'r' is a mode) elseif m[0] =~ '\v(v|V||s|S|)' let mode = ['visual'] " Visual and Select modes (v, V, ^V, s, S, ^S)) - elseif m ==# "t" + elseif m ==# "t" let mode = ['terminal'] " Terminal mode (only has one mode (t)) elseif m[0] =~ '\v(c|r|!)' let mode = ['commandline'] " c, cv, ce, r, rm, r? (NB: cv and ce stay showing as mode entered from) @@ -257,7 +257,7 @@ function! airline#check_mode(winnr) " Vim plugin Multiple Cursors https://github.com/mg979/vim-visual-multi let m = 'multi' endif - " Adjust to handle additional modes, which don't display correctly otherwise + " Adjust to handle additional modes, which don't display correctly otherwise if index(['niI', 'niR', 'niV', 'ic', 'ix', 'Rc', 'Rv', 'Rx', 'multi'], m) == -1 let m = m[0] endif diff --git a/autoload/airline/extensions/tabline/ctrlspace.vim b/autoload/airline/extensions/tabline/ctrlspace.vim index fad3efe7..feab4603 100644 --- a/autoload/airline/extensions/tabline/ctrlspace.vim +++ b/autoload/airline/extensions/tabline/ctrlspace.vim @@ -33,7 +33,7 @@ endfunction function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pull_right) let pos_extension = (a:pull_right ? '_right' : '') - + let buffer_list = [] for bufferindex in sort(keys(ctrlspace#api#Buffers(a:cur_tab)), 'N') for buffer in ctrlspace#api#BufferList(a:cur_tab) diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index c8b9974a..38c57d07 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -54,7 +54,7 @@ function! airline#extensions#tabline#tabs#get() let group = 'airline_tabsel' if g:airline_detect_modified for bi in tabpagebuflist(curtab) - if index(s:filtered_buflist,bi) != -1 + if index(s:filtered_buflist,bi) != -1 if getbufvar(bi, '&modified') let group = 'airline_tabmod' endif @@ -91,7 +91,7 @@ function! airline#extensions#tabline#tabs#get() if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1 let buffers = tabpagebuflist(curtab) for nr in buffers - if index(s:filtered_buflist,nr) != -1 + if index(s:filtered_buflist,nr) != -1 let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right" call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') endif diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index 59203068..edb7340b 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -91,7 +91,7 @@ endfunction " airline functions {{{1 " default filetypes: function! airline#extensions#wordcount#apply(...) - let filetypes = get(g:, 'airline#extensions#wordcount#filetypes', + let filetypes = get(g:, 'airline#extensions#wordcount#filetypes', \ ['asciidoc', 'help', 'mail', 'markdown', 'nroff', 'org', 'rst', 'plaintex', 'tex', 'text']) " export current filetypes settings to global namespace let g:airline#extensions#wordcount#filetypes = filetypes diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index 20878d8c..f13b68c9 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -32,7 +32,7 @@ function! airline#init#bootstrap() call s:check_defined('g:airline_exclude_filetypes', []) call s:check_defined('g:airline_exclude_preview', 0) - " If g:airline_mode_map_codes is set to 1 in your .vimrc it will display + " If g:airline_mode_map_codes is set to 1 in your .vimrc it will display " only the modes' codes in the status line. Refer :help mode() for codes. " That may be a preferred presentation because it is minimalistic. call s:check_defined('g:airline_mode_map_codes', 0) @@ -45,7 +45,7 @@ function! airline#init#bootstrap() " \ 'Rv' : 'VIRTUAL REPLACE', " \ 'niV' : 'VIRTUAL REPLACE (NORMAL)', " \ } - " ...would override 'Rv' and 'niV' below respectively. + " ...would override 'Rv' and 'niV' below respectively. call extend(g:airline_mode_map, { \ '__' : '------', \ 'n' : 'NORMAL', @@ -78,16 +78,16 @@ function! airline#init#bootstrap() \ '!' : 'SHELL', \ 't' : 'TERMINAL', \ 'multi' : 'MULTI', - \ }, 'keep') - " NB: no*, cv, ce, r? and ! do not actually display + \ }, 'keep') + " NB: no*, cv, ce, r? and ! do not actually display else - " Exception: The control character in ^S and ^V modes' codes - " break the status line if allowed to render 'naturally' so + " Exception: The control character in ^S and ^V modes' codes + " break the status line if allowed to render 'naturally' so " they are overridden with ^ (when g:airline_mode_map_codes = 1) call extend(g:airline_mode_map, { \ '' : '^V', \ '' : '^S', - \ }, 'keep') + \ }, 'keep') endif call s:check_defined('g:airline_theme_map', {}) diff --git a/autoload/airline/themes/dark.vim b/autoload/airline/themes/dark.vim index 5e744d52..927cef61 100644 --- a/autoload/airline/themes/dark.vim +++ b/autoload/airline/themes/dark.vim @@ -11,7 +11,7 @@ scriptencoding utf-8 " * airline_x (first section of the right most sections) " * airline_y (section just to the right of airline_x) " * airline_z (right most section) -" * The mode of the buffer, as reported by the :mode() function. Airline +" * The mode of the buffer, as reported by the :mode() function. Airline " converts the values reported by mode() to the following: " * normal " * insert @@ -22,7 +22,7 @@ scriptencoding utf-8 " The last one is actually no real mode as returned by mode(), but used by " airline to style inactive statuslines (e.g. windows, where the cursor " currently does not reside in). -" * In addition to each section and mode specified above, airline themes +" * In addition to each section and mode specified above, airline themes " can also specify overrides. Overrides can be provided for the following " scenarios: " * 'modified' @@ -34,7 +34,7 @@ scriptencoding utf-8 " * g:airline#themes##palette " where is substituted for the name of the theme.vim file where the " theme definition resides. Airline themes should reside somewhere on the -" 'runtimepath' where it will be loaded at vim startup, for example: +" 'runtimepath' where it will be loaded at vim startup, for example: " * autoload/airline/themes/theme_name.vim " " For this, the dark.vim, theme, this is defined as @@ -42,12 +42,12 @@ let g:airline#themes#dark#palette = {} " Keys in the dictionary are composed of the mode, and if specified the " override. For example: -" * g:airline#themes#dark#palette.normal +" * g:airline#themes#dark#palette.normal " * the colors for a statusline while in normal mode -" * g:airline#themes#dark#palette.normal_modified +" * g:airline#themes#dark#palette.normal_modified " * the colors for a statusline while in normal mode when the buffer has " been modified -" * g:airline#themes#dark#palette.visual +" * g:airline#themes#dark#palette.visual " * the colors for a statusline while in visual mode " " Values for each dictionary key is an array of color values that should be @@ -56,7 +56,7 @@ let g:airline#themes#dark#palette = {} " See "help attr-list" for valid values for the "opt" value. " " Each theme must provide an array of such values for each airline section of -" the statusline (airline_a through airline_z). A convenience function, +" the statusline (airline_a through airline_z). A convenience function, " airline#themes#generate_color_map() exists to mirror airline_a/b/c to " airline_x/y/z, respectively. diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index b0973cf8..b62b652c 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -137,7 +137,7 @@ endfunction function! airline#util#ignore_buf(name) let pat = '\c\v'. get(g:, 'airline#ignore_bufadd_pat', ''). - \ get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', + \ get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', \ '!|defx|gundo|nerd_tree|startify|tagbar|term://|undotree|vimfiler') return match(a:name, pat) > -1 endfunction diff --git a/doc/airline.txt b/doc/airline.txt index d2a63ac2..295ad6c1 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -1546,7 +1546,7 @@ State indicators: * use vimtex specific wordcount function for TeX buffers Note: this more accurate but may slow down Vim) > - let g:airline#extensions#vimtex#wordcount = 1 + let g:airline#extensions#vimtex#wordcount = 1 ------------------------------------- *airline-virtualenv* virtualenv diff --git a/test/builder.vimspec b/test/builder.vimspec index 8a1309d9..8872fa63 100644 --- a/test/builder.vimspec +++ b/test/builder.vimspec @@ -3,20 +3,20 @@ Describe builder.vim Before each let s:builder = airline#builder#new({'active': 1}) End - + It should start with an empty statusline let stl = s:builder.build() Assert Equals(stl, '') End - + It should transition colors from one to the next call s:builder.add_section('Normal', 'hello') call s:builder.add_section('Search', 'world') let stl = s:builder.build() Assert Match(stl,'%#Normal#hello%#Normal_to_Search#%#Search#world') End - - + + It should reuse highlight group if background colors match highlight Foo1 ctermfg=1 ctermbg=2 highlight Foo2 ctermfg=1 ctermbg=2 @@ -25,8 +25,8 @@ Describe builder.vim let stl = s:builder.build() Assert Match(stl, '%#Foo1#helloworld') End - - + + It should switch highlight groups if foreground colors differ highlight Foo1 ctermfg=1 ctermbg=2 highlight Foo2 ctermfg=2 ctermbg=2 @@ -35,13 +35,13 @@ Describe builder.vim let stl = s:builder.build() Assert Match(stl, '%#Foo1#hello%#Foo1_to_Foo2#%#Foo2#world') End - + It should split left/right sections call s:builder.split() let stl = s:builder.build() Assert Match(stl, '%=') End - + It after split, sections use the right separator call s:builder.split() call s:builder.add_section('Normal', 'hello') @@ -49,33 +49,33 @@ Describe builder.vim let stl = s:builder.build() Assert Match(stl, 'hello%#Normal_to_Search#%#Search#world') End - + It should not repeat the same highlight group call s:builder.add_section('Normal', 'hello') call s:builder.add_section('Normal', 'hello') let stl = s:builder.build() Assert Match(stl, '%#Normal#hellohello') End - + It should replace accent groups with the specified group call s:builder.add_section('Normal', '%#__accent_foo#hello') let stl = s:builder.build() Assert Match(stl, '%#Normal#%#Normal_foo#hello') End - + It should replace two accent groups with correct groups call s:builder.add_section('Normal', '%#__accent_foo#hello%#__accent_bar#world') let stl = s:builder.build() Assert Match(stl, '%#Normal_foo#hello%#Normal_bar#world') End - + It should special restore group should go back to previous group call s:builder.add_section('Normal', '%#__restore__#') let stl = s:builder.build() Assert NotMatch(stl, '%#__restore__#') Assert Match(stl, '%#Normal#') End - + It should blend colors from the left through the split to the right call s:builder.add_section('Normal', 'hello') call s:builder.split()