Installation of YouCompleteMe Tutorial in vim under ubuntu

Keywords: Linux vim Python git cmake

Installation of YouCompleteMe tutorial in vim under Ubuntu 16.4

YouCompleteMe Is the vim code prompt plug-in

1 First check the vim version

vim --version

As shown below

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     -tcl
-browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         +gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
-clientserver    +iconv           +packages        -toolbar
-clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             -perl            +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            -ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xsmp
+emacs_tags      -mouseshape      +startuptime     -xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        +mouse_gpm       -sun_workshop    -xpm
+extra_search    -mouse_jsbterm   +syntax          
   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"

Verify that vim version at least 7.4 Included patches is greater than 1578 and enter in vim

:echo has('python') || has('python3')**

If the return value is 1, the Vim version supporting Python is required if it is 0.

2 Install Vundle in vim

Install according to the article https://www.jianshu.com/p/769...

3 Installing YouCompleteMe with Vundle

Add the following to. vimrc

Plugin 'Valloric/YouCompleteMe'

Then perform the following

git clone https://github.com/ycm-core/YouCompleteMe.git ~/.vim/bundle

Execute under ~/.vim/bundle/YouCompleteMe directory

git submodule update --init --recursive

4 Install cmake

apt install cmake

5 YouCompleteMe requires clang to be at least 7.0, so compile libclang 8.0

clang --version

Compile according to the article https://blog.csdn.net/xingyu9...

Installation of c Language Code Tips in the 6 YouCompleteMe Directory

cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clang-completer

The successful compilation is shown in Figure 1.

Add. vimrc configuration

vi .vimrc
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'

Then create the. c file test prompt at will

Posted by john0117 on Sat, 12 Oct 2019 14:19:59 -0700