2

When splitting the editor window, the caret symbols appear in the status line of the current window.

carets in status line

This happens when StatusLine and StatusLineNC have the same highlighting. For example, when cterm=none ctermfg=white ctermbg=black is set for both of them.

How to prevent the symbols to appear while preserving the same highlighting for both status lines?

  • 3
    "How to prevent this indicator to appear?" - Of course, you could set StatusLine and StatusLineNC differently. – Mass Apr 9 '18 at 14:33
3

This is the standard behaviour of Vim. If StatusLine and StatusLineNC have the same highlighting, the program will use the caret character (^) in the status line of the current window (in order to highlight it).

This behaviour cannot be changed. The only thing that can be done is to change the caret to something else by the use of the fillchars option. Like this: set filchars=stl:+,stlnc:-. That way the current window and non-current windows will be marked by pluses and minuses in their status lines.

Unfortunately, setting spaces as the values of stl and stlnc doesn't affect the situation in the given circumstances. If Vim sees non-printable characters in the fillchars values and there is no other way to differentiate windows, it adds carets to the status line of the current window automatically (and the equal signs to non-current windows if set highlight+=Sn).

Despite what was said before, there actually is a trick, which allows to have the same highlighting in status lines without carets to appear.

The thing is that Vim considers that current and non-current status line highlights are the same if both terminal and GUI colors match. When working in a terminal, you don't care what GUI colors are. So, they can be freely changed without affecting the editor look.

For example:

highlight StatusLine   cterm=none ctermfg=white ctermbg=black guibg=red
highlight StatusLineNC cterm=none ctermfg=white ctermbg=black guibg=green

That way Vim won't consider that status lines are the same and won't add any indication to the status line of the current window.

Strangely, this trick doesn't work for the GUI version of the editor. When setting the same GUI foreground and background colors for both status lines along with different terminal background colors, carets still appear.

Relevant information

:help hl-StatusLineNC
---------------------

Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line
of the current window.
:help 'fillchars'
-----------------

Characters to fill the statuslines and vertical separators. It is a comma
separated list of items:

  item     default     Used for
  stl:c    ' ' or '^'  statusline of the current window
  stlnc:c  ' ' or '='  statusline of the non-current windows
  ...
:help status-line
-----------------

Normally, inversion is used to display the status line. This can be changed
with the 's' character in the 'highlight' option. For example, "sb" sets it
to bold characters.

If no highlighting is used for the status line ("sn"), the '^' character is
used for the current window, and '=' for other windows.
:help 'highlight'
-----------------

This option can be used to set highlighting mode for various occasions. It
is a comma separated list of character pairs. The first character in a pair
gives the occasion, the second the mode to use for that occasion.

The occasions are:

  s  status line of current window
  S  status lines of not-current windows
  ...

The display modes are:

  n  no highlighting
  ...

Links

https://stackoverflow.com/questions/7223309/vim-statusline-uses-carret-symbols-for-spaces-how-to-switch-to-spaces

https://github.com/arcticicestudio/nord-vim/issues/37

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.