Last active
August 29, 2015 14:14
-
-
Save matthiasvegh/396986e9c81708dfcbb2 to your computer and use it in GitHub Desktop.
Script to retrieve compilation flags according to YouCompleteMe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
ycmpath = os.path.expanduser("~/.vim/bundle/YouCompleteMe") | |
def main(): | |
sys.path.insert(0, os.path.join(ycmpath, 'third_party/ycmd')) | |
sys.path.insert(0, os.path.join(ycmpath, 'third_party/ycmd/third_party/frozendict')) | |
import ycmd.completers.cpp.flags | |
import ycmd.user_options_store | |
ycmd.user_options_store.SetAll({'global_ycm_extra_conf': os.path.expanduser('~/.ycm_extra_conf.py'), 'confirm_extra_conf':False}) | |
flagsObject = ycmd.completers.cpp.flags.Flags() | |
result = flagsObject.FlagsForFile(sys.argv[1]) | |
output = "" | |
for i in range(len(result)): | |
output += " "+result[i] | |
print output | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment