1.通过clangd编译具有对 C 系列语言的语义支持的 YCM :

cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clangd-completer --verbose//----------------------/usr/bin/python3 /home/mumu/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py --clangd-completer --verbose

2.To simply compile with everything enabled, there's a --all flag. So, to install with all language features, ensure xbuildgonode and npm tools are installed and in your PATH, then simply run:

cd ~/.vim/bundle/YouCompleteMe
python3 install.py --all --verbose//我是用的是
cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clangd-completer --all --verbose

配置文件.ycm_extra_conf.py内容如下:

#自己定义

#配置C语言,C++语言函数提示目录
        '-isystem',
        '/usr/include',
        '-isystem',
        '/usr/include/c++/9',

#配置项目相关目录,头文进目录,测试目录
        '-I',
        '/home/mumu/Lars/base/mysql-connector-c/include',
        '-I',
        '/home/mumu/Lars/base/mysql-connector-c/include/mysql',
        '-I',
        '/home/mumu/Lars/base/mysql-connector-c/include/mysql/psi',
        '-I',
        '/home/mumu/Lars/base/proto',
        '-I',
        '/home/mumu/Lars/lars_dns/include',
        '-I',
        '/home/mumu/Lars/lars_lb_agent/include',
        '-I',
        '/home/mumu/Lars/lars_reactor/example/qps_test',
        '-I',
        '/home/mumu/Lars/lars_reactor/include',
        '-I',
        '/home/mumu/Lars/lars_reporter/include',

# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>from distutils.sysconfig import get_python_inc
import platform
import os.path as p
import subprocessDIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) )
DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' )
DIR_OF_WATCHDOG_DEPS = p.join( DIR_OF_THIRD_PARTY, 'watchdog_deps' )
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]database = None# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
# You 100% do NOT need -DUSE_CLANG_COMPLETER and/or -DYCM_EXPORT in your flags;
# only the YCM source code needs it.
'-DUSE_CLANG_COMPLETER',
'-DYCM_EXPORT=',
'-DYCM_ABSEIL_SUPPORTED',
# THIS IS IMPORTANT! Without the '-x' flag, Clang won't know which language to
# use when compiling headers. So it will guess. Badly. So C++ headers will be
# compiled as C headers. You don't want that so ALWAYS specify the '-x' flag.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c++',
'-isystem',
'cpp/absl',
'-isystem',
'cpp/pybind11',
'-isystem',
'cpp/whereami',
'-isystem',
'cpp/BoostParts',
'-isystem',
get_python_inc(),
'-isystem',
'cpp/llvm/include',
'-isystem',
'cpp/llvm/tools/clang/include',
'-I',
'cpp/ycm',
'-I',
'cpp/ycm/ClangCompleter',
'-isystem',
'cpp/ycm/tests/gmock/googlemock/include',
'-isystem',
'cpp/ycm/tests/gmock/googletest/include',
'-isystem',
'cpp/ycm/benchmarks/benchmark/include',
'-std=c++17',#自己定义'-isystem','/usr/include','-isystem','/usr/include/c++/9','-I','/home/mumu/Lars/base/mysql-connector-c/include','-I','/home/mumu/Lars/base/mysql-connector-c/include/mysql','-I','/home/mumu/Lars/base/mysql-connector-c/include/mysql/psi','-I','/home/mumu/Lars/base/proto','-I','/home/mumu/Lars/lars_dns/include','-I','/home/mumu/Lars/lars_lb_agent/include','-I','/home/mumu/Lars/lars_reactor/example/qps_test','-I','/home/mumu/Lars/lars_reactor/include','-I','/home/mumu/Lars/lars_reporter/include',]# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
#   set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''def IsHeaderFile( filename ):extension = p.splitext( filename )[ 1 ]return extension in [ '.h', '.hxx', '.hpp', '.hh' ]def FindCorrespondingSourceFile( filename ):if IsHeaderFile( filename ):basename = p.splitext( filename )[ 0 ]for extension in SOURCE_EXTENSIONS:replacement_file = basename + extensionif p.exists( replacement_file ):return replacement_filereturn filenamedef PathToPythonUsedDuringBuild():try:filepath = p.join( DIR_OF_THIS_SCRIPT, 'PYTHON_USED_DURING_BUILDING' )with open( filepath ) as f:return f.read().strip()except OSError:return Nonedef Settings( **kwargs ):# Do NOT import ycm_core at module scope.import ycm_coreglobal databaseif database is None and p.exists( compilation_database_folder ):database = ycm_core.CompilationDatabase( compilation_database_folder )language = kwargs[ 'language' ]if language == 'cfamily':# If the file is a header, try to find the corresponding source file and# retrieve its flags from the compilation database if using one. This is# necessary since compilation databases don't have entries for header files.# In addition, use this source file as the translation unit. This makes it# possible to jump from a declaration in the header file to its definition# in the corresponding source file.filename = FindCorrespondingSourceFile( kwargs[ 'filename' ] )if not database:return {'flags': flags,'include_paths_relative_to_dir': DIR_OF_THIS_SCRIPT,'override_filename': filename}compilation_info = database.GetCompilationInfoForFile( filename )if not compilation_info.compiler_flags_:return {}# Bear in mind that compilation_info.compiler_flags_ does NOT return a# python list, but a "list-like" StringVec object.final_flags = list( compilation_info.compiler_flags_ )# NOTE: This is just for YouCompleteMe; it's highly likely that your project# does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR# ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.try:final_flags.remove( '-stdlib=libc++' )except ValueError:passreturn {'flags': final_flags,'include_paths_relative_to_dir': compilation_info.compiler_working_dir_,'override_filename': filename}if language == 'python':return {'interpreter_path': PathToPythonUsedDuringBuild()}return {}def PythonSysPath( **kwargs ):sys_path = kwargs[ 'sys_path' ]interpreter_path = kwargs[ 'interpreter_path' ]sys_path[ 0:0 ] = [ p.join( DIR_OF_THIS_SCRIPT ),p.join( DIR_OF_THIRD_PARTY, 'bottle' ),p.join( DIR_OF_THIRD_PARTY, 'regex-build' ),p.join( DIR_OF_THIRD_PARTY, 'frozendict' ),p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ),p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ),p.join( DIR_OF_WATCHDOG_DEPS, 'watchdog', 'build', 'lib3' ),p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ),p.join( DIR_OF_THIRD_PARTY, 'waitress' ) ]sys_path.append( p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'numpydoc' ) )return sys_path

【vim】vim插件YouCompleteMe配置文件相关推荐

  1. Mac下安装vim的插件YouCompleteMe及注意事项

    mac下的YouCompleteMe安装还是很麻烦的,所以我安装完之后写下此篇blog,以供诸位一起学习 此篇借鉴了网上一些文章的情况下结合了我自己的一点心得: 1.基本准备(我默认已经安装好了以下软 ...

  2. 【Linux】Ubuntu 18下安装Vim自动补全插件YouCompleteMe(可高速下载安装)

    前言 本文写于2020年10月,如果你多年后看见这篇文章,方法可能已经失效,但是请牢记,尽量下载你所处时代的最新版本的软件,会减少很多麻烦. 摆正心态 即便按照本文操作,由于你的系统状态和我的不一样, ...

  3. windows 10 平台安装 vim 插件 YouCompleteMe 详细流程

    配置流程 0. 编译和安装环境 Visual Studio Build Tools 2019 (或直接安装 VS2019) CMake Python (作者安装时使用的是 Python3) vim 1 ...

  4. 安装vim插件YouCompleteMe过程记录

    第一步,通过配置文件[.vimrc]中使用的包管理器进行插件YouCompleteMe的安装. " use vim-plug to manage vim plugins call plug# ...

  5. Vim 插件YouCompleteMe(YCM)安装

    vim插件YouCompleteMe插件安装: 在ubuntu 18.04默认的vim版本是8.0,PluginInstall之后报不支持当前vim版本,所以在github上下载vim8.2的源码进行 ...

  6. vim插件——YouCompleteMe

      版权声明:本文参考了<YouCompleteMe 官方文档>.未经作者允许,严禁用于商业出版,否则追究法律责任.网络转载请注明出处,这是对原创者的起码的尊重!!! 1 简介 插件介绍: ...

  7. 神级编辑器 Vim 使用-插件篇

    在这篇中, 会列举各种实用的插件, 包括他们的安装, 配置及使用方法 注意: 不是本部分的所有插件都是你需要装的, 如果盲目安装插件只会导致你 vim 功能混乱, 速度底下, 所以适时整理真正需要的插 ...

  8. vim插件的安装方式 -- vim注释插件和doxygen函数注释生成插件-ctrlp插件-tabular等号对齐 插件...

    使用unzip的时候 指定 -d选项, 是说明解压到的 目标地址. 这个参数还是比较方便的, 比直接unzip到当前目录, 然后在去拷贝到目标目录, 然后再删除当前目录中的解压文件夹, 方便多了. 使 ...

  9. Vim Vundle 插件管理器

    /*********************************************************************** Vim Vundle 插件管理器* 说明:* 话说Vi ...

最新文章

  1. PAT甲级1001.A+B Format(20)
  2. squid rebuild 阶段swap.state 持续增大耗尽磁盘
  3. HttpClient基础教程
  4. 线程安全且高效的单例
  5. 进程线程001 进程线程结构体和KPCR
  6. java B2B2C Springcloud电子商城系统-Spring Cloud常见问题与总结(四)
  7. jQuery 3.4.0 Released(2019.4.10)
  8. python的print
  9. 无锁、偏向锁、轻量级锁、重量级锁,完整的锁升级!
  10. 【JVM】Java命令以及JVM调优
  11. 【ENSP模拟器】ENSP——VLAN的配置
  12. apr_thread使用内存之谜
  13. 如何在阿里云上创建安全的远程工作空间
  14. 李开复:搞无人车在电车难题上论争个没完,这样子不行的
  15. 各种下载文件方式总结
  16. oracle中制表符,oracle中去掉文本中的换行符、回车符、制表符
  17. 苹果、天猫同步关停是因为发新品?这些猜想你看靠谱吗....
  18. 【Meetup预告】OpenMLDB+37手游:一键查收实时特征计算场景案例及进阶使用攻略
  19. VMware Workstation16 安装win10教程
  20. 蘑菇街财报:短暂“盈利”惹众嘲

热门文章

  1. mysql数据库中查看当前使用的数据库是哪个数据库?
  2. 数据从SIM卡到服务器
  3. 普元nui:Lists列表
  4. ecshop网站搬家过程中数据库太大不好备份解决方案
  5. 可穿戴设备未来十大趋势
  6. layui复选框勾选取值
  7. java jna java.lang.UnsatisfiedLinkError: Unable to load library Native library (win32-x86-64/C:\User
  8. 第10章第18节:使用iSlide的全图幻灯片命令将所有内容都转为图片 [PowerPoint精美幻灯片实战教程]
  9. douyin 之xgorgon0404参数
  10. 百万级日活 App 的屏幕录制功能是如何实现的