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.
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?!
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
Related
I can't work this out, I thought vimrc_example.vim was an example file but turns out Vim is reading this file for some reason as well as _vimrc.
On windows 10 Home with Vim 8.2.24 not using gvim but vim.
The directory of both these files are:
C:\Program Files\Vim\_vimrc
C:\Program Files\Vim\vim82\vimrc_example.vim
When I delete vimrc_example.vim it does not start Vim properly then, it just starts with a blank screen then I have to push enter to start up vim. Somewhere my vim is telling it to read this file I just don't understand the how and why as I am new to vim.
The reason I realised this is I was trying to set tw=0 via _vimrc but turned out vimrc_example.vim kept overriding this and setting it back to 78. I have tried to google a solution to this, but I just thought common sense wise an example file should not be this relevant and if it is why?
Output of :scriptnames
1: C:\Program Files\Vim\_vimrc
2: C:\Program Files\Vim\vim82\vimrc_example.vim
3: C:\Program Files\Vim\vim82\defaults.vim
4: C:\Program Files\Vim\vim82\syntax\syntax.vim
5: C:\Program Files\Vim\vim82\syntax\synload.vim
6: C:\Program Files\Vim\vim82\syntax\syncolor.vim
7: C:\Program Files\Vim\vim82\filetype.vim
8: C:\Program Files\Vim\vim82\ftplugin.vim
9: C:\Program Files\Vim\vim82\indent.vim
10: C:\Program Files\Vim\vim82\autoload\plug.vim
11: C:\Program Files\Vim\vim82\ftoff.vim
12: C:\Program Files\Vim\vim82\syntax\nosyntax.vim
13: ~\.vim\plugged\vim-monokai\colors\monokai.vim
14: ~\.vim\plugged\vim-wakatime\plugin\wakatime.vim
15: ~\.vim\plugged\vim-airline\plugin\airline.vim
16: ~\.vim\plugged\vim-airline\autoload\airline\init.vim
17: ~\.vim\plugged\vim-airline\autoload\airline\parts.vim
18: ~\.vim\plugged\vim-airline\autoload\airline\util.vim
19: ~\.vim\plugged\vim-airline-themes\plugin\airline-themes.vim
20: ~\.vim\plugged\vim-clang-format\plugin\clang_format.vim
21: ~\.vim\plugged\vim-gitgutter\plugin\gitgutter.vim
22: ~\.vim\plugged\vim-gitgutter\autoload\gitgutter\utility.vim
23: ~\.vim\plugged\vim-gitgutter\autoload\gitgutter\highlight.vim
24: ~\.vim\plugged\vim-gitgutter\autoload\gitgutter\async.vim
25: ~\.vim\plugged\DrawIt\plugin\cecutil.vim
26: ~\.vim\plugged\DrawIt\plugin\DrawItPlugin.vim
27: C:\Program Files\Vim\vim82\plugin\getscriptPlugin.vim
28: C:\Program Files\Vim\vim82\plugin\gzip.vim
29: C:\Program Files\Vim\vim82\plugin\logiPat.vim
30: C:\Program Files\Vim\vim82\plugin\manpager.vim
31: C:\Program Files\Vim\vim82\plugin\matchparen.vim
32: C:\Program Files\Vim\vim82\plugin\netrwPlugin.vim
33: C:\Program Files\Vim\vim82\plugin\rrhelper.vim
34: C:\Program Files\Vim\vim82\plugin\spellfile.vim
35: C:\Program Files\Vim\vim82\plugin\tarPlugin.vim
36: C:\Program Files\Vim\vim82\plugin\tohtml.vim
37: C:\Program Files\Vim\vim82\plugin\vimballPlugin.vim
38: C:\Program Files\Vim\vim82\plugin\zipPlugin.vim
39: C:\Program Files\Vim\vim82\pack\dist\opt\matchit\plugin\matchit.vim
40: ~\.vim\plugged\vim-airline\autoload\airline\extensions.vim
41: ~\.vim\plugged\vim-airline\autoload\airline\extensions\quickfix.vim
42: ~\.vim\plugged\vim-airline\autoload\airline.vim
43: ~\.vim\plugged\vim-airline\autoload\airline\extensions\netrw.vim
44: ~\.vim\plugged\vim-airline\autoload\airline\extensions\term.vim
45: ~\.vim\plugged\vim-airline\autoload\airline\section.vim
46: ~\.vim\plugged\vim-airline\autoload\airline\highlighter.vim
47: ~\.vim\plugged\vim-airline\autoload\airline\extensions\hunks.vim
48: ~\.vim\plugged\vim-airline\autoload\airline\extensions\whitespace.vim
49: ~\.vim\plugged\vim-airline\autoload\airline\extensions\wordcount.vim
50: ~\.vim\plugged\vim-airline\autoload\airline\extensions\keymap.vim
51: ~\.vim\plugged\vimtex\autoload\vimtex.vim
52: ~\.vim\plugged\vim-airline\autoload\airline\extensions\vimtex.vim
53: ~\.vim\plugged\vim-airline-themes\autoload\airline\themes\molokai.vim
54: ~\.vim\plugged\vim-airline\autoload\airline\themes.vim
55: ~\.vim\plugged\vim-airline\autoload\airline\builder.vim
56: ~\.vim\plugged\vim-airline\autoload\airline\extensions\default.vim
57: ~\.vim\plugged\vim-gitgutter\autoload\gitgutter.vim
58: ~\.vim\plugged\vim-gitgutter\autoload\gitgutter\hunk.vim
https://i.gyazo.com/7ca9c5002ec1f95aa545c859b498cba5.png
Files:
_vimrc located in C:\program files\Vim\_vimrc:
http://dpaste.com/202QAN3
vimrc_example.vim located in C:\Program Files\Vim\vim82:
http://dpaste.com/2MWVY7V
You see I would think you could delete vimrc_example but not sure if it is doing anything important?????? Please refer to the specific line numbers if you wish to point out anything incorrect.
Your C:\Program Files\Vim\_vimrc has this on line 7:
" Vim with all enhancements
source $VIMRUNTIME/vimrc_example.vim
That's what's sourcing the vimrc_example.vim file. So it looks like you added this there, or copied it from somewhere (perhaps a guide or tip you found on the web?) or this _vimrc file is one you downloaded (or came with a Vim distribution you installed?) and had this in it already.
Anyways, that should explain why vimrc_example.vim is being sourced.
If you don't want that behavior anymore, you can either:
Remove that source command from C:\Program Files\Vim\_vimrc
Or, if you don't want to modify that specific _vimrc file (because it came with a distro or similar), then you can instead start using a _vimrc file from a different location (note that this one corresponds to the one listed as "3rd user vimrc file" in the :version output, you could use $HOME/_vimrc or $HOME/vimfiles/vimrc that come before it.)
Note that the vimrc_example.vim file is not really originally meant to be sourced this way... Instead, it's meant to be a template for you to copy to your own _vimrc that you can then modify to your taste. So while you'll probably be fine with sourcing it, it's not how it was meant to be used.
You'll also note that the vimrc_example.vim file doesn't actually have a lot of commands itself... But a lot of what it does is actually coming from defaults.vim that is sourced from it. Please note that the defaults.vim file is meant to be sourced from your vimrc (see :help defaults.vim for more details.)
So you might want to consider swapping the sourcing of vimrc_example.vim with the sourcing of defaults.vim. Additionally, if you like some of the other settings from vimrc_example.vim (such as enabling backup and undofile), consider replicating those into your vimrc.
A simple work flow I often use when running an rspec test I have just been working on, in vim, is as follows:
15: it "my example test" do
16: expect(1 == 1).to be true
17: end
And to run this test, you can do:
!rspec %:15
This runs rspec as an external command. % expands to the current filename, and :15 tells rspec to only run the test line 15, rather than all tests in the file.
This technique works fine under normal circumstances. However, if you try to run a test on lines 80-89 then something strange happens:
84: it "my other test" do
85: expect(4 > 3).to be false
86: end
!rspec %:84
This runs the command rspec [filename]4 - i.e. the :8 characters disappear! (And you get a "file not found" error.)
A workaround to avoid this problem is to press TAB after entering %, which immediately expands % to the full path name.
However, what's the reason behind this strange vim behaviour? Is it a bug, or a feature?
A different, related question led me to finding the answer to this.
You can find the answer, along with more detail, by running :help filename-modifiers in vim. Here is a summary of the key point:
The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<sfile>", "<afile>" or "<abuf>".
:8 Converts the path to 8.3 short format (currently only on MS-Windows). Will act on as much of a path that is an existing path.
8 is the only numerical filename-modifier. If you wish to disable this feature entirely, you can compile vim without the +modify_fname feature.
I used this command
for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done
to remove whitespaces in /home/user and now vim tells me this:
Error detected while processing /home/user/.vimrc:
line 2:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
line 3:
E117: Unknown function: pathogen#helptags
line 10:
E185: Cannot find color scheme 'solarized'
Press ENTER or type command to continue
can this be related?
I already reinstalled pathogen but everythink seems fine for me.
If pathogen expects to find (not dot-) files in your home directory with spaces in them, this would definitely confuse it. I don't know anything about pathogen, but I sure hope it doesn't expect that. Look for pathogen- or vim-related files that may have been renamed.
Starting up vim and then No mapping found shows up at bottom.
running the command: vim -V20logfile
line 3: redir => res
line 4: silent! execute a:cmd
line 5: redir END
line 6: let &verbosefile = oldverbosefile
I had the same issue.
I commented out all maps, thinking they were all fine. Sure enough, vim loaded without err.
Then, I reintroduced the mappings until one broke it. Sure enough I had left out the space between the lhs and the rhs. As soon as I corrected this, it worked perfectly again.
I found the best way to debug your .vimrc is to enable the debug and pip it to a log file. Examine the file and search for the error.
If the error you are receiving is " no mapping found", open the log file and search for the these words.
:/no mapping found.
It will show you where the error is coming from. In my case I found that the error is from a plugin I installed. I disabled it and it works fine again.
Run the following command at the prompt:
vim -V20 2>&1 | tee logfile
I have put new javascript syntax and indent files in my 'bundle' directory (I use Pathogen). I noticed that VIM loads both my new files as well as the standard files, in particular it loads the standard files after and I fear it may be overwriting the custom ones.
The VIM docs says it should not load the standard files if it found custom one first so I am not sure why this is happening.
This is what I see with the :scriptnames command, you can see the standard files (line 32, 35) after the customer ones (line 31, 34)
31: /usr/share/vim/vimfiles/bundle/vim-javascript/syntax/javascript.vim
32: /usr/share/vim/vim73/syntax/javascript.vim
33: /usr/share/vim/vim73/ftplugin/javascript.vim
34: /usr/share/vim/vimfiles/bundle/vim-javascript/indent/javascript.vim
35: /usr/share/vim/vim73/indent/javascript.vim
It's fine that both the system-default and your custom syntax files appear in the :scriptnames output. Vim will source all files found in 'runtimepath', but the canonical include guard
if exists("b:current_syntax")
will cause all scripts running after the first to abort immediately after the check.