日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
CentOS安裝YouCompleMe

重新安裝了一遍虛擬機(jī),又把Vim配置了一遍,這回有信心把YouCompleMe的安裝方法貼出來了,先給個權(quán)威的鏈接,然后給出具體步驟,保證沒問題可以安裝成功

創(chuàng)新互聯(lián)公司長期為上1000+客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為蓋州企業(yè)提供專業(yè)的網(wǎng)站制作、做網(wǎng)站,蓋州網(wǎng)站改版等技術(shù)服務(wù)。擁有十年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。

什么是youcompleteme?就是一個強(qiáng)大的自動補(bǔ)全插件,安裝此插件之后配置一下vim,這樣在敲代碼的時候就不會有忘記函數(shù)名的尷尬了~

我們需要以下幾步

先檢查一下自己的虛擬機(jī)中是否有安裝python,用vim試一下1 :echo has('python') 如果得到結(jié)果為1 就說明有(其實(shí)有沒有都無所謂,再執(zhí)行一遍安裝命令絕對沒錯)

yum install python

安裝vundle,vundle是一款vim插件管理工具,使用它安裝youcomplete很簡單

git clone https://github.com/gmarik/Vundle.vim.git~/.vim/bundle/Vundle.vim

配置vundle

在vimrc中添加這樣的配置語句

set nocompatible 
filetype off 
set rtp+=~/.vim/bundle/Vundle.vim 
call vundle#begin() 
Plugin 'gmarik/Vundle.vim' 
Plugin 'Valloric/YouCompleteMe' 
call vundle#end() 
filetype plugin indent on

安裝youcompleteme

去github上clone一下youcompleteme的代碼

git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe

然后在vim里面安裝一下,執(zhí)行

:PluginInstall

看到有DONE!顯示就好了

編譯youcomplete

這一步坑了我好久,網(wǎng)上好多抄襲的全是apt命令和dnf命令,不太適合我的CentOS7,用yum就好了!

yum install automake gcc gcc-c++ kernel-devel cmake
yum install python-devel python3-devel

不管安沒安裝python在這兩句命令執(zhí)行之后你都有了

接下來就是編譯的重頭戲

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

執(zhí)行以上兩句命令,然后等待就好了~編譯就好了

配置vim

修改vimrc文件

注意第一句,/home/li/這部分不一定通用,根據(jù)自己當(dāng)前登陸的賬戶來定,我的使用root登陸的,所以這部分就是/root/
?(可能會有)附件

有可能.ycm_extra_conf.py這個文件會自動就有,也許會沒有,find一下,沒找到的話就自己vim修改一下,以下是該文件內(nèi)容,復(fù)制之前,友情提示,在vim輸入

:set paste

進(jìn)入復(fù)制模式,這樣子復(fù)制之后格式就不會亂了~

import os
import ycm_core
flags = [
'-Wall',
'-Wextra',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-stdlib=libc++',
'-std=c++11',
'-x',
'c++',
'-I',
'.',
'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-isystem',
'/Library/Developer/CommandLineTools/usr/include',
'-isystem',
'/Library/Developer/CommandLineTools/usr/bin/../lib/c++/v1',
]

compilation_database_folder = ''

if os.path.exists( compilation_database_folder ):
  database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
  database = None

SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]

def DirectoryOfThisScript():
  return os.path.dirname( os.path.abspath( __file__ ) )

def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
  if not working_directory:
    return list( flags )
  new_flags = []
  make_next_absolute = False
  path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
  for flag in flags:
    new_flag = flag

    if make_next_absolute:
      make_next_absolute = False
      if not flag.startswith( '/' ):
        new_flag = os.path.join( working_directory, flag )

    for path_flag in path_flags:
      if flag == path_flag:
        make_next_absolute = True
        break

      if flag.startswith( path_flag ):
        path = flag[ len( path_flag ): ]
        new_flag = path_flag + os.path.join( working_directory, path )
        break

    if new_flag:
      new_flags.append( new_flag )
  return new_flags

def IsHeaderFile( filename ):
  extension = os.path.splitext( filename )[ 1 ]
  return extension in [ '.h', '.hxx', '.hpp', '.hh' ]

def GetCompilationInfoForFile( filename ):

  if IsHeaderFile( filename ):
    basename = os.path.splitext( filename )[ 0 ]
    for extension in SOURCE_EXTENSIONS:
      replacement_file = basename + extension
      if os.path.exists( replacement_file ):
        compilation_info = database.GetCompilationInfoForFile(
          replacement_file )
        if compilation_info.compiler_flags_:
          return compilation_info
    return None
  return database.GetCompilationInfoForFile( filename )

def FlagsForFile( filename, **kwargs ):
  if database:

    compilation_info = GetCompilationInfoForFile( filename )
    if not compilation_info:
      return None

    final_flags = MakeRelativePathsInFlagsAbsolute(
      compilation_info.compiler_flags_,
      compilation_info.compiler_working_dir_ )

  else:
    relative_to = DirectoryOfThisScript()
    final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )

  return {
    'flags': final_flags,
    'do_cache': True
  }


網(wǎng)站標(biāo)題:CentOS安裝YouCompleMe
分享鏈接:http://www.dlmjj.cn/article/dhpjeco.html