如何在Mac上正确安装YouCompleteMe?

时间:2020-06-11 15:37:44

标签: vim

我在〜/ .vimrc中有以下一行

Plugin 'valloric/youcompleteme'

正在运行PluginInstall已成功安装了插件。

然后我在python3 install.py --clang-completer下运行/Users/$UserName/.vim/bundle/youcompleteme

运行vim给了我

YouCompleteMe不可用:需要使用Python(3.5.1+)支持编译的Vim。

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

1 个答案:

答案 0 :(得分:1)

我使用YouCompleteMe for C,并使用OSX 10.15在Mac上从源代码构建了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中,我认为安装脚本将二进制文件符号链接到/ usr / local / bin / vim。

或者您可以使用我建议的自制软件和macvim

brew install macvim

来源:

https://www.vim.org/git.php

https://vim.fandom.com/wiki/Building_Vim