Valloric/YouCompleteMe plugin for Vim - vim

After installing the Valloric/YouCompleteMe plugin via Vundle I get the following error when I start up vim. I had no issues running the ./install.py script.
File "<string>", line 19, in <module>
File "/Users/simonorlovsky/.vim/bundle/YouCompleteMe/autoload/../python/ycm/setup.py", line 37, in SetUpSystemPaths
from ycmd import server_utils as su
File "/Users/simonorlovsky/.vim/bundle/YouCompleteMe/python/ycm/../../third_party/ycmd/ycmd/server_utils.py", line 25, in <module>
import io
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
YouCompleteMe unavailable: dlopen(/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Press ENTER or type command to continue
I am new to the vim plugin community so I was wondering if anyone has any insight to what the problem may be.
EDIT
Ultimately the solution was to reinstall macvim and remove the brew version of python on my machine.
Thanks for advice!

Thanks for asking this question, I was quite puzzled by this. I had a really tough time getting this plugin to work!
So the steps are as follows
The key thing to get around this specific error is to update vim.
brew install macvim --with-override-system-vim
After you do this, close your terminal and open a new terminal. Check the version of vim, it should be version 8 now, i.e.
vim --version | grep IMproved
should have the output:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 20 2017 20:02:24)
Note that it will still be the old mac version until you close your terminal and open a new one.
Now remove the incomplete copy of YouCompleteMe:
sudo rm -rf ~/.vim/bundle/YouCompleteMe
then open vim and install the plugin again
:PluginInstall
It should be successful and not have the error reported in this question. However, I found that when I tried to use it, it wasn't working correctly. You're not done yet! You still need to manually install YouCompleteMe. You can do this by (the --clang-completer is optional, it's just for if you want semantic support for c-family languages):
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
You may need to install cmake to do this, so just in case, here is the command:
brew install cmake
I hope this works for you! Try it out in a python file. Here is the github repo if you want to checkout the readme:
https://github.com/Valloric/YouCompleteMe
Let me know if you have any problems.

This can also happen when you have a faulty YouCompleteMe installation. Removing the plugin and installing it again fixed it for me.

Related

Error when loading vimtutor "E484: Can't open file /usr/share/vim/vim80/tutor/tutor.vim"

I'm trying to run vimtutor on openSUSE Leap 15 1 on WSL2. I get the error E484: Can't open file /usr/share/vim/vim80/tutor/tutor.vim
When I run which vim (or which vimtutor) I get /usr/bin/vim (or /usr/bin/vimtutor) -- is the issue that I have multiple versions of vim installed and when I try vimtutor (which I understand to be a script) it can't access the correct one because of the way my PATH is configured? I've seen similar issues about this posted, but none that seem to deal with this specific issue as it applies to vimtutor.
The vim script is part of vim-data package.
If you looked at the spec file linked here,
https://build.opensuse.org/package/view_file/openSUSE:Factory/vim/vim.spec?expand=1
on line 567, the tutor.vim is split into the vim-data package.
It's part of the
%files data
block.

How to recover or reinstall .vim_runtime directory and contents

I downloaded this vim config but decided later I wanted to work using vanilla vim (because i'm still not used to it).
So I followed the instructions at the bottom of the README:
How to uninstall
Just do following:
Remove ~/.vim_runtime
Remove any lines that reference .vim_runtime in
your ~/.vimrc
I deleted the hidden vim_runtime directory located in :home/user/ on Ubuntu 16.04, using
rm -rf ~/.vim_runtime/
then realized this was a mistake. I now can't open vim without getting:
Error detected while processing /home/user/.vimrc:
line 3:
E484: Cannot open file /home/user/.vim_runtime/vimrcs/basic.vim
line 4:
E484: Cannot open file /home/user/.vim_runtime/vimrcs/filetypes.vim
line 5:
E484: Cannot open file /home/user/.vim_runtime/vimrcs/plugins_config.vim
line 6:
E484: Cannot open file /home/user/.vim_runtime/vimrcs/extended.vim
Press ENTER or type command to continue
I don't know what to do from here, It would be great if I could just purge it all and have vim as it was when you first install the OS, I've tried:
sudo apt-get purge vim && sudo apt-get install vim
but still get the same error detection when opening vim after the command has completed.
If you had no personal configuration other than that Vim distribution, just rm /home/user/.vimrc and start anew. You can also remove /home/user/.vim/ if it exists. That gives you a clean slate. There's no need to reinstall Vim; that distribution presumably was just user configuration (i.e. you didn't need sudo to install it), whereas Vim is installed system-wide (via apt). If there's something inside .vimrc that you want to save (and you have no other editor installed), you can launch Vim with vim -N -u NONE.
soapbox
Vim "distributions" like spf-13 and Janus lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult). Vim is incredibly customizable, using someone else's customization makes no sense.
new config
I would base your personal configuration on the example that ships with Vim. You can install it like this:
$ vim
:edit $VIMRUNTIME/vimrc_example
:saveas $MYVIMRC
:quit
Also see :help defaults.vim.

YouCompleteMe unavailable: dlopen... (more in description)

This is the full error when running vim after compiling youCompleteMe for macvim:
YouCompleteMe unavailable: dlopen(/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not
found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
I'm not finding it anywhere else online so I'm hoping you all could help me.
I had the same error trying to install YCM on MacVim. I'm going to be honest, I'm not quite sure which command fixed it (so much for the scientific method), but it was an error with brew and the permissions on /usr/local/. Try the following commands in Terminal:
brew prune
sudo chown -R "$USER":admin /usr/local
brew link --overwrite python
I think it's the last two commands that do the trick, fixing the permissions and any errors in Python's links.
Had similar problem. Turned out I hadn't link MacVim with vim. So after I linked it with ln -s /usr/local/bin/mvim vim, now YCM works!

ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need to compile YCM before using it

orror in compile prses. how to solve it?
According to this blog post, you just have to compile the YouCompleteMe modules by running the install.sh script in the YCM install.
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer
Once this completes you should be able to install the plugin (here's how to do it with Vundle). Once in Vim
:source ~/.vimrc
:PluginInstall
Apparently, when you run ./.install.sh --clang-completer it says that it is "out of date."
I ran python2 install.py and it worked for me. (I believe it was python2.)
Also, I had was using vim and neovim, and I decided to do ./install.sh --clang-completer inside my ~/.vim/bundle/Vundle.vim/ and at the same tim decided to do python2 install.py inside my ~/.configs/nvim/bundle/Vundle.vim/ and the python install installed faster and did the same thing.
The difference might be that you need to "compile vim with pdython support," but the simple fix for that is installing python-nvim (if using neovim), or - I think - vim just comes with python support. (? maybe.)
I encountered the same error message when trying out new neovim installation. In my case, it was because I was using vim-plugin and the plugins are installed in the ~/.vim/plugged instead of ~/.vim/bundle (this is the plugin folder for Vundle before I switched to vim-plug).
Thus, after scratching my head for few hours, turns out I have to run install.sh in the ~/.vim/plugged (not ~/.vim/bundle). I hope this will save someone's time.

fuzzyfinder not working in gvim

I found out about fuzzyfinder yesterday and tried installing it. Then found out I needed L9 since that is a prerequisite for fuzzyfinder.
I am getting the following errors when running gvim:
Error detected while processing /usr/share/vim/vim72/plugin/fuf.vim:
line 13:
***** L9 library must be installed! *****
Error detected while processing /usr/share/vim/vim72/plugin/l9.vim:
line 8:
E117: Unknown function: l9#guardScriptLoading
E15: Invalid expression: !l9#guardScriptLoading(expand('<sfile>:p'), 702, 0, [])
line 16:
E117: Unknown function: l9#defineVariableDefault
I've put fuf.vim and l9.vim into my plugin folder. I tried putting them in autoload folder as well but that fetches even more errors.
My version is: VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Apr 16 2010 12:40:58)
Googling did not work since question from one mailing list is spread of so many other links and the answer is nowhere to be found.
Both fuzzyfinder and l9 plugins contain more then one file. They must not work if you have thrown away most of them (and you did if you put just fuf.vim and l9.vim). You are supposed to unpack plugin archives into ~/.vim.
By the way, you may try to use vim-addon-manager. Copy the following into your shell and you should get FuzzyFinder successfully installed with an advantage of having each plugin in a separate directory and easier installation of plugins with dependencies in future:
mkdir -p ~/.vam
git clone git://github.com/MarcWeber/vim-addon-manager ~/.vam/vim-addon-manager
echo 'set rtp+=~/.vam/vim-addon-manager' >> ~/.vimrc
echo 'call vam#ActivateAddons(["FuzzyFinder"])' >> ~/.vimrc
vim # Now answer yes on all queries
While this is correct the VAM team proposes reading the official documentation about how to install VAM which can be found at github.com/MarcWeber/vim-addon-manager then cd into the doc directory.
We want to be fair and say that VAM is only one solution. Vundle, Pathogen, ... and some more exist (See related work section in docs of VAM)

Resources