2

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

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'])
  else
    let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr',  ':%3v'])
  endif

(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'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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