I'm new to vim so I'm not sure if this is intended behavior or not, but it seems like a bug.

Desired Behavior

After sourcing vimrc from within nvim, don't duplicate the contents of my statusline. Or at the very least, provide a way to reset my statusline.

Bug Description

Whenever I do :source ~/.vim/vimrc, the contents of my statusline gets duplicated, like this:

nvim statusline filename duplicated after sourcing vimrc

If I source vimrc once I'll get [No Name][No Name], if I source it again I get [No Name][No Name][No Name], and so on. It doesn't reset until I quit and open nvim again.

How to Reproduce Error

An example vimrc ~/.vim/vimrc_ex:

set statusline+=%.35f

That's it. Now open with nvim -u ~/.vim/vimrc_ex and do :source ~/.vim/vimrc_ex.

1 Answer 1


When you use the += operator, you actually ask vim to append some new values to the statusline variable. When you first open Vim statusline is set to an emtpy value so adding %.35f to it give you the expected behavior.

However when you source your config again, nothing empties the variable so you keep adding duplicate values to it. Thus you probably want to add

set statusline=


set statusline+=%.35f

This way you initialize your statusline to an empty value every time you source your configuration and when you append new stuff to the variable with += you don't create duplicates.


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.