我在 ~/.vimrc 中有以下行
Plugin 'valloric/youcompleteme'
运行 PluginInstall 成功安装了插件。
然后我跑了
python3 install.py --clang-completer
在 /Users/$UserName/.vim/bundle/youcompleteme
下.运行 vim 给了我:
YouCompleteMe unavailable: requires Vim compiled with Python (3.5.1+) support.
python3版本是3.6.8。
vim --version
表明它具有python3支持: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
最佳答案
我使用 YouCompleteMe for C 并在我的 Mac 上使用 OSX 10.15 从源代码构建 vim 8.2。如果你想将它用于 c 系列语言,它非常挑剔。您可能会花费大量时间阅读此类帖子,其中有人在 3 个月前遇到了不同的问题并且没有答案。
要使用 python3 支持构建 vim,您可以做以下两件事之一,
git clone https://github.com/vim/vim.git
cd vim
git pull
cd src
make distclean
./configure --with-features=huge
make
sudo make install
这将为您提供的不仅仅是 python3。据我所知,拥有额外功能没有任何缺点。我的 vim 安装在 $HOME 中,我认为安装脚本将二进制文件符号链接(symbolic link)到/usr/local/bin/vim。
或者您可以使用我推荐的自制软件和 macvim,
brew install macvim
来源:https://www.vim.org/git.php
https://vim.fandom.com/wiki/Building_Vim
关于vim - 如何在 mac 上正确安装 YouCompleteMe?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62328067/