Ray
Ray

Reputation: 410

The meaning of the status bar (trailing, mixed-indent, mix-indent-file) in vim

vim

I was wondering what is the meaning of the orange part in the status bar?

☲ [573]trailing [515]mixed-indent [515:514]mix-indent-file

I am using a .vimrc downloaded from the web, so I am not sure what configuration it has. Could anyone kindly explain?

Upvotes: 7

Views: 4177

Answers (3)

CH.
CH.

Reputation: 606

The existing answers have explained how to disable it and how to find information, but here's some more specific information.

Assuming it is vim-airline (since it does look identical to my vim-airline), this is its whitespace extension that checks for whitespace inconsistencies. Details can be found by running :h airline-whitespace.


Now, for the specific messages.

  • [573]trailing means that you have trailing whitespace on line 573, meaning that there are spaces/tabs/other whitespace following the last non-whitespace character on that line.

  • [515]mixed-indent means that line 515 has indentation with both tabs and spaces. For example, writing spaces as + and tabs as | >, line 515 might begin with | >| >++++++. This looks like a C source file where it is common to have indentation with tabs followed by spaces to align, like

    // how it looks           // with whitespace displayed
    while (1) {               // while (1) {
        some_func_call(arg1,  // |  >some_func_call(arg1,
                       arg2); // |  >+++++++++++++++arg2);
    }                         // }
    

    By default vim-airline detects this an error, but has a mode that allows this (let g:airline#extensions#whitespace#mixed_indent_algo = 2). More details can be found at :h airline-whitespace.

  • [515:514]mix-indent-file means that different lines (in this case 515 and 514) have different styles of indentation. Line 515 might be indented with tabs while 514 is indented with spaces, for example.


Every project/setup/language has different ideas of what kind of whitespace use is acceptable and what kind is not, and the whitespace extension is well customizable to suit specific needs. These options are once again found in :h vim-airline.

Upvotes: 8

user13842420
user13842420

Reputation: 21

Just put let g:airline#extensions#whitespace#enabled = 0 in your .vimrc to disable it.

For the detail you can see the help pages with ":h airline-whitespace".

Upvotes: 2

D. Ben Knoble
D. Ben Knoble

Reputation: 4703

Foreword: this type of question is why most vimmers recommending crafting your own configuration piece-by-piece. Then you know all the pieces (and it’s 10x easier to debug).

Now, the meat: that looks like airline (since you don’t know, I can only guess). If so, running :help airline or checking out their GitHub page should explain that it has to do with trailing whitespace and mixed-tabs-and-spaces indents.

Upvotes: 2

Related Questions