0% found this document useful (0 votes)
56 views3 pages

c++11 Youcompleteme

This document contains the configuration file for YouCompleteMe, a code-completion engine for Vim. It defines compilation flags for C++11, sets the include path, and provides functions to retrieve flags for specific files based on the compilation database or default flags.

Uploaded by

Frankie Liu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views3 pages

c++11 Youcompleteme

This document contains the configuration file for YouCompleteMe, a code-completion engine for Vim. It defines compilation flags for C++11, sets the include path, and provides functions to retrieve flags for specific files based on the compilation database or default flags.

Uploaded by

Frankie Liu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

locojay / .ycm_extra_conf.

py
Last active 2 months ago • Report abuse

Embed <script src="https://gis Download ZIP

c++11 youcompleteme

.ycm_extra_conf.py

1 import os
2 import ycm_core
3 from clang_helpers import PrepareClangFlags
4
5 # Set this to the absolute path to the folder (NOT the file!) containing the
6 # compile_commands.json file to use that instead of 'flags'. See here for
7 # more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
8 # Most projects will NOT need to set this to anything; you can just change the
9 # 'flags' list of compilation flags. Notice that YCM itself uses that approach.
10 compilation_database_folder = ''
11
12 # These are the compilation flags that will be used in case there's no
13 # compilation database set.
14 flags = [
15 '-Wall',
16 '-std=c++11',
17 '-stdlib=libc++',
18 '-x',
19 'c++',
20 '-I',
21 '.',
22 '-isystem',
23 '/usr/lib/c++/v1'
24 ]
25
26 if compilation_database_folder:
27 database = ycm_core.CompilationDatabase(compilation_database_folder)
28 else:
29 database = None
30
31
32 def DirectoryOfThisScript():
33 return os.path.dirname(os.path.abspath(__file__))
34
35
36 def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
37 if not working_directory:
38 return flags
39 new_flags = []
40 make_next_absolute = False
41 path_flags = ['-isystem', '-I', '-iquote', '--sysroot=']
42 for flag in flags:
43 new_flag = flag
44
45 if make_next_absolute:
46 make_next_absolute = False
47 if not flag.startswith('/'):
48 new_flag = os.path.join(working_directory, flag)
49
50 for path_flag in path_flags:
51 if flag == path_flag:
52 make_next_absolute = True
53 break
54
55 if flag.startswith(path_flag):
56 path = flag[len(path_flag):]
57 new_flag = path_flag + os.path.join(working_directory, path)
58 break
59
60 if new_flag:
61 new_flags.append(new_flag)
62 return new_flags
63
64
65 def FlagsForFile(filename):
66 if database:
67 # Bear in mind that compilation_info.compiler_flags_ does NOT return a
68 # python list, but a "list-like" StringVec object
69 compilation_info = database.GetCompilationInfoForFile(filename)
70 final_flags = PrepareClangFlags(
71 MakeRelativePathsInFlagsAbsolute(
72 compilation_info.compiler_flags_,
73 compilation_info.compiler_working_dir_),
74 filename)
75 else:
76 relative_to = DirectoryOfThisScript()
77 final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to)
78
79 return {
80 'flags': final_flags,
81 'do_cache': True}

locojay commented on Feb 13, 2013 Author Owner

cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/ycm_temp/clang+llvm-3.2-x86_64-apple-darwin11 -


DPYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Headers -
DPYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Python . ~/.vim/bundle/YouCompleteMe/cpp

charpty commented on Jan 23, 2016

mark

nardoo commented on Dec 4, 2017

mark

greatyaqi commented on Apr 17, 2018

mark

7hgTnec commented on May 1, 2018

mark

kaustubhcs commented on Jun 28, 2018

mark
buhuipao commented on Apr 10

buhuipao commented on Apr 10

ulidtko commented on Sep 8

https://jonasdevlieghere.com/a-better-youcompleteme-config/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy