I want to see the current statusline definition/string as loaded by Vim. So, taking into account :help statusline, if it is the default, the output would be empty, but if ruler is set (and nothing more) the output would be:

%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P

I have tried :echo statusline but I get there is no such variable and I have tried :echo $statusline, but it does not appear any output.

  • Welcome to vi SE. Use :set option? or :echo &option to see the value of option.
    – Friedrich
    May 31, 2023 at 7:28
  • 2
    @iago you need to replace option by the actual option-name, e.g. in your case: :echo &statusline May 31, 2023 at 7:46
  • 1
    Well, you would substitute option with the name of the option you're interested in. Try :set statusline?. You should at least see statusline= (and nothing more) if statusline is not set.
    – Friedrich
    May 31, 2023 at 7:47
  • 1
    Thanks both! @Friedrich I see indeed statusline= with :set statusline?, however I have set ruler in my .vimrc and therefore I have a statusline.
    – iago
    May 31, 2023 at 7:50
  • 1
    The ruler is something different than the statusline however May 31, 2023 at 7:51

1 Answer 1


:help 'rulerformat' and :help 'statusline' are both clear about this: their default value is empty. If the user doesn't set them explicitly (or implicitly, via some plugin), then some internal routine is used, which is not exposed to the user in any way and is unlikely to even look like statusline or rulerformat.

More generally, you can print the value of an option in the command-line with :help :set:

:set optionname?

or with :help :echo:

:echo &optionname

Note that these commands may have slightly different output.

In this case, both commands would do:

:set statusline?
:echo &statusline

You can also prepend :help :verbose to :set, which will tell you where the option was last set:

:verbose set statusline?

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.