I am editing a lot of files with Vim, and I have the following in my .vimrc to help me stay oriented as to which file I am in:

" Add file name to statusline so we know where we are in the slideshow
set statusline+=%f

I recently started using mdless to render the Markdown files in Vim Terminal (:terminal); it's working great except Terminal overwrites my statusline setting. Is there way to keep Terminal's paws off the statusline? :)

The built-in help on Terminal says:

In Terminal-Normal mode the statusline and window title show "(Terminal)". If the job ends while in Terminal-Normal mode this changes to "(Terminal-finished)".

It's hard to believe this isn't configurable... just about everything else is. :)

How to reproduce

Given a file vimrc with the following content:

" Make status line visible
set laststatus=2
" Add file name to statusline so we know where we are in the slideshow
set statusline+=%f

Start vim using this vimrc:

vim -u vimrc vimrc

and it will show "vimrc" on a status line, on 2nd line from the bottom.

Now run:

:term++curwin cat vimrc

and that changes that 2nd line from the bottom to say

!cat vimrc [finished]                                                                                                                                 

Also its color changes, from white to green.

  • 1
    I assume you are talking about :terminal when you say “Vim Terminal”?
    – D. Ben Knoble
    Jan 15, 2021 at 13:13
  • Yes, quite right. Jan 15, 2021 at 21:15
  • I can't really reproduce it... The status line in the terminal is different and doesn't really obbey the 'statusline' setting, but I don't see the value of 'statusline' actually changing when :terminal is executed. Can you provide more details on what you're seeing?
    – filbranden
    Jan 15, 2021 at 22:06
  • Or do you mean that you would like to override what the status line shows for a :terminal window and 'statusline' doesn't actually do that? Are you looking for a way to configure what the status line shows there, is that it?
    – filbranden
    Jan 15, 2021 at 22:07
  • 1
    I added a "How to reproduce" section @filbranden Thanks! Jan 15, 2021 at 23:29

1 Answer 1


This is just normal. %f stands for current buffer's name (:h bufname()) and it gets inserted as is, i.e. !cat vimrc, plus status, i.e. [finished].

To change terminal's buffer name

 call term_start('cat vimrc', {'term_name': 'foobar'})

To setup status line for terminal windows only

augroup test | au!
    autocmd TerminalWinOpen * setlocal statusline=foobar
augroup end

The colors are also per default. For regular buffers it's StatusLine/StatusLineNC, and for terminal buffers - StatusLineTerm/StatusLineTermNC.

To change your colorscheme

colorscheme foobar

To change individual highlighting group settings

augroup test | au!
    autocmd ColorScheme * hi! link StatusLineTerm StatusLine
    autocmd ColorScheme * hi! link StatusLineTermNC StatusLineNC
augroup end

To overwrite highlighting group by status line

set statusline=%#StatusLine#%f

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.