hrokr
hrokr

Reputation: 3569

How do I remove duplicates from vim :scriptnames file?

I'm trying to learn vim. When I open the program I'm met with this:

The airline statusline funcref function('airline#extensions#mundo#statusline') has already been added.The airline statusline funcref function('airline#extensions#mundo#statusline') has already been added.

The owner said:

that error message suggests that you have airline installed twice...

did you install airline globally as well as via vundle or something? what does :scriptnames tell you? thanks.

Which was the case for the OP and what looks to be for me too. I ran :scriptnames and got the following references to airline:

 56: ~/.vim/bundle/vim-airline/plugin/airline.vim
 57: ~/.vim/bundle/vim-airline/autoload/airline.vim
 58: ~/.vim/bundle/vim-airline/autoload/airline/init.vim
 59: ~/.vim/bundle/vim-airline/autoload/airline/parts.vim
 60: ~/.vim/bundle/vim-airline-themes/plugin/airline-themes.vim

 78: ~/.vim/bundle/vim-airline/autoload/airline/extensions.vim
 79: ~/.vim/bundle/vim-airline/autoload/airline/extensions/quickfix.vim
 80: ~/.vim/bundle/vim-airline/autoload/airline/extensions/netrw.vim
 81: ~/.vim/bundle/vim-airline/autoload/airline/extensions/ctrlp.vim
 82: ~/.vim/bundle/vim-airline/autoload/airline/extensions/commandt.vim
 83: ~/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim
 84: ~/.vim/bundle/vim-airline/autoload/airline/extensions/syntastic.vim
 85: ~/.vim/bundle/vim-airline/autoload/airline/extensions/whitespace.vim
 86: ~/.vim/bundle/vim-airline/autoload/airline/extensions/wordcount.vim
 87: ~/.vim/bundle/vim-airline/autoload/airline/extensions/tmuxline.vim
 88: ~/.vim/bundle/vim-mundo/autoload/airline/extensions/mundo.vim
 89: ~/.vim/bundle/vim-airline/autoload/airline/section.vim
 90: ~/.vim/bundle/vim-airline/autoload/airline/highlighter.vim
 91: ~/.vim/bundle/vim-airline/autoload/airline/themes/dark.vim
 92: ~/.vim/bundle/vim-airline/autoload/airline/themes.vim
 93: ~/.vim/bundle/vim-airline/autoload/airline/util.vim

 99: ~/.vim/bundle/vim-airline/autoload/airline/builder.vim
 100: ~/.vim/bundle/vim-airline/autoload/airline/extensions/default.vim

What I don't know (and what I think I need help with) is the location of the file :scriptnames references and how to remove duplicates.

Thanks for your thoughts.

Upvotes: 2

Views: 585

Answers (3)

Oleg Kokorin
Oleg Kokorin

Reputation: 2690

vim-airline module is adding multiple status line functions from the various plugins.

it's actually correctly handling if the function has been attempted to be added twice to the statusline right inside the airline#add_statusline_funcref

so the simplest solution would be to comment out warning in the file until the behavior algo will be solved correctly:

/usr/share/vim/addons/autoload/airline.vim

function! airline#add_statusline_funcref(function)
  if index(g:airline_statusline_funcrefs, a:function) >= 0
"    echohl WarningMsg
"    echo 'The airline statusline funcref '.string(a:function).' has already been added.'
    echohl NONE
    return
  endif
  call add(g:airline_statusline_funcrefs, a:function)
endfunction

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172698

Most Vim plugins consist of several script files. It is therefore normal to see multiple references in :scriptnames. In your output, the base Airline directory is ~/.vim/bundle/vim-airline; all of these base directories have a common substructure under them (usually autoload/... and plugin/...).

What the owner meant was to check for multiple base directories, e.g. both ~/.vim/bundle/vim-airline and ~/.vim/bundle/vim-another-airline. Based on your output, that doesn't seem to be the case. Also, the error is about the Mundo extension for Airline, not Airline itself. Shouldn't you then look for multiple installations of Mundo?!

Upvotes: 2

dlmeetei
dlmeetei

Reputation: 10391

If you have two same plugins installed, you need to uninstall vim-airline. You will be having two lines of Plugin vim-airlines or something similar in vimrc. The exact names for plugins might be different. Delete any duplicate lines and run

:PluginUpdate
:PluginClean

Hope this helps

Upvotes: 1

Related Questions