How to correctly install YouCompleteMe on mac? - vim

I have the following line in ~/.vimrc
Plugin 'valloric/youcompleteme'
Running PluginInstall successfully installed the plugin.
Then I ran python3 install.py --clang-completer under /Users/$UserName/.vim/bundle/youcompleteme.
Running vim gave me:
YouCompleteMe unavailable: requires Vim compiled with Python (3.5.1+) support.
The python3 version is 3.6.8.
vim --version shows that it has python3 support:
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 13 2019 14:45:40)
Included patches: 1-503, 505-680, 682-1312
Compiled by root#apple.com
Normal version without GUI. Features included (+) or not (-):
+acl +extra_search -mouse_netterm -tag_old_static
-arabic -farsi +mouse_sgr -tag_any_white
+autocmd +file_in_path -mouse_sysmouse -tcl
+autochdir +find_in_path -mouse_urxvt -termguicolors
-autoservername +float +mouse_xterm +terminal
-balloon_eval +folding +multi_byte +terminfo
-balloon_eval_term -footer +multi_lang +termresponse
-browse +fork() -mzscheme +textobjects
+builtin_terms -gettext +netbeans_intg +textprop
+byte_offset -hangul_input +num64 +timers
+channel +iconv +packages +title
+cindent +insert_expand +path_extra -toolbar
-clientserver +job -perl +user_commands
-clipboard +jumplist +persistent_undo -vartabs
+cmdline_compl -keymap +postscript +vertsplit
+cmdline_hist +lambda +printer +virtualedit
+cmdline_info -langmap -profile +visual
+comments +libcall +python/dyn +visualextra
-conceal +linebreak -python3 +viminfo
+cryptv +lispindent +quickfix +vreplace
+cscope +listcmds +reltime +wildignore
+cursorbind +localmap -rightleft +wildmenu
+cursorshape -lua +ruby/dyn +windows
+dialog_con +menu +scrollbind +writebackup
+diff +mksession +signs -X11
+digraphs +modify_fname +smartindent -xfontset
-dnd +mouse +startuptime -xim
-ebcdic -mouseshape +statusline -xpm
-emacs_tags -mouse_dec -sun_workshop -xsmp
+eval -mouse_gpm +syntax -xterm_clipboard
+ex_extra -mouse_jsbterm +tag_binary -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa

I use YouCompleteMe for C and built vim 8.2 from source on my mac with OSX 10.15. If you want to use it for c-family languages it's pretty finicky. You might spend a lot of time reading posts like these, ones where someone was having a different issue 3 months ago and there's no answer.
To build vim with python3 support you can do one of two things,
git clone https://github.com/vim/vim.git
cd vim
git pull
cd src
make distclean
./configure --with-features=huge
make
sudo make install
This will give you more than just python3. There aren't any drawbacks to having the extra features as far as I know.
my vim is installed in $HOME, I think the install script symlinked the binary to /usr/local/bin/vim.
or you can use homebrew and macvim which is what I would recommend,
brew install macvim
sources:
https://www.vim.org/git.php
https://vim.fandom.com/wiki/Building_Vim

YouCompleteMe need that VIM, that VIM must support Python3.
(That means that you need to use Python3 to config installling VIM).
As your VIM 's "vim --version" shows, your installed VIM Do Not Support
Python3(Beacuse the symbol before python3 is that '-', that '-' minus
means Your installed VIM do not support python3).
Even your Mac defualt python3 is over 3.5.1,
your installed VIM support python#2(from "+python/dyn" sa your "vim --version" shows).
Please use Homebrew reinstall VIM with supporting python3,
DO NOT USE your Mac default installed VIM.
Could refer:
0.Installing Vim with Python3 support on MacOS.
1.Debian Manually install VIM which suppoet Python3.
2.How do I install vim on OSX with Python 3 support?

Related

Exit code -11 after installation of Vim auto completion plugin YouCompleteMe with MacVim (Vim version 8.1)

I'd like to install the auto completion plugin YouCompleteMe for Vim.
I followed the instructions of the installation guide at https://github.com/Valloric/YouCompleteMe/blob/master/README.md#full-installation-guide
I chose the simpler option without semantic completion support for C-family languages.
Executing
vim --version
returns
VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 19 2019 12:07:03)
macOS version
Included patches: 1-950
Compiled by Homebrew
Huge version with MacVim GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr -tag_any_white
+arabic +file_in_path -mouse_sysmouse -tcl
+autocmd +find_in_path +mouse_urxvt +termguicolors
+autochdir +float +mouse_xterm +terminal
-autoservername +folding +multi_byte +terminfo
+balloon_eval -footer +multi_lang +termresponse
+balloon_eval_term +fork() -mzscheme +textobjects
+browse +fullscreen +netbeans_intg +textprop
++builtin_terms -gettext +num64 +timers
+byte_offset -hangul_input +odbeditor +title
+channel +iconv +packages +toolbar
+cindent +insert_expand +path_extra +transparency
+clientserver +job +perl +user_commands
+clipboard +jumplist +persistent_undo +vartabs
+cmdline_compl +keymap +postscript +vertsplit
+cmdline_hist +lambda +printer +virtualedit
+cmdline_info +langmap +profile +visual
+comments +libcall -python +visualextra
+conceal +linebreak +python3 +viminfo
+cryptv +lispindent +quickfix +vreplace
+cscope +listcmds +reltime +wildignore
+cursorbind +localmap +rightleft +wildmenu
+cursorshape +lua +ruby +windows
+dialog_con_gui +menu +scrollbind +writebackup
+diff +mksession +signs -X11
+digraphs +modify_fname +smartindent -xfontset
+dnd +mouse +startuptime +xim
-ebcdic +mouseshape +statusline -xpm
+emacs_tags +mouse_dec -sun_workshop -xsmp
+eval -mouse_gpm +syntax -xterm_clipboard
+ex_extra -mouse_jsbterm +tag_binary -xterm_save
+extra_search +mouse_netterm +tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -L. -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon -lm -lncurses -liconv -framework AppKit -L/usr/local/opt/lua/lib -llua5.3 -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation -framework Ruby
I added the line
Plugin 'Valloric/YouCompleteMe'
to my .vimrc, afterwards the Vim command
:PluginInstall
executes without errors.
If I then start Vim the following error message is displayed:
The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code -11. Type ':YcmToggleLogs ycmd_62275_stderr_menu0zqa.log' to check the logs.
The here mentioned log file is empty. Does anyone know what's the problem here?
I know there are a lot of other questions on StackOverflow and Github regarding very similar problems. But since I've spent the last 3 hours going through these and trying to get the plugin to work without success, I'd be happy if this won't be marked as duplicate and am very grateful for every response.
https://valloric.github.io/YouCompleteMe/#faq
YCM does not work with my Anaconda Python setup
Anaconda is often incompatible with the pre-built libclang used by YCM and therefore is not supported. The recommended way to solve this is to run /path/to/real/python install.py (for example /usr/bin/python install.py).
If you want completion in Anaconda projects, point the interpreter_path option in your .ycm_extra_conf.py file to the path of your Anaconda Python e.g.
def Settings(**kwargs):
return {
'interpreter_path': '/path/to/anaconda/python'
}
See the Python Semantic Completion section for more details.

My .vimrc file is completely ignored

I have got a .vimrc file from one of my friends, however, vim ignores it. In an other topic (Activation of `.vimrc` file) it has turned out that the value of the VIM variable may cause problem (/usr/share/vim instead of /home/tobias). Should I change this route for the other one? If the answer is yes, how can I carry out it? Thank you for the answer.
-- edit --
$ vim --version:
VIM - Vi IMproved 7.1 (2007 May 12, compiled Oct 18 2008 09:05:15)
Included patches: 1-314
Compiled by buildd#excelsior.roeckx.be
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
+folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist`
+keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
+mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm
-mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme
-netbeans_intg -osfiletype +path_extra -perl +postscript +printer +profile
-python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent
-sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace
+wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -O2 -g -Wall
Linking: gcc -Wl,--as-needed -L/usr/local/lib -o vim -lncurses -lselinux -lacl -lgpm
-- endedit --
Just put your vimrc into $HOME/.vimrc. You can check whether it got sourced via :scriptnames. For troubleshooting, you can also temporarily add :echomsg "hello" in there. You don't need to mess with the $VIM variable. :help initialization has all the gruesome details, should you be interested.
In my case, my Ubuntu install only came with this tiny-vim thing installed. I solved the issue by running sudo apt install vim-gtk3

Can't install Powerline using Vundle in Vim editor

I want to install Powerline statusline in Vim. I found a bunch of methodes from the official documentation. I decided to go with with Vundle plugin manager, everything went good and after I launched Vim, I got this message:
You need vim compiled with Python 2.6, 2.7 or 3.2 and later support
for Powerline to work
despite Python 2.7 is installed. what is the problem?
PS:
I already installed bunch of plugins using Vundle successfully.
I've installed Powerline package from debian repository to use is for tmux and it woked correctly.
My setup:
Debian Jessie 8.2.
Vim 7.4.
Python 2.7.9.
Edit: the output of
vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:56:29)
Included patches: 1-488, 576
Modified by pkg-vim-maintainers#lists.alioth.debian.org
Compiled by buildd#
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
-clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand -perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak -python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu -ruby +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl

vim Crashes on saves and quits

New to programming (and SO) so I may be missing some very basic step, but this is happening with multiple other people I work with.
Very commonly in vim when I have multiple buffers open, if I :w or run any quit command (:q!, ZZ, :wq, etc) the program will crash, only displaying this message:
Vim: Caught deadly signal ABRT
Vim: preserving files...
Vim: Finished.
[1] 20271 abort vim .
%
Attempts I've taken, with no luck:
Deleted .swp file
Update vim by overriding the system version
Info of my Vim install (through homebrew)
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov 5 2014 21:00:28)
Compiled by root#apple.com
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn
-python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses
If you need more information let me know. Any help would be greatly appreciated!
You might not be using the version you installed since the compile date is November 2014. Try the following:
brew uninstall macvim
brew install macvim --override-system-vim

Vim seems to get stuck when writing a file

I am using Terminal.app in OSX and Vim. Every time I try to write/save a particular file (it happens to be a .scss file) Vim seems to just hang. I know it successfully writes the file but it never gives me back control. Instead I see the file name at the bottom with the cursor flashing at the end of the line. I have tried Ctrl-Esc, Ctrl-c and Ctrl-[ all to no avail.
If I then quit Terminal.app and reopen it, I can see that the Vim process that got stuck is still running in Activity Monitor.
I am able to write other files just fine.
I am also using CodeKit to watch the .scss files but thinking that might be the cause, I quit CodeKit and tried to write the file again with Vim but it still got stuck.
It does seem to write correctly if I use MacVim, it just doesn't seem to work via Terminal.app.
Any suggestions would be much appreciated, thank you!
EDIT
Here is my current .vimrc: https://www.dropbox.com/s/1r72shv47f07crs/.vimrc
I'm using Vim 7.3, here are the details:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 20 2012 13:16:02)
Compiled by root#apple.com
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn
-python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses
This is all that's in my .bash_profile:
# Tell ls to be colourful
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'
I finally found the cause of the problem. It did have to do with file permissions. I created a new test.scss file in the same directory and was able to save changes to it just fine using vim in Terminal.app. I then compared the permissions of the test.scss file and my main style.scss file that was causing me trouble. The results looked like this:
test.scss
-rwx------
and for style.scss (the file that was causing me trouble)
-rwx------#
I suspect that CodeKit had added some additional file attributes to the file when it was initially scanned (by CodeKit) and that these extra attributes (as indicated by the #) were the culprit. This would explain why I was still experiencing the problem even when CodeKit wasn't running. I used the xattr command to inspect the additional attribute which gave me com.apple.ResourceFork. I then used xattr with the -d flag to remove this additional attribute from the file and the problem was fixed.
xattr -d com.apple.ResourceFork style.scss
I suspect that this is a pretty obscure and specific situation but hopefully its helpful to someone else as well.
What version of Vim are you running? Perhaps updating it might fix the bug.
The only other things that I think would cause Vim to choke on something as common as saving a file would be conflicts from plugins or any big custom functions in the .vimrc.
If you could give some more detailed information, I might be able to help more.
The default Vim as always sucked on Mac OS X.
Thankfully, MacVim comes with a mvim executable script that allows you to use MacVim in your shell. Place it somewhere in your $PATH and do $ mvim -v filename. If the problem only happens when you use /usr/bin/vim this might solve it.
Do you have the syntastic plugin?

Resources