When vim is split into different panes horizontally, each pane has its own statusline. It's easy to highlight the statuslines differently based on current and non-current panes. BUT, I cannot figure out how to set different values for StatusLine and StatusLineNC. Only the former is recognized by vim/neovim.

My plan is replace the values of non-active statuslines with em-dashes, making it look like a line-divider between panes. The active pane will have a conventional statusline with the a filepath, columns, row, etc.

How do you set separate values for them? Is this possible? Suggestions?

Bonus question: how can you repeat a single char through a statusline?

  • StatusLine and the NC variant are highlight groups; if you are referring to the 'statusline' option, Im afraid there is only one. – D. Ben Knoble Aug 9 at 22:04
  • 2
    correct, and there is no need for another option. You would set the statusline option to a function that checks what is the current window and returns the content for each statusline. This is basically what vim-airline does – Christian Brabandt Aug 10 at 6:24
  • Trying to make Christian's comment more noob-friendly: you can tell vim to show what you want based on the current status of split with BufEnter and BufLeave autocommands. Suggesting looking into from @ChristianBrabandt – Enan Ajmain Aug 10 at 14:28
  • Thanks, all insightful answers! I see now that this is possible, albeit a little cumbersome. I'll need some actual understanding of vimscript, so I've started reading "Learning Vimscript the hard way". I'll post the solution once I'm done. – Audun Olsen Aug 10 at 23:48

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.