whitesiroi
whitesiroi

Reputation: 2843

Duplicating path to file in command line of VIM

I'm using VIM with NerdTREE and sometimes I get 2x,3x same paths in command line:

/vagrant/pr/app/Config/feeds-import.yaml/vagrant/pr/app/Config/feeds-import.yaml

sometimes:

/vagrant/pr/app/somefile.php/vagrant/pr/app/somefile.php/vagrant/pr/app/somefile.php

I have this lines in my .vimrc:

set laststatus=2
set statusline+=%F

" Auto change the directory to the current file I'm working on
autocm BufEnter * if expand('%:p') !~ '://' | cd %:p:h | endif

How can I fix it? or maybe there is a way to reload command line - so it shows only 1 path to a file?

Upvotes: 0

Views: 33

Answers (1)

romainl
romainl

Reputation: 196556

This line in your vimrc:

set statusline+=%F

appends the file path to the current statusline.

If you keep re-sourcing your vimrc that line is executed again and again.

I suggest the following instead:

set statusline=%F

Upvotes: 3

Related Questions