I am okay with rest of the section z but I want to remove ㏑ : 1 from the default section z configuration because I think it's not useful for me and takes up the space unnecessarily. Is there a way of doing this?

1 Answer 1


You can inspect the default value of g:airline_section_z by issuing :echo g:airline_section_z. Note, this includes already the bold accents.

In airline, the default is set to:

  if airline#util#winwidth() > 79
    let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
    let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr',  ':%3v'])

(where spc means Space, and it depends on the terminal width, which parts are included).

So you can customize this by setting the g:airline_section_z variable. Unfortunately, since by the time the vimrc file is read, vim-airline has not been read yet, so you need to postpone configuring the variable until vim-airline has been read. For that purpose, vim-airline exposes the AirlineAfterInit autocommand event.

Putting it all together, you would want to configure your section like this in your .vimrc:

au User AirlineAfterInit  :let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%', 'maxlinenr', ' :%3v'])

or for a very simple one:

au User AirlineAfterInit  :let g:airline_section_z = airline#section#create(['%3p%% %L:%3v'])

For the meanings of the %-expandos have a look at :h 'statusline'

  • This does not seem up-do-date anymore, because I get E121: Undefined variable: spc E116: Invalid arguments for function airline#section#create E15: Invalid expression: airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v']) when I copy what is claimed to be default in this answer. Furthermore, if I use the echo command, in my case g:airline_section_z is set to: %p%% %#__accent_bold#%{g:airline_symbols.linenr}%l%#__restore__#%#__accent_bold#/%L%{g:airline_symbols.maxlinenr}%#__restore__#:%v Mar 25, 2021 at 6:54
  • @PhilippLudwig the variable spc is not defined. You need to define it before using it. Mar 26, 2021 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.