1
0

youcompleteme.txt 173 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904
  1. *youcompleteme* YouCompleteMe: a code-completion engine for Vim
  2. ===============================================================================
  3. Contents ~
  4. 1. Introduction |youcompleteme-introduction|
  5. 2. Help, Advice, Support |youcompleteme-help-advice-support|
  6. 3. Contents |youcompleteme-contents|
  7. 4. Intro |youcompleteme-intro|
  8. 5. Installation |youcompleteme-installation|
  9. 1. macOS |youcompleteme-macos|
  10. 2. Linux 64-bit |youcompleteme-linux-64-bit|
  11. 3. Windows |youcompleteme-windows|
  12. 4. FreeBSD/OpenBSD |youcompleteme-freebsd-openbsd|
  13. 5. Full Installation Guide |youcompleteme-full-installation-guide|
  14. 6. Quick Feature Summary |youcompleteme-quick-feature-summary|
  15. 1. General (all languages) |youcompleteme-general|
  16. 2. C-family languages (C, C++, Objective C, Objective C++, CUDA) |youcompleteme-c-family-languages|
  17. 3. C♯ |youcompleteme-c|
  18. 4. Python |youcompleteme-python|
  19. 5. Go |youcompleteme-go|
  20. 6. JavaScript and TypeScript |youcompleteme-javascript-typescript|
  21. 7. Rust |youcompleteme-rust|
  22. 8. Java |youcompleteme-java|
  23. 7. User Guide |youcompleteme-user-guide|
  24. 1. General Usage |youcompleteme-general-usage|
  25. 2. Client-Server Architecture |youcompleteme-client-server-architecture|
  26. 3. Completion String Ranking |youcompleteme-completion-string-ranking|
  27. 4. General Semantic Completion |youcompleteme-general-semantic-completion|
  28. 5. C-family Semantic Completion |youcompleteme-c-family-semantic-completion|
  29. 1. Option 1: Use a compilation database [44] |youcompleteme-option-1-use-compilation-database-44|
  30. 2. Option 2: Provide the flags manually |youcompleteme-option-2-provide-flags-manually|
  31. 3. Errors during compilation |youcompleteme-errors-during-compilation|
  32. 4. Selecting a C-family completion engine |youcompleteme-selecting-c-family-completion-engine|
  33. 6. Java Semantic Completion |youcompleteme-java-semantic-completion|
  34. 1. Java quick Start |youcompleteme-java-quick-start|
  35. 2. Java Project Files |youcompleteme-java-project-files|
  36. 3. Diagnostic display - Syntastic |youcompleteme-diagnostic-display-syntastic|
  37. 4. Diagnostic display - Eclim |youcompleteme-diagnostic-display-eclim|
  38. 5. Eclipse Projects |youcompleteme-eclipse-projects|
  39. 6. Maven Projects |youcompleteme-maven-projects|
  40. 7. Gradle Projects |youcompleteme-gradle-projects|
  41. 8. Troubleshooting |youcompleteme-troubleshooting|
  42. 7. Python Semantic Completion |youcompleteme-python-semantic-completion|
  43. 1. Working with virtual environments |youcompleteme-working-with-virtual-environments|
  44. 2. Working with third-party packages |youcompleteme-working-with-third-party-packages|
  45. 3. Configuring through Vim options |youcompleteme-configuring-through-vim-options|
  46. 8. Rust Semantic Completion |youcompleteme-rust-semantic-completion|
  47. 9. JavaScript and TypeScript Semantic Completion |youcompleteme-javascript-typescript-semantic-completion|
  48. 10. Semantic Completion for Other Languages |youcompleteme-semantic-completion-for-other-languages|
  49. 11. Writing New Semantic Completers |youcompleteme-writing-new-semantic-completers|
  50. 12. Diagnostic Display |youcompleteme-diagnostic-display|
  51. 1. Diagnostic Highlighting Groups |youcompleteme-diagnostic-highlighting-groups|
  52. 8. Commands |youcompleteme-commands|
  53. 1. The |:YcmRestartServer| command
  54. 2. The |:YcmForceCompileAndDiagnostics| command
  55. 3. The |:YcmDiags| command
  56. 4. The |:YcmShowDetailedDiagnostic| command
  57. 5. The |:YcmDebugInfo| command
  58. 6. The |:YcmToggleLogs| command
  59. 7. The |:YcmCompleter| command
  60. 9. YcmCompleter Subcommands |youcompleteme-ycmcompleter-subcommands|
  61. 1. GoTo Commands |youcompleteme-goto-commands|
  62. 1. The |GoToInclude| subcommand
  63. 2. The |GoToDeclaration| subcommand
  64. 3. The |GoToDefinition| subcommand
  65. 4. The |GoTo| subcommand
  66. 5. The |GoToImprecise| subcommand
  67. 6. The |GoToReferences| subcommand
  68. 7. The |GoToImplementation| subcommand
  69. 8. The |GoToImplementationElseDeclaration| subcommand
  70. 9. The |GoToType| subcommand
  71. 2. Semantic Information Commands |youcompleteme-semantic-information-commands|
  72. 1. The |GetType| subcommand
  73. 2. The |GetTypeImprecise| subcommand
  74. 3. The |GetParent| subcommand
  75. 4. The |GetDoc| subcommand
  76. 5. The |GetDocImprecise| subcommand
  77. 3. Refactoring Commands |youcompleteme-refactoring-commands|
  78. 1. The |FixIt| subcommand
  79. 2. The 'RefactorRename <new name>' subcommand |RefactorRename-new-name|
  80. 3. Multi-file Refactor |youcompleteme-multi-file-refactor|
  81. 4. The |Format| subcommand
  82. 5. The |OrganizeImports| subcommand
  83. 4. Miscellaneous Commands |youcompleteme-miscellaneous-commands|
  84. 1. The |RestartServer| subcommand
  85. 2. The |ClearCompilationFlagCache| subcommand
  86. 3. The |ReloadSolution| subcommand
  87. 10. Functions |youcompleteme-functions|
  88. 1. The |youcompleteme#GetErrorCount| function
  89. 2. The |youcompleteme#GetWarningCount| function
  90. 11. Autocommands |youcompleteme-autocommands|
  91. 1. The |YcmLocationOpened| autocommand
  92. 2. The |YcmQuickFixOpened| autocommand
  93. 12. Options |youcompleteme-options|
  94. 1. The |g:ycm_min_num_of_chars_for_completion| option
  95. 2. The |g:ycm_min_num_identifier_candidate_chars| option
  96. 3. The |g:ycm_max_num_candidates| option
  97. 4. The |g:ycm_max_num_identifier_candidates| option
  98. 5. The |g:ycm_auto_trigger| option
  99. 6. The |g:ycm_filetype_whitelist| option
  100. 7. The |g:ycm_filetype_blacklist| option
  101. 8. The |g:ycm_filetype_specific_completion_to_disable| option
  102. 9. The |g:ycm_filepath_blacklist| option
  103. 10. The |g:ycm_show_diagnostics_ui| option
  104. 11. The |g:ycm_error_symbol| option
  105. 12. The |g:ycm_warning_symbol| option
  106. 13. The |g:ycm_enable_diagnostic_signs| option
  107. 14. The |g:ycm_enable_diagnostic_highlighting| option
  108. 15. The |g:ycm_echo_current_diagnostic| option
  109. 16. The |g:ycm_filter_diagnostics| option
  110. 17. The |g:ycm_always_populate_location_list| option
  111. 18. The |g:ycm_open_loclist_on_ycm_diags| option
  112. 19. The |g:ycm_complete_in_comments| option
  113. 20. The |g:ycm_complete_in_strings| option
  114. 21. The |g:ycm_collect_identifiers_from_comments_and_strings| option
  115. 22. The |g:ycm_collect_identifiers_from_tags_files| option
  116. 23. The |g:ycm_seed_identifiers_with_syntax| option
  117. 24. The |g:ycm_extra_conf_vim_data| option
  118. 25. The |g:ycm_server_python_interpreter| option
  119. 26. The |g:ycm_keep_logfiles| option
  120. 27. The |g:ycm_log_level| option
  121. 28. The |g:ycm_auto_start_csharp_server| option
  122. 29. The |g:ycm_auto_stop_csharp_server| option
  123. 30. The |g:ycm_csharp_server_port| option
  124. 31. The |g:ycm_csharp_insert_namespace_expr| option
  125. 32. The |g:ycm_add_preview_to_completeopt| option
  126. 33. The |g:ycm_autoclose_preview_window_after_completion| option
  127. 34. The |g:ycm_autoclose_preview_window_after_insertion| option
  128. 35. The |g:ycm_max_diagnostics_to_display| option
  129. 36. The |g:ycm_key_list_select_completion| option
  130. 37. The |g:ycm_key_list_previous_completion| option
  131. 38. The |g:ycm_key_list_stop_completion| option
  132. 39. The |g:ycm_key_invoke_completion| option
  133. 40. The |g:ycm_key_detailed_diagnostics| option
  134. 41. The |g:ycm_global_ycm_extra_conf| option
  135. 42. The |g:ycm_confirm_extra_conf| option
  136. 43. The |g:ycm_extra_conf_globlist| option
  137. 44. The |g:ycm_filepath_completion_use_working_dir| option
  138. 45. The |g:ycm_semantic_triggers| option
  139. 46. The |g:ycm_cache_omnifunc| option
  140. 47. The |g:ycm_use_ultisnips_completer| option
  141. 48. The |g:ycm_goto_buffer_command| option
  142. 49. The |g:ycm_disable_for_files_larger_than_kb| option
  143. 50. The |g:ycm_use_clangd| option
  144. 51. The |g:ycm_clangd_binary_path| option
  145. 52. The |g:ycm_clangd_args| option
  146. 53. The |g:ycm_clangd_uses_ycmd_caching| option
  147. 13. FAQ |youcompleteme-faq|
  148. 1. I used to be able to 'import vim' in '.ycm_extra_conf.py', but now can't |youcompleteme-i-used-to-be-able-to-import-vim-in-.ycm_extra_conf.py-but-now-cant|
  149. 2. I get 'ImportError' exceptions that mention 'PyInit_ycm_core' or 'initycm_core' |youcompleteme-i-get-importerror-exceptions-that-mention-pyinit_ycm_core-or-initycm_core|
  150. 3. I get a linker warning regarding 'libpython' on macOS when compiling YCM |youcompleteme-i-get-linker-warning-regarding-libpython-on-macos-when-compiling-ycm|
  151. 4. I get a weird window at the top of my file when I use the semantic engine |youcompleteme-i-get-weird-window-at-top-of-my-file-when-i-use-semantic-engine|
  152. 5. It appears that YCM is not working |youcompleteme-it-appears-that-ycm-is-not-working|
  153. 6. Sometimes it takes much longer to get semantic completions than normal |youcompleteme-sometimes-it-takes-much-longer-to-get-semantic-completions-than-normal|
  154. 7. YCM auto-inserts completion strings I don't want! |youcompleteme-ycm-auto-inserts-completion-strings-i-dont-want|
  155. 8. I get a 'E227: mapping already exists for <blah>' error when I start Vim |youcompleteme-i-get-e227-mapping-already-exists-for-blah-error-when-i-start-vim|
  156. 9. I get "'GLIBC_2.XX' not found (required by libclang.so)" when starting Vim |youcompleteme-i-get-glibc_2.xx-not-found-when-starting-vim|
  157. 10. I get 'LONG_BIT definition appears wrong for platform' when compiling |youcompleteme-i-get-long_bit-definition-appears-wrong-for-platform-when-compiling|
  158. 11. I get 'libpython2.7.a [...] relocation R_X86_64_32' when compiling |youcompleteme-i-get-libpython2.7.a-...-relocation-r_x86_64_32-when-compiling|
  159. 12. I see 'undefined symbol: clang_getCompletionFixIt' in the server logs. |youcompleteme-i-see-undefined-symbol-clang_getcompletionfixit-in-server-logs.|
  160. 13. I get 'Fatal Python error: PyThreadState_Get: no current thread' on startup |youcompleteme-i-get-fatal-python-error-pythreadstate_get-no-current-thread-on-startup|
  161. 14. 'install.py' says python must be compiled with '--enable-framework'. Wat? |youcompleteme-install.py-says-python-must-be-compiled-with-enable-framework-.-wat|
  162. 15. YCM does not read identifiers from my tags files |youcompleteme-ycm-does-not-read-identifiers-from-my-tags-files|
  163. 16. 'CTRL-U' in insert mode does not work while the completion menu is visible |youcompleteme-ctrl-u-in-insert-mode-does-not-work-while-completion-menu-is-visible|
  164. 17. My 'CTRL-R' mapping does not work while the completion menu is visible |youcompleteme-my-ctrl-r-mapping-does-not-work-while-completion-menu-is-visible|
  165. 18. YCM conflicts with UltiSnips TAB key usage |youcompleteme-ycm-conflicts-with-ultisnips-tab-key-usage|
  166. 19. Snippets added with ':UltiSnipsAddFiletypes' do not appear in the popup menu |youcompleteme-snippets-added-with-ultisnipsaddfiletypes-do-not-appear-in-popup-menu|
  167. 20. Why isn't YCM just written in plain VimScript, FFS? |youcompleteme-why-isnt-ycm-just-written-in-plain-vimscript-ffs|
  168. 21. Why does YCM demand such a recent version of Vim? |youcompleteme-why-does-ycm-demand-such-recent-version-of-vim|
  169. 22. Nasty bugs happen if I have the 'vim-autoclose' plugin installed |youcompleteme-nasty-bugs-happen-if-i-have-vim-autoclose-plugin-installed|
  170. 23. Is there some sort of YCM mailing list? I have questions |youcompleteme-is-there-sort-of-ycm-mailing-list-i-have-questions|
  171. 24. I get an internal compiler error when installing |youcompleteme-i-get-an-internal-compiler-error-when-installing|
  172. 25. I get weird errors when I press 'Ctrl-C' in Vim |youcompleteme-i-get-weird-errors-when-i-press-ctrl-c-in-vim|
  173. 26. Why did YCM stop using Syntastic for diagnostics display? |youcompleteme-why-did-ycm-stop-using-syntastic-for-diagnostics-display|
  174. 27. Completion doesn't work with the C++ standard library headers |youcompleteme-completion-doesnt-work-with-c-standard-library-headers|
  175. 28. When I start vim I get a runtime error saying 'R6034 An application has made an
  176. attempt to load the C runtime library incorrectly.' |youcompleteme-when-i-start-vim-i-get-runtime-error-saying-r6034-an-application-has-made-an-attempt-to-load-c-runtime-library-incorrectly.|
  177. 29. I hear that YCM only supports Python 2, is that true? |youcompleteme-i-hear-that-ycm-only-supports-python-2-is-that-true|
  178. 30. On Windows I get "E887: Sorry, this command is disabled, the Python's site
  179. module could not be loaded" |youcompleteme-on-windows-i-get-e887-sorry-this-command-is-disabled-pythons-site-module-could-not-be-loaded|
  180. 31. I can't complete Python packages in a virtual environment. |youcompleteme-i-cant-complete-python-packages-in-virtual-environment.|
  181. 32. I want to defer loading of YouCompleteMe until after Vim finishes booting |i-want-to-defer-loading-of-youcompleteme-until-after-vim-finishes-booting|
  182. 33. YCM does not shut down when I quit Vim |youcompleteme-ycm-does-not-shut-down-when-i-quit-vim|
  183. 34. YCM does not work with my Anaconda Python setup |youcompleteme-ycm-does-not-work-with-my-anaconda-python-setup|
  184. 35. Automatic import insertion after selecting a completion breaks undo |youcompleteme-automatic-import-insertion-after-selecting-completion-breaks-undo|
  185. 36. 'TAB' is already mapped to trigger completion in the command-line window |youcompleteme-tab-is-already-mapped-to-trigger-completion-in-command-line-window|
  186. 14. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct|
  187. 15. Contact |youcompleteme-contact|
  188. 16. License |youcompleteme-license|
  189. 17. References |youcompleteme-references|
  190. ===============================================================================
  191. *youcompleteme-introduction*
  192. Introduction ~
  193. Image: Gitter room [1] Image: Build status [3] Image: Coverage status [5]
  194. ===============================================================================
  195. *youcompleteme-help-advice-support*
  196. Help, Advice, Support ~
  197. Looking for help, advice or support? Having problems getting YCM to work?
  198. First carefully read the installation instructions for your OS. We recommend
  199. you use the supplied 'install.py'.
  200. Next check the User Guide section on the semantic completer that you are using.
  201. For C/C++/Objective-C/Objective-C++/CUDA, you _must_ read this section.
  202. Finally, check the FAQ.
  203. If, after reading the installation and user guides, and checking the FAQ,
  204. you're still having trouble, check the contacts section below for how to get in
  205. touch.
  206. Please do **NOT** go to #vim on freenode for support. Please contact the
  207. YouCompleteMe maintainers directly using the contact details below.
  208. ===============================================================================
  209. *youcompleteme-contents*
  210. Contents ~
  211. - Intro
  212. - Installation
  213. - macOS
  214. - Linux 64-bit
  215. - Windows
  216. - FreeBSD/OpenBSD
  217. - Full Installation Guide
  218. - Quick Feature Summary
  219. - User Guide
  220. - General Usage
  221. - Client-Server Architecture
  222. - Completion String Ranking
  223. - General Semantic Completion
  224. - C-family Semantic Completion
  225. - Java Semantic Completion
  226. - Python Semantic Completion
  227. - Rust Semantic Completion
  228. - JavaScript and TypeScript Semantic Completion
  229. - Semantic Completion for Other Languages
  230. - Writing New Semantic Completers
  231. - Diagnostic Display
  232. - Diagnostic Highlighting Groups
  233. - Commands
  234. - YcmCompleter subcommands
  235. - GoTo Commands
  236. - Semantic Information Commands
  237. - Refactoring Commands
  238. - Miscellaneous Commands
  239. - Functions
  240. - Autocommands
  241. - Options
  242. - FAQ
  243. - Contributor Code of Conduct
  244. - Contact
  245. - License
  246. ===============================================================================
  247. *youcompleteme-intro*
  248. Intro ~
  249. YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for
  250. Vim. It has several completion engines:
  251. - an identifier-based engine that works with every programming language,
  252. - a Clang [7]-based engine that provides native semantic code completion for
  253. C/C++/Objective-C/Objective-C++/CUDA (from now on referred to as "the
  254. C-family languages"),
  255. - a clangd [8]-based **experimental** completion engine for the C-family
  256. languages.
  257. - a Jedi [9]-based completion engine for Python 2 and 3,
  258. - an OmniSharp [10]-based completion engine for C#,
  259. - a combination of Gocode [11] and Godef [12] semantic engines for Go,
  260. - a TSServer [13]-based completion engine for JavaScript and TypeScript,
  261. - a racer [14]-based completion engine for Rust,
  262. - a jdt.ls [15]-based experimental completion engine for Java.
  263. - and an omnifunc-based completer that uses data from Vim's omnicomplete
  264. system to provide semantic completions for many other languages (Ruby, PHP
  265. etc.).
  266. Image: YouCompleteMe GIF demo (see reference [16])
  267. Here's an explanation of what happens in the short GIF demo above.
  268. First, realize that **no keyboard shortcuts had to be pressed** to get the list
  269. of completion candidates at any point in the demo. The user just types and the
  270. suggestions pop up by themselves. If the user doesn't find the completion
  271. suggestions relevant and/or just wants to type, they can do so; the completion
  272. engine will not interfere.
  273. When the user sees a useful completion string being offered, they press the TAB
  274. key to accept it. This inserts the completion string. Repeated presses of the
  275. TAB key cycle through the offered completions.
  276. If the offered completions are not relevant enough, the user can continue
  277. typing to further filter out unwanted completions.
  278. A critical thing to notice is that the completion **filtering is NOT based on
  279. the input being a string prefix of the completion** (but that works too). The
  280. input needs to be a _subsequence [17] match_ of a completion. This is a fancy
  281. way of saying that any input characters need to be present in a completion
  282. string in the order in which they appear in the input. So 'abc' is a
  283. subsequence of 'xaybgc', but not of 'xbyxaxxc'. After the filter, a complicated
  284. sorting system ranks the completion strings so that the most relevant ones rise
  285. to the top of the menu (so you usually need to press TAB just once).
  286. **All of the above works with any programming language** because of the
  287. identifier-based completion engine. It collects all of the identifiers in the
  288. current file and other files you visit (and your tags files) and searches them
  289. when you type (identifiers are put into per-filetype groups).
  290. The demo also shows the semantic engine in use. When the user presses '.', '->'
  291. or '::' while typing in insert mode (for C++; different triggers are used for
  292. other languages), the semantic engine is triggered (it can also be triggered
  293. with a keyboard shortcut; see the rest of the docs).
  294. The last thing that you can see in the demo is YCM's diagnostic display
  295. features (the little red X that shows up in the left gutter; inspired by
  296. Syntastic [18]) if you are editing a C-family file. As the completer engine
  297. compiles your file and detects warnings or errors, they will be presented in
  298. various ways. You don't need to save your file or press any keyboard shortcut
  299. to trigger this, it "just happens" in the background.
  300. In essence, YCM obsoletes the following Vim plugins because it has all of their
  301. features plus extra:
  302. - clang_complete
  303. - AutoComplPop
  304. - Supertab
  305. - neocomplcache
  306. **And that's not all...**
  307. YCM also provides semantic IDE-like features in a number of languages,
  308. including:
  309. - finding declarations, definitions, usages, etc. of identifiers,
  310. - displaying type information for classes, variables, functions etc.,
  311. - displaying documentation for methods, members, etc. in the preview window,
  312. - fixing common coding errors, like missing semi-colons, typos, etc.,
  313. - semantic renaming of variables across files,
  314. - formatting code,
  315. - removing unused imports, sorting imports, etc.
  316. Features vary by file type, so make sure to check out the file type feature
  317. summary and the full list of completer subcommands to find out what's available
  318. for your favourite languages.
  319. You'll also find that YCM has filepath completers (try typing './' in a file)
  320. and a completer that integrates with UltiSnips [19].
  321. ===============================================================================
  322. *youcompleteme-installation*
  323. Installation ~
  324. -------------------------------------------------------------------------------
  325. *youcompleteme-macos*
  326. macOS ~
  327. These instructions (using 'install.py') are the quickest way to install
  328. YouCompleteMe, however they may not work for everyone. If the following
  329. instructions don't work for you, check out the full installation guide.
  330. MacVim [20] is required. YCM won't work with the pre-installed Vim from Apple
  331. as its Python support is broken. If you don't already use MacVim [20], install
  332. it with Homebrew [21]. Install CMake as well:
  333. >
  334. brew install cmake macvim
  335. <
  336. **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
  337. using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
  338. will notify you to recompile it. You should then rerun the install process.
  339. **NOTE:** If you want C-family completion, you MUST have the latest Xcode
  340. installed along with the latest Command Line Tools (they are installed
  341. automatically when you run 'clang' for the first time, or manually by running
  342. 'xcode-select --install')
  343. Compiling YCM **with** semantic support for C-family languages through
  344. **libclang**:
  345. >
  346. cd ~/.vim/bundle/YouCompleteMe
  347. ./install.py --clang-completer
  348. <
  349. Compiling YCM **with** semantic support for C-family languages through
  350. **experimental clangd**:
  351. >
  352. cd ~/.vim/bundle/YouCompleteMe
  353. ./install.py --clangd-completer
  354. <
  355. Note that you can install YCM with both **libclang** and **clangd** enabled. In
  356. that case **clangd** will be preferred unless you have the following in your
  357. 'vimrc':
  358. >
  359. let g:ycm_use_clangd = 0
  360. <
  361. Compiling YCM **without** semantic support for C-family languages:
  362. >
  363. cd ~/.vim/bundle/YouCompleteMe
  364. ./install.py
  365. <
  366. The following additional language support options are available:
  367. - C# support: install Mono with Homebrew [21] or by downloading the Mono
  368. macOS package [22] and add '--cs-completer' when calling 'install.py'.
  369. - Go support: install Go [23] and add '--go-completer' when calling
  370. 'install.py'.
  371. - JavaScript and TypeScript support: install Node.js and npm [24] and add
  372. '--ts-completer' when calling 'install.py'.
  373. - Rust support: install Rust [25] and add '--rust-completer' when calling
  374. 'install.py'.
  375. - Java support: install JDK8 (version 8 required) [26] and add
  376. '--java-completer' when calling 'install.py'.
  377. To simply compile with everything enabled, there's a '--all' flag. Note that
  378. this flag does **not** install **clangd**. You need to specify it manually by
  379. adding '--clangd-completer'. So, to install with all language features, ensure
  380. 'xbuild', 'go', 'tsserver', 'node', 'npm', 'rustc', and 'cargo' tools are
  381. installed and in your 'PATH', then simply run:
  382. >
  383. cd ~/.vim/bundle/YouCompleteMe
  384. ./install.py --all
  385. <
  386. That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
  387. Don't forget that if you want the C-family semantic completion engine to work,
  388. you will need to provide the compilation flags for your project to YCM. It's
  389. all in the User Guide.
  390. YCM comes with sane defaults for its options, but you still may want to take a
  391. look at what's available for configuration. There are a few interesting options
  392. that are conservatively turned off by default that you may want to turn on.
  393. -------------------------------------------------------------------------------
  394. *youcompleteme-linux-64-bit*
  395. Linux 64-bit ~
  396. These instructions (using 'install.py') are the quickest way to install
  397. YouCompleteMe, however they may not work for everyone. If the following
  398. instructions don't work for you, check out the full installation guide.
  399. Make sure you have Vim 7.4.1578 with Python 2 or Python 3 support. The Vim
  400. package on Fedora 27 and later and the pre-installed Vim on Ubuntu 16.04 and
  401. later are recent enough. You can see the version of Vim installed by running
  402. 'vim --version'. If the version is too old, you may need to compile Vim from
  403. source [27] (don't worry, it's easy).
  404. Install YouCompleteMe with Vundle [28].
  405. **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
  406. using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
  407. will notify you to recompile it. You should then rerun the install process.
  408. Install development tools, CMake, and Python headers:
  409. - Fedora 27 and later:
  410. sudo dnf install cmake gcc-c++ make python3-devel
  411. - Ubuntu 14.04:
  412. sudo apt install build-essential cmake3 python3-dev
  413. - Ubuntu 16.04 and later:
  414. sudo apt install build-essential cmake python3-dev
  415. Compiling YCM **with** semantic support for C-family languages through
  416. **libclang**:
  417. >
  418. cd ~/.vim/bundle/YouCompleteMe
  419. ./install.py --clang-completer
  420. <
  421. Compiling YCM **with** semantic support for C-family languages through
  422. **experimental clangd**:
  423. >
  424. cd ~/.vim/bundle/YouCompleteMe
  425. ./install.py --clangd-completer
  426. <
  427. Note that you can install YCM with both **libclang** and **clangd** enabled. In
  428. that case **clangd** will be preferred unless you have the following in your
  429. 'vimrc':
  430. >
  431. let g:ycm_use_clangd = 0
  432. <
  433. Compiling YCM **without** semantic support for C-family languages:
  434. >
  435. cd ~/.vim/bundle/YouCompleteMe
  436. python3 install.py
  437. <
  438. The following additional language support options are available:
  439. - C# support: install Mono [29] and add '--cs-completer' when calling
  440. 'install.py'.
  441. - Go support: install Go [23] and add '--go-completer' when calling
  442. 'install.py'.
  443. - JavaScript and TypeScript support: install Node.js and npm [24] and add
  444. '--ts-completer' when calling 'install.py'.
  445. - Rust support: install Rust [25] and add '--rust-completer' when calling
  446. 'install.py'.
  447. - Java support: install JDK8 (version 8 required) [26] and add
  448. '--java-completer' when calling 'install.py'.
  449. To simply compile with everything enabled, there's a '--all' flag. Note that
  450. this flag does **not** install **clangd**. You need to specify it manually by
  451. adding '--clangd-completer'. So, to install with all language features, ensure
  452. 'xbuild', 'go', 'tsserver', 'node', 'npm', 'rustc', and 'cargo' tools are
  453. installed and in your 'PATH', then simply run:
  454. >
  455. cd ~/.vim/bundle/YouCompleteMe
  456. python3 install.py --all
  457. <
  458. That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
  459. Don't forget that if you want the C-family semantic completion engine to work,
  460. you will need to provide the compilation flags for your project to YCM. It's
  461. all in the User Guide.
  462. YCM comes with sane defaults for its options, but you still may want to take a
  463. look at what's available for configuration. There are a few interesting options
  464. that are conservatively turned off by default that you may want to turn on.
  465. -------------------------------------------------------------------------------
  466. *youcompleteme-windows*
  467. Windows ~
  468. These instructions (using 'install.py') are the quickest way to install
  469. YouCompleteMe, however they may not work for everyone. If the following
  470. instructions don't work for you, check out the full installation guide.
  471. **Important:** we assume that you are using the 'cmd.exe' command prompt and
  472. that you know how to add an executable to the PATH environment variable.
  473. Make sure you have at least Vim 7.4.1578 with Python 2 or Python 3 support. You
  474. can check the version and which Python is supported by typing ':version' inside
  475. Vim. Look at the features included: '+python/dyn' for Python 2 and
  476. '+python3/dyn' for Python 3. Take note of the Vim architecture, i.e. 32 or
  477. 64-bit. It will be important when choosing the Python installer. We recommend
  478. using a 64-bit client. Daily updated installers of 32-bit and 64-bit Vim with
  479. Python 2 and Python 3 support [30] are available.
  480. Add the line:
  481. >
  482. set encoding=utf-8
  483. <
  484. to your vimrc [31] if not already present. This option is required by YCM. Note
  485. that it does not prevent you from editing a file in another encoding than
  486. UTF-8. You can do that by specifying the '|++enc|' argument to the ':e'
  487. command.
  488. Install YouCompleteMe with Vundle [28].
  489. **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
  490. using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
  491. will notify you to recompile it. You should then rerun the install process.
  492. Download and install the following software:
  493. - Python 2 or Python 3 [32]. Be sure to pick the version corresponding to
  494. your Vim architecture. It is _Windows x86_ for a 32-bit Vim and _Windows
  495. x86-64_ for a 64-bit Vim. We recommend installing Python 3. Additionally,
  496. the version of Python you install must match up exactly with the version of
  497. Python that Vim is looking for. Type ':version' and look at the bottom of
  498. the page at the list of compiler flags. Look for flags that look similar to
  499. '-DDYNAMIC_PYTHON_DLL=\"python27.dll\"' and
  500. '-DDYNAMIC_PYTHON3_DLL=\"python35.dll\"'. The former indicates that Vim is
  501. looking for Python 2.7 and the latter indicates that Vim is looking for
  502. Python 3.5. You'll need one or the other installed, matching the version
  503. number exactly.
  504. - CMake [33]. Add CMake executable to the PATH environment variable.
  505. - Visual Studio Build Tools 2017 [34]. During setup, select _Visual C++ build
  506. tools_ in _Workloads_.
  507. Compiling YCM **with** semantic support for C-family languages through
  508. **libclang**:
  509. >
  510. cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
  511. python install.py --clang-completer
  512. <
  513. Compiling YCM **with** semantic support for C-family languages through
  514. **experimental clangd**:
  515. >
  516. cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
  517. python install.py --clangd-completer
  518. <
  519. Note that you can install YCM with both **libclang** and **clangd** enabled. In
  520. that case **clangd** will be preferred unless you have the following in your
  521. 'vimrc':
  522. >
  523. let g:ycm_use_clangd = 0
  524. <
  525. Compiling YCM **without** semantic support for C-family languages:
  526. >
  527. cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
  528. python install.py
  529. <
  530. The following additional language support options are available:
  531. - C# support: add '--cs-completer' when calling 'install.py'. Be sure that
  532. the build utility 'msbuild' is in your PATH [35].
  533. - Go support: install Go [23] and add '--go-completer' when calling
  534. 'install.py'.
  535. - JavaScript and TypeScript support: install Node.js and npm [24] and add
  536. '--ts-completer' when calling 'install.py'.
  537. - Rust support: install Rust [25] and add '--rust-completer' when calling
  538. 'install.py'.
  539. - Java support: install JDK8 (version 8 required) [26] and add
  540. '--java-completer' when calling 'install.py'.
  541. To simply compile with everything enabled, there's a '--all' flag. Note that
  542. this flag does **not** install **clangd**. You need to specify it manually by
  543. adding '--clangd-completer'. So, to install with all language features, ensure
  544. 'msbuild', 'go', 'tsserver', 'node', 'npm', and 'cargo' tools are installed and
  545. in your 'PATH', then simply run:
  546. >
  547. cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
  548. python install.py --all
  549. <
  550. You can specify the Microsoft Visual C++ (MSVC) version using the '--msvc'
  551. option. YCM officially supports MSVC 14 (Visual Studio 2015) and 15 (2017).
  552. That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
  553. Don't forget that if you want the C-family semantic completion engine to work,
  554. you will need to provide the compilation flags for your project to YCM. It's
  555. all in the User Guide.
  556. YCM comes with sane defaults for its options, but you still may want to take a
  557. look at what's available for configuration. There are a few interesting options
  558. that are conservatively turned off by default that you may want to turn on.
  559. -------------------------------------------------------------------------------
  560. *youcompleteme-freebsd-openbsd*
  561. FreeBSD/OpenBSD ~
  562. These instructions (using 'install.py') are the quickest way to install
  563. YouCompleteMe, however they may not work for everyone. If the following
  564. instructions don't work for you, check out the full installation guide.
  565. **NOTE:** OpenBSD / FreeBSD are not officially supported platforms by YCM.
  566. Make sure you have Vim 7.4.1578 with Python 2 or Python 3 support.
  567. OpenBSD 5.5 and later have a Vim that's recent enough. You can see the version
  568. of Vim installed by running 'vim --version'.
  569. For FreeBSD 11.x, the requirement is cmake:
  570. >
  571. pkg install cmake
  572. <
  573. Install YouCompleteMe with Vundle [28].
  574. **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
  575. using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
  576. will notify you to recompile it. You should then rerun the install process.
  577. Compiling YCM **with** semantic support for C-family languages through
  578. **libclang**:
  579. >
  580. cd ~/.vim/bundle/YouCompleteMe
  581. ./install.py --clang-completer
  582. <
  583. Compiling YCM **with** semantic support for C-family languages through
  584. **experimental clangd**:
  585. >
  586. cd ~/.vim/bundle/YouCompleteMe
  587. ./install.py --clangd-completer
  588. <
  589. Note that you can install YCM with both **libclang** and **clangd** enabled. In
  590. that case **clangd** will be preferred unless you have the following in your
  591. 'vimrc':
  592. >
  593. let g:ycm_use_clangd = 0
  594. <
  595. Compiling YCM **without** semantic support for C-family languages:
  596. >
  597. cd ~/.vim/bundle/YouCompleteMe
  598. ./install.py
  599. <
  600. If the 'python' executable is not present, or the default 'python' is not the
  601. one that should be compiled against, specify the python interpreter explicitly:
  602. >
  603. python3 install.py --clang-completer
  604. <
  605. The following additional language support options are available:
  606. - C# support: install Mono and add '--cs-completer' when calling
  607. './install.py'.
  608. - Go support: install Go [23] and add '--go-completer' when calling
  609. './install.py'.
  610. - JavaScript and TypeScript support: install Node.js and npm [24] and add
  611. '--ts-completer' when calling 'install.py'.
  612. - Rust support: install Rust [25] and add '--rust-completer' when calling
  613. './install.py'.
  614. - Java support: install JDK8 (version 8 required) [26] and add
  615. '--java-completer' when calling './install.py'.
  616. To simply compile with everything enabled, there's a '--all' flag. Note that
  617. this flag does **not** install **clangd**. You need to specify it manually by
  618. adding '--clangd-completer'. So, to install with all language features, ensure
  619. 'xbuild', 'go', 'tsserver', 'node', 'npm', 'rustc', and 'cargo' tools are
  620. installed and in your 'PATH', then simply run:
  621. >
  622. cd ~/.vim/bundle/YouCompleteMe
  623. ./install.py --all
  624. <
  625. That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
  626. Don't forget that if you want the C-family semantic completion engine to work,
  627. you will need to provide the compilation flags for your project to YCM. It's
  628. all in the User Guide.
  629. YCM comes with sane defaults for its options, but you still may want to take a
  630. look at what's available for configuration. There are a few interesting options
  631. that are conservatively turned off by default that you may want to turn on.
  632. -------------------------------------------------------------------------------
  633. *youcompleteme-full-installation-guide*
  634. Full Installation Guide ~
  635. These are the steps necessary to get YCM working on a Unix OS and on Windows.
  636. **Note to Windows users:** we assume that you are running the 'cmd.exe' command
  637. prompt and that the needed executables are in the PATH environment variable. Do
  638. not just copy the shell commands. Replace '~' by '%USERPROFILE%' in them and
  639. use the right Vim home directory. It should be 'vimfiles' by default instead of
  640. '.vim'.
  641. See the _FAQ_ if you have any issues.
  642. **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
  643. using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
  644. will notify you to recompile it. You should then rerun the install process.
  645. **Please follow the instructions carefully. Read EVERY WORD.**
  646. 1. **Ensure that your version of Vim is _at least_ 7.4.1578 _and_ that it
  647. has support for Python 2 or Python 3 scripting**.
  648. Inside Vim, type ':version'. Look at the first two to three lines of
  649. output; it should say 'Vi IMproved X.Y', where X.Y is the major version
  650. of vim. If your version is greater than 7.4, then you're all set. If your
  651. version is 7.4 then look below that where it says, 'Included patches:
  652. 1-Z', where Z will be some number. That number needs to be 1578 or
  653. higher.
  654. If your version of Vim is not recent enough, you may need to compile Vim
  655. from source [27] (don't worry, it's easy).
  656. After you have made sure that you have Vim 7.4.1578+, type the following
  657. in Vim: ":echo has('python') || has('python3')". The output should be 1.
  658. If it's 0, then get a version of Vim with Python support.
  659. On Windows, check also if your Vim architecture is 32 or 64-bit. This is
  660. critical because it must match the Python and the YCM libraries
  661. architectures. We recommend using a 64-bit Vim.
  662. 2. **Install YCM** with Vundle [28] (or Pathogen [36], but Vundle is a
  663. better idea). With Vundle, this would mean adding a "Plugin
  664. 'Valloric/YouCompleteMe'" line to your vimrc [31].
  665. If you don't install YCM with Vundle, make sure you have run 'git
  666. submodule update --init --recursive' after checking out the YCM
  667. repository (Vundle will do this for you) to fetch YCM's dependencies.
  668. 3. _Complete this step ONLY if you care about semantic completion support
  669. for C-family languages. Otherwise it's not necessary._
  670. **Download the latest version of 'libclang'**. Clang is an open-source
  671. compiler that can compile C-family languages. The 'libclang' library it
  672. provides is used to power the YCM semantic completion engine for those
  673. languages. YCM is designed to work with libclang version 8.0.0 or higher.
  674. In addition to 'libclang', YCM also supports an **experimental** clangd
  675. [8]-based completer. You can download the latest version of clangd [8]
  676. from llvm.org releases [37]. Follow Step 4 to learn how to tell YCM where
  677. to find clangd binary. Please note that YCM is designed to work with
  678. clangd [8] version 8.0.0 or higher.
  679. You can use the system libclang or clangd _only if you are sure it is
  680. version 8.0.0 or higher_, otherwise don't. Even if it is, we recommend
  681. using the official binaries from llvm.org [37] if at all possible. Make
  682. sure you download the correct archive file for your OS.
  683. We **STRONGLY recommend AGAINST use** of the system libclang or clangd
  684. instead of the upstream compiled binaries. Random things may break. Save
  685. yourself the hassle and use the upstream pre-built libclang or clangd.
  686. 4. **Compile the 'ycm_core' library** that YCM needs. This library is the
  687. C++ engine that YCM uses to get fast completions.
  688. You will need to have 'cmake' installed in order to generate the required
  689. makefiles. Linux users can install cmake with their package manager
  690. ('sudo apt-get install cmake' for Ubuntu) whereas other users can
  691. download and install [33] cmake from its project site. macOS users can
  692. also get it through Homebrew [21] with 'brew install cmake'.
  693. On a Unix OS, you need to make sure you have Python headers installed. On
  694. a Debian-like Linux distro, this would be 'sudo apt-get install
  695. python-dev python3-dev'. On macOS they should already be present.
  696. On Windows, you need to download and install Python 2 or Python 3 [32].
  697. Pick the version corresponding to your Vim architecture. You will also
  698. need Microsoft Visual C++ (MSVC) to build YCM. You can obtain it by
  699. installing Visual Studio Build Tools [34]. MSVC 14 (Visual Studio 2015)
  700. and 15 (2017) are officially supported.
  701. Here we'll assume you installed YCM with Vundle. That means that the
  702. top-level YCM directory is in '~/.vim/bundle/YouCompleteMe'.
  703. We'll create a new folder where build files will be placed. Run the
  704. following:
  705. >
  706. cd ~
  707. mkdir ycm_build
  708. cd ycm_build
  709. <
  710. Now we need to generate the makefiles. If you DON'T care about semantic
  711. support for C-family languages or plan to use **experimental** clangd [8]
  712. based completer, run the following command in the 'ycm_build' directory:
  713. >
  714. cmake -G "<generator>" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
  715. <
  716. where '<generator>' is 'Unix Makefiles' on Unix systems and one of the
  717. following Visual Studio generators on Windows:
  718. - 'Visual Studio 14 Win64'
  719. - 'Visual Studio 15 Win64'
  720. Remove the 'Win64' part in these generators if your Vim architecture is
  721. 32-bit.
  722. For those who want to use the system version of boost, you would pass
  723. '-DUSE_SYSTEM_BOOST=ON' to cmake. This may be necessary on some systems
  724. where the bundled version of boost doesn't compile out of the box.
  725. **NOTE:** We **STRONGLY recommend AGAINST use** of the system boost
  726. instead of the bundled version of boost. Random things may break. Save
  727. yourself the hassle and use the bundled version of boost.
  728. If you DO care about semantic support for C-family languages, and want to
  729. use libclang as the provider instead of **experimental** clangd [8]-based
  730. completer then your 'cmake' call will be a bit more complicated. We'll
  731. assume you downloaded a binary distribution of LLVM+Clang from llvm.org
  732. in step 3 and that you extracted the archive file to folder
  733. '~/ycm_temp/llvm_root_dir' (with 'bin', 'lib', 'include' etc. folders
  734. right inside that folder). On Windows, you can extract the files from the
  735. LLVM+Clang installer using 7-zip [38].
  736. **NOTE:** This _only_ works with a _downloaded_ LLVM binary package, not
  737. a custom-built LLVM! See docs below for 'EXTERNAL_LIBCLANG_PATH' when
  738. using a custom LLVM build.
  739. With that in mind, run the following command in the 'ycm_build'
  740. directory:
  741. >
  742. cmake -G "<generator>" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
  743. <
  744. where '<generator>' is replaced like above.
  745. Now that configuration files have been generated, compile the libraries
  746. using this command:
  747. >
  748. cmake --build . --target ycm_core --config Release
  749. <
  750. The '--config Release' part is specific to Windows and will be ignored on
  751. a Unix OS.
  752. For those who want to use the system version of libclang, you would pass
  753. '-DUSE_SYSTEM_LIBCLANG=ON' to cmake _instead of_ the
  754. '-DPATH_TO_LLVM_ROOT=...' flag.
  755. **NOTE:** We **STRONGLY recommend AGAINST use** of the system libclang
  756. instead of the upstream compiled binaries. Random things may break. Save
  757. yourself the hassle and use the upstream pre-built libclang.
  758. You could also force the use of a custom libclang library with
  759. '-DEXTERNAL_LIBCLANG_PATH=/path/to/libclang.so' flag (the library would
  760. end with '.dylib' on macOS). Again, this flag would be used _instead of_
  761. the other flags. **If you compiled LLVM from source, this is the flag you
  762. should be using.**
  763. Running the 'cmake' command will also place the 'libclang.[so|dylib|dll]'
  764. in the 'YouCompleteMe/third_party/ycmd' folder for you if you compiled
  765. with clang support (it needs to be there for YCM to work).
  766. If you DO care about semantic support for C-family languages, and want to
  767. use **experimental** clangd [8]-based completer then you need to add
  768. following line to your 'vimrc':
  769. >
  770. let g:ycm_clangd_binary_path = "/path/to/clangd"
  771. <
  772. You need to change '/path/to/clangd' with the path of binary you
  773. downloaded in step 3.
  774. 5. _This step is optional._
  775. Build the regex [39] module for improved Unicode support and better
  776. performance with regular expressions. The procedure is similar to
  777. compiling the 'ycm_core' library:
  778. >
  779. cd ~
  780. mkdir regex_build
  781. cd regex_build
  782. cmake -G "<generator>" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/cregex
  783. cmake --build . --target _regex --config Release
  784. <
  785. where '<generator>' is the same generator used in the previous step.
  786. 6. Set up support for additional languages, as desired:
  787. - C# support: install Mono on non-Windows platforms [40]. Navigate to
  788. 'YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer' and run
  789. msbuild /property:Configuration=Release /property:Platform="Any CPU"
  790. /property:TargetFrameworkVersion=v4.5
  791. On Windows, be sure that the build utility 'msbuild' is in your PATH
  792. [35].
  793. - Go support: install Go [23] and add it to your path. Navigate to
  794. 'YouCompleteMe/third_party/ycmd/third_party/go' and in **both**
  795. 'src/github.com/mdempsky/gocode' and 'src/github.com/rogpeppe/godef'
  796. run
  797. GOPATH=$(realpath ../../../..) go build
  798. On Windows, first set 'GOPATH' to the absolute path of
  799. 'YouCompleteMe/third_party/ycmd/third_party/go' then run 'go build' in
  800. the two directories above.
  801. - JavaScript and TypeScript support: install Node.js and npm [24],
  802. navigate to 'YouCompleteMe/third_party/ycmd' and run 'npm install -g
  803. --prefix third_party/tsserver typescript'.
  804. - Rust support: install Rust [25]. Navigate to
  805. 'YouCompleteMe/third_party/ycmd/third_party/racerd' and run 'cargo
  806. build --release'.
  807. - Java support: install JDK8 (version 8 required) [26]. Download a
  808. binary release of eclipse.jdt.ls [41] and extract it to 'YouCompleteM
  809. e/third_party/ycmd/third_party/eclipse.jdt.ls/target/repository'.
  810. Note: this approach is not recommended for most users and is
  811. supported only for advanced users and developers of YCM on a
  812. best-efforts basis. Please use 'install.py' to enable java support.
  813. That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
  814. Don't forget that if you want the C-family semantic completion engine to work,
  815. you will need to provide the compilation flags for your project to YCM. It's
  816. all in the User Guide.
  817. YCM comes with sane defaults for its options, but you still may want to take a
  818. look at what's available for configuration. There are a few interesting options
  819. that are conservatively turned off by default that you may want to turn on.
  820. ===============================================================================
  821. *youcompleteme-quick-feature-summary*
  822. Quick Feature Summary ~
  823. -------------------------------------------------------------------------------
  824. *youcompleteme-general*
  825. General (all languages) ~
  826. - Super-fast identifier completer including tags files and syntax elements
  827. - Intelligent suggestion ranking and filtering
  828. - File and path suggestions
  829. - Suggestions from Vim's OmniFunc
  830. - UltiSnips snippet suggestions
  831. -------------------------------------------------------------------------------
  832. *youcompleteme-c-family-languages*
  833. C-family languages (C, C++, Objective C, Objective C++, CUDA) ~
  834. - Semantic auto-completion with automatic fixes
  835. - Real-time diagnostic display
  836. - Go to include/declaration/definition (|GoTo|, etc.)
  837. - View documentation comments for identifiers (|GetDoc|)
  838. - Type information for identifiers (|GetType|)
  839. - Automatically fix certain errors (|FixIt|)
  840. -------------------------------------------------------------------------------
  841. *youcompleteme-c*
  842. C♯ ~
  843. - Semantic auto-completion
  844. - Real-time diagnostic display
  845. - Go to declaration/definition (|GoTo|, etc.)
  846. - View documentation comments for identifiers (|GetDoc|)
  847. - Type information for identifiers (|GetType|)
  848. - Automatically fix certain errors (|FixIt|)
  849. - Management of OmniSharp server instance
  850. -------------------------------------------------------------------------------
  851. *youcompleteme-python*
  852. Python ~
  853. - Semantic auto-completion
  854. - Go to definition (|GoTo|)
  855. - Reference finding (|GoToReferences|)
  856. - View documentation comments for identifiers (|GetDoc|)
  857. - Type information for identifiers (|GetType|)
  858. -------------------------------------------------------------------------------
  859. *youcompleteme-go*
  860. Go ~
  861. - Semantic auto-completion
  862. - Go to definition (|GoTo|)
  863. - Management of 'gocode' server instance
  864. -------------------------------------------------------------------------------
  865. *youcompleteme-javascript-typescript*
  866. JavaScript and TypeScript ~
  867. - Semantic auto-completion with automatic import insertion
  868. - Real-time diagnostic display
  869. - Go to definition (|GoTo|, |GoToDefinition|, and |GoToDeclaration| are
  870. identical)
  871. - Go to type definition (|GoToType|)
  872. - Reference finding (|GoToReferences|)
  873. - View documentation comments for identifiers (|GetDoc|)
  874. - Type information for identifiers (|GetType|)
  875. - Automatically fix certain errors (|FixIt|)
  876. - Renaming symbols ('RefactorRename <new name>')
  877. - Code formatting (|Format|)
  878. - Organize imports (|OrganizeImports|)
  879. - Management of 'TSServer' server instance
  880. -------------------------------------------------------------------------------
  881. *youcompleteme-rust*
  882. Rust ~
  883. - Semantic auto-completion
  884. - Go to definition (|GoTo|, |GoToDefinition|, and |GoToDeclaration| are
  885. identical)
  886. - View documentation comments for identifiers (|GetDoc|)
  887. - Management of 'racer' server instance
  888. -------------------------------------------------------------------------------
  889. *youcompleteme-java*
  890. Java ~
  891. **NOTE**: Java support is currently experimental. Please let us know your
  892. feedback.
  893. - Semantic auto-completion with automatic import insertion
  894. - Real-time diagnostic display
  895. - Go to definition (|GoTo|, |GoToDefinition|, and |GoToDeclaration| are
  896. identical)
  897. - Go to type definition (|GoToType|)
  898. - Go to implementation (|GoToImplementation|)
  899. - Reference finding (|GoToReferences|)
  900. - View documentation comments for identifiers (|GetDoc|)
  901. - Type information for identifiers (|GetType|)
  902. - Automatically fix certain errors including code generation (|FixIt|)
  903. - Renaming symbols ('RefactorRename <new name>')
  904. - Code formatting (|Format|)
  905. - Organize imports (|OrganizeImports|)
  906. - Detection of java projects
  907. - Management of 'jdt.ls' server instance
  908. ===============================================================================
  909. *youcompleteme-user-guide*
  910. User Guide ~
  911. -------------------------------------------------------------------------------
  912. *youcompleteme-general-usage*
  913. General Usage ~
  914. If the offered completions are too broad, keep typing characters; YCM will
  915. continue refining the offered completions based on your input.
  916. Filtering is "smart-case" and "smart-diacritic [42]" sensitive; if you are
  917. typing only lowercase letters, then it's case-insensitive. If your input
  918. contains uppercase letters, then the uppercase letters in your query must match
  919. uppercase letters in the completion strings (the lowercase letters still match
  920. both). On top of that, a letter with no diacritic marks will match that letter
  921. with or without marks:
  922. ---------------------------------------------
  923. | _matches_ | _foo_ | _fôo_ | _fOo_ | _fÔo_ |
  924. ---------------------------------------------
  925. | _foo_ | ✔️ | ✔️ | ✔️ | ✔️ |
  926. ---------------------------------------------
  927. | _fôo_ | ❌ | ✔️ | ❌ | ✔️ |
  928. ---------------------------------------------
  929. | _fOo_ | ❌ | ❌ | ✔️ | ✔️ |
  930. ---------------------------------------------
  931. | _fÔo_ | ❌ | ❌ | ❌ | ✔️ |
  932. ---------------------------------------------
  933. Use the TAB key to accept a completion and continue pressing TAB to cycle
  934. through the completions. Use Shift-TAB to cycle backwards. Note that if you're
  935. using console Vim (that is, not Gvim or MacVim) then it's likely that the
  936. Shift-TAB binding will not work because the console will not pass it to Vim.
  937. You can remap the keys; see the Options section below.
  938. Knowing a little bit about how YCM works internally will prevent confusion. YCM
  939. has several completion engines: an identifier-based completer that collects all
  940. of the identifiers in the current file and other files you visit (and your tags
  941. files) and searches them when you type (identifiers are put into per-filetype
  942. groups).
  943. There are also several semantic engines in YCM. There are libclang-based and
  944. clangd-based completers that provide semantic completion for C-family
  945. languages. There's a Jedi-based completer for semantic completion for Python.
  946. There's also an omnifunc-based completer that uses data from Vim's omnicomplete
  947. system to provide semantic completions when no native completer exists for that
  948. language in YCM.
  949. There are also other completion engines, like the UltiSnips completer and the
  950. filepath completer.
  951. YCM automatically detects which completion engine would be the best in any
  952. situation. On occasion, it queries several of them at once, merges the outputs
  953. and presents the results to you.
  954. -------------------------------------------------------------------------------
  955. *youcompleteme-client-server-architecture*
  956. Client-Server Architecture ~
  957. YCM has a client-server architecture; the Vim part of YCM is only a thin client
  958. that talks to the ycmd HTTP+JSON server [43] that has the vast majority of YCM
  959. logic and functionality. The server is started and stopped automatically as you
  960. start and stop Vim.
  961. -------------------------------------------------------------------------------
  962. *youcompleteme-completion-string-ranking*
  963. Completion String Ranking ~
  964. The subsequence filter removes any completions that do not match the input, but
  965. then the sorting system kicks in. It's actually very complicated and uses lots
  966. of factors, but suffice it to say that "word boundary" (WB) subsequence
  967. character matches are "worth" more than non-WB matches. In effect, this means
  968. given an input of "gua", the completion "getUserAccount" would be ranked higher
  969. in the list than the "Fooguxa" completion (both of which are subsequence
  970. matches). A word-boundary character are all capital characters, characters
  971. preceded by an underscore and the first letter character in the completion
  972. string.
  973. -------------------------------------------------------------------------------
  974. *youcompleteme-general-semantic-completion*
  975. General Semantic Completion ~
  976. You can use Ctrl+Space to trigger the completion suggestions anywhere, even
  977. without a string prefix. This is useful to see which top-level functions are
  978. available for use.
  979. -------------------------------------------------------------------------------
  980. *youcompleteme-c-family-semantic-completion*
  981. C-family Semantic Completion ~
  982. In order to perform semantic analysis such as code completion, |GoTo| and
  983. diagnostics, YouCompleteMe uses 'libclang' or 'clangd'. Both of them make use
  984. of clang compiler, sometimes also referred to as llvm. Like any compiler, clang
  985. also requires a set of compile flags in order to parse your code. Simply put:
  986. If clang can't parse your code, YouCompleteMe can't provide semantic analysis.
  987. There are 2 methods which can be used to provide compile flags to clang:
  988. -------------------------------------------------------------------------------
  989. *youcompleteme-option-1-use-compilation-database-44*
  990. Option 1: Use a compilation database [44] ~
  991. The easiest way to get YCM to compile your code is to use a compilation
  992. database. A compilation database is usually generated by your build system
  993. (e.g. 'CMake') and contains the compiler invocation for each compilation unit
  994. in your project.
  995. For information on how to generate a compilation database, see the clang
  996. documentation [44]. In short:
  997. - If using CMake, add '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON' when configuring
  998. (or add 'set( CMAKE_EXPORT_COMPILE_COMMANDS ON )' to 'CMakeLists.txt') and
  999. copy or symlink the generated database to the root of your project.
  1000. - If using Ninja, check out the 'compdb' tool ('-t compdb') in its docs [45].
  1001. - If using GNU make, check out Bear [46].
  1002. - For other build systems, check out '.ycm_extra_conf.py' below. Note that
  1003. **experimental**clangd [8]-based completer doesn't support this option. So
  1004. it (and anything after this point) only applies to 'libclang'-based
  1005. completer.
  1006. If no '.ycm_extra_conf.py' is found, YouCompleteMe automatically tries to load
  1007. a compilation database if there is one.
  1008. YCM looks for a file named 'compile_commands.json' in the directory of the
  1009. opened file or in any directory above it in the hierarchy (recursively); when
  1010. the file is found, it is loaded. YouCompleteMe performs the following lookups
  1011. when extracting flags for a particular file:
  1012. - If the database contains an entry for the file, the flags for that file are
  1013. used.
  1014. - If the file is a header file and a source file with the same root exists in
  1015. the database, the flags for the source file are used. For example, if the
  1016. file is '/home/Test/project/src/lib/something.h' and the database contains
  1017. an entry for '/home/Test/project/src/lib/something.cc', then the flags for
  1018. '/home/Test/project/src/lib/something.cc' are used.
  1019. - Otherwise, if any flags have been returned from the directory containing
  1020. the requested file, those flags are used. This heuristic is intended to
  1021. provide potentially working flags for newly created files.
  1022. Finally, YCM converts any relative paths in the extracted flags to absolute
  1023. paths. This ensures that compilation can be performed from any Vim working
  1024. directory.
  1025. -------------------------------------------------------------------------------
  1026. *youcompleteme-option-2-provide-flags-manually*
  1027. Option 2: Provide the flags manually ~
  1028. _Note that this option doesn't work with **experimental** clangd [8]-based
  1029. completer. You can use a compile_flags.txt [47] file instead._
  1030. If you don't have a compilation database, or aren't able to generate one, you
  1031. have to tell YouCompleteMe how to compile your code some other way.
  1032. Every C-family project is different. It is not possible for YCM to guess what
  1033. compiler flags to supply for your project. Fortunately, YCM provides a
  1034. mechanism for you to generate the flags for a particular file with _arbitrary
  1035. complexity_. This is achieved by requiring you to provide a Python module which
  1036. implements a trivial function which, given the file name as argument, returns a
  1037. list of compiler flags to use to compile that file.
  1038. YCM looks for a '.ycm_extra_conf.py' file in the directory of the opened file
  1039. or in any directory above it in the hierarchy (recursively); when the file is
  1040. found, it is loaded (only once!) as a Python module. YCM calls a 'Settings'
  1041. method in that module which should provide it with the information necessary to
  1042. compile the current file. You can also provide a path to a global configuration
  1043. file with the |g:ycm_global_ycm_extra_conf| option, which will be used as a
  1044. fallback. To prevent the execution of malicious code from a file you didn't
  1045. write YCM will ask you once per '.ycm_extra_conf.py' if it is safe to load.
  1046. This can be disabled and you can white-/blacklist files. See the
  1047. |g:ycm_confirm_extra_conf| and |g:ycm_extra_conf_globlist| options
  1048. respectively.
  1049. This system was designed this way so that the user can perform any arbitrary
  1050. sequence of operations to produce a list of compilation flags YCM should hand
  1051. to Clang.
  1052. **NOTE**: It is highly recommended to include '-x <language>' flag to libclang.
  1053. This is so that the correct language is detected, particularly for header
  1054. files. Common values are '-x c' for C, '-x c++' for C++, '-x objc' for
  1055. Objective-C, and '-x cuda' for CUDA.
  1056. To give you an impression, if your C++ project is trivial, and your usual
  1057. compilation command is: 'g++ -Wall -Wextra -Werror -o FILE.o FILE.cc', then the
  1058. following '.ycm_extra_conf.py' is enough to get semantic analysis from
  1059. YouCompleteMe:
  1060. >
  1061. def Settings( **kwargs ):
  1062. return {
  1063. 'flags': [ '-x', 'c++', '-Wall', '-Wextra', '-Werror' ],
  1064. }
  1065. <
  1066. As you can see from the trivial example, YCM calls the 'Settings' method which
  1067. returns a dictionary with a single element "'flags'". This element is a 'list'
  1068. of compiler flags to pass to libclang for the current file. The absolute path
  1069. of that file is accessible under the 'filename' key of the 'kwargs' dictionary.
  1070. That's it! This is actually enough for most projects, but for complex projects
  1071. it is not uncommon to integrate directly with an existing build system using
  1072. the full power of the Python language.
  1073. For a more elaborate example, see ycmd's own '.ycm_extra_conf.py' [48]. You
  1074. should be able to use it _as a starting point_. **Don't** just copy/paste that
  1075. file somewhere and expect things to magically work; **your project needs
  1076. different flags**. Hint: just replace the strings in the 'flags' variable with
  1077. compilation flags necessary for your project. That should be enough for 99% of
  1078. projects.
  1079. You could also consider using YCM-Generator [49] to generate the
  1080. 'ycm_extra_conf.py' file.
  1081. -------------------------------------------------------------------------------
  1082. *youcompleteme-errors-during-compilation*
  1083. Errors during compilation ~
  1084. If Clang encounters errors when compiling the header files that your file
  1085. includes, then it's probably going to take a long time to get completions. When
  1086. the completion menu finally appears, it's going to have a large number of
  1087. unrelated completion strings (type/function names that are not actually
  1088. members). This is because Clang fails to build a precompiled preamble for your
  1089. file if there are any errors in the included headers and that preamble is key
  1090. to getting fast completions.
  1091. Call the |:YcmDiags| command to see if any errors or warnings were detected in
  1092. your file.
  1093. -------------------------------------------------------------------------------
  1094. *youcompleteme-selecting-c-family-completion-engine*
  1095. Selecting a C-family completion engine ~
  1096. Currently YCM supports two completion engines for C-family semantic completion.
  1097. One libclang-based and an **experimental** clangd [8]-based completer. When in
  1098. doubt we recommend using the libclang-based engine. Here is a quick comparison
  1099. of the two completer engines:
  1100. - **ycm_extra_conf.py**: Currently clangd does not support
  1101. 'ycm_extra_conf.py' therefore you must have a compilation database, whereas
  1102. libclang can work with both.
  1103. - **Project wide indexing**: Clangd has both dynamic and static index
  1104. support. The dynamic index stores up-to-date symbols coming from any files
  1105. you are currently editing, whereas static index contains project-wide
  1106. symbol information. This symbol information is used for code completion and
  1107. code navigation. Whereas libclang is limited to the current translation
  1108. unit(TU).
  1109. - **Code navigation**: Clangd provides all the GoTo requests libclang
  1110. provides and it improves those using the above mentioned index information
  1111. to contain project-wide information rather than just the current TU.
  1112. - **Rename**: Clangd can perform semantic rename operations on the current
  1113. file, whereas libclang doesn’t support such functionality.
  1114. - **Code Completion**: Clangd can perform code completions at a lower latency
  1115. than libclang; also, it has information about all the symbols in your
  1116. project so it can suggest items outside your current TU and also provides
  1117. proper '#include' insertions for those items.
  1118. - **Format Code**: Clangd provides code formatting either for the selected
  1119. lines or the whole file, whereas libclang doesn’t have such functionality.
  1120. - **Performance**: Clangd has faster reparse and code completion times
  1121. compared to libclang.
  1122. Note that for clangd to have some of the above mentioned functionality, you
  1123. need to provide a static index. For details on how to do that please have a
  1124. look at clangd-indexing [50].
  1125. To enable:
  1126. - libclang-based completer pass '--clang-completer'
  1127. - clangd [8]-based completer pass '--clangd-completer'
  1128. to 'install.py' while following the installation guide. As mentioned before,
  1129. pass '--clang-completer' when in doubt, since the clangd [8]-based completer is
  1130. still experimental.
  1131. -------------------------------------------------------------------------------
  1132. *youcompleteme-java-semantic-completion*
  1133. Java Semantic Completion ~
  1134. **NOTE**: Java support is currently experimental. Please let us know your
  1135. feedback.
  1136. -------------------------------------------------------------------------------
  1137. *youcompleteme-java-quick-start*
  1138. Java quick Start ~
  1139. 1. Ensure that you have enabled the Java completer. See the installation
  1140. guide for details.
  1141. 2. Create a project file (gradle or maven) file in the root directory of
  1142. your Java project, by following the instructions below.
  1143. 3. If you previously used Eclim or Syntastic for Java, disable them for
  1144. Java.
  1145. 4. Edit a Java file from your project.
  1146. For the best experience, we highly recommend at least Vim 8.0.1493 when using
  1147. Java support with YouCompleteMe.
  1148. -------------------------------------------------------------------------------
  1149. *youcompleteme-java-project-files*
  1150. Java Project Files ~
  1151. In order to provide semantic analysis, the Java completion engine requires
  1152. knowledge of your project structure. In particular it needs to know the class
  1153. path to use, when compiling your code. Fortunately jdt.ls [15] supports eclipse
  1154. project files [51], maven projects [52] and gradle projects [53].
  1155. **NOTE:** Our recommendation is to use either maven or gradle projects.
  1156. -------------------------------------------------------------------------------
  1157. *youcompleteme-diagnostic-display-syntastic*
  1158. Diagnostic display - Syntastic ~
  1159. The native support for Java includes YCM's native realtime diagnostics display.
  1160. This can conflict with other diagnostics plugins like Syntastic, so when
  1161. enabling Java support, please **manually disable Syntastic Java diagnostics**.
  1162. Add the following to your 'vimrc':
  1163. >
  1164. let g:syntastic_java_checkers = []
  1165. <
  1166. -------------------------------------------------------------------------------
  1167. *youcompleteme-diagnostic-display-eclim*
  1168. Diagnostic display - Eclim ~
  1169. The native support for Java includes YCM's native realtime diagnostics display.
  1170. This can conflict with other diagnostics plugins like Eclim, so when enabling
  1171. Java support, please **manually disable Eclim Java diagnostics**.
  1172. Add the following to your 'vimrc':
  1173. >
  1174. let g:EclimFileTypeValidate = 0
  1175. <
  1176. **NOTE**: We recommend disabling Eclim entirely when editing Java with YCM's
  1177. native Java support. This can be done temporarily with ':EclimDisable'.
  1178. -------------------------------------------------------------------------------
  1179. *youcompleteme-eclipse-projects*
  1180. Eclipse Projects ~
  1181. Eclipse style projects require two files: .project [51] and .classpath [54].
  1182. If your project already has these files due to previously being set up within
  1183. eclipse, then no setup is required. jdt.ls [15] should load the project just
  1184. fine (it's basically eclipse after all).
  1185. However, if not, it is possible (easy in fact) to craft them manually, though
  1186. it is not recommended. You're better off using gradle or maven (see below).
  1187. A simple eclipse style project example [55] can be found in the ycmd test
  1188. directory. Normally all that is required is to copy these files to the root of
  1189. your project and to edit the '.classpath' to add additional libraries, such as:
  1190. >
  1191. <classpathentry kind="lib" path="/path/to/external/jar" />
  1192. <classpathentry kind="lib" path="/path/to/external/java/source" />
  1193. <
  1194. It may also be necessary to change the directory in which your source files are
  1195. located (paths are relative to the .project file itself):
  1196. >
  1197. <classpathentry kind="src" output="target/classes" path="path/to/src/" />
  1198. <
  1199. **NOTE**: The eclipse project and classpath files are not a public interface
  1200. and it is highly recommended to use Maven or Gradle project definitions if you
  1201. don't already use eclipse to manage your projects.
  1202. -------------------------------------------------------------------------------
  1203. *youcompleteme-maven-projects*
  1204. Maven Projects ~
  1205. Maven needs a file named pom.xml [52] in the root of the project. Once again a
  1206. simple pom.xml [56] can be found in ycmd source.
  1207. The format of pom.xml [52] files is way beyond the scope of this document, but
  1208. we do recommend using the various tools that can generate them for you, if
  1209. you're not familiar with them already.
  1210. -------------------------------------------------------------------------------
  1211. *youcompleteme-gradle-projects*
  1212. Gradle Projects ~
  1213. Gradle projects require a build.gradle [53]. Again, there is a trivial example
  1214. in ycmd's tests [57].
  1215. The format of build.gradle [53] files is way beyond the scope of this document,
  1216. but we do recommend using the various tools that can generate them for you, if
  1217. you're not familiar with them already.
  1218. -------------------------------------------------------------------------------
  1219. *youcompleteme-troubleshooting*
  1220. Troubleshooting ~
  1221. If you're not getting completions or diagnostics, check the server health:
  1222. - The Java completion engine takes a while to start up and parse your
  1223. project. You should be able to see its progress in the command line, and
  1224. |:YcmDebugInfo|. Ensure that the following lines are present:
  1225. >
  1226. -- jdt.ls Java Language Server running
  1227. -- jdt.ls Java Language Server Startup Status: Ready
  1228. <
  1229. - If the above lines don't appear after a few minutes, check the jdt.ls and
  1230. ycmd log files using |:YcmToggleLogs|. The jdt.ls log file is called '.log'
  1231. (for some reason).
  1232. If you get a message about "classpath is incomplete", then make sure you have
  1233. correctly configured the project files.
  1234. If you get messages about unresolved imports, then make sure you have correctly
  1235. configured the project files, in particular check that the classpath is set
  1236. correctly.
  1237. For anything else, contact us. Java support is experimental at present so we'd
  1238. love to hear your feedback! Please do remember to check CONTRIBUTING.md [58]
  1239. for the list of diagnostics we'll need.
  1240. -------------------------------------------------------------------------------
  1241. *youcompleteme-python-semantic-completion*
  1242. Python Semantic Completion ~
  1243. YCM relies on the Jedi [9] engine to provide completion and code navigation. By
  1244. default, it will pick the version of Python running the ycmd server [43] and
  1245. use its 'sys.path'. While this is fine for simple projects, this needs to be
  1246. configurable when working with virtual environments or in a project with
  1247. third-party packages. The next sections explain how to do that.
  1248. -------------------------------------------------------------------------------
  1249. *youcompleteme-working-with-virtual-environments*
  1250. Working with virtual environments ~
  1251. A common practice when working on a Python project is to install its
  1252. dependencies in a virtual environment and develop the project inside that
  1253. environment. To support this, YCM needs to know the interpreter path of the
  1254. virtual environment. You can specify it by creating a '.ycm_extra_conf.py' file
  1255. at the root of your project with the following contents:
  1256. >
  1257. def Settings( **kwargs ):
  1258. return {
  1259. 'interpreter_path': '/path/to/virtual/environment/python'
  1260. }
  1261. <
  1262. where '/path/to/virtual/environment/python' is the path to the Python used by
  1263. the virtual environment you are working in. Typically, the executable can be
  1264. found in the 'Scripts' folder of the virtual environment directory on Windows
  1265. and in the 'bin' folder on other platforms.
  1266. If you don't like having to create a '.ycm_extra_conf.py' file at the root of
  1267. your project and would prefer to specify the interpreter path with a Vim
  1268. option, read the Configuring through Vim options section.
  1269. -------------------------------------------------------------------------------
  1270. *youcompleteme-working-with-third-party-packages*
  1271. Working with third-party packages ~
  1272. Another common practice is to put the dependencies directly into the project
  1273. and add their paths to 'sys.path' at runtime in order to import them. YCM needs
  1274. to be told about this path manipulation to support those dependencies. This can
  1275. be done by creating a '.ycm_extra_conf.py' file at the root of the project.
  1276. This file must define a 'Settings( **kwargs )' function returning a dictionary
  1277. with the list of paths to prepend to 'sys.path' under the 'sys_path' key. For
  1278. instance, the following '.ycm_extra_conf.py'
  1279. >
  1280. def Settings( **kwargs ):
  1281. return {
  1282. 'sys_path': [
  1283. '/path/to/some/third_party/package',
  1284. '/path/to/another/third_party/package'
  1285. ]
  1286. }
  1287. <
  1288. adds the paths '/path/to/some/third_party/package' and
  1289. '/path/to/another/third_party/package' at the start of 'sys.path'.
  1290. If you would rather prepend paths to 'sys.path' with a Vim option, read the
  1291. Configuring through Vim options section.
  1292. If you need further control on how to add paths to 'sys.path', you should
  1293. define the 'PythonSysPath( **kwargs )' function in the '.ycm_extra_conf.py'
  1294. file. Its keyword arguments are 'sys_path' which contains the default
  1295. 'sys.path', and 'interpreter_path' which is the path to the Python interpreter.
  1296. Here's a trivial example that insert the '/path/to/third_party/package' path at
  1297. the second position of 'sys.path':
  1298. >
  1299. def PythonSysPath( **kwargs ):
  1300. sys_path = kwargs[ 'sys_path' ]
  1301. sys_path.insert( 1, '/path/to/third_party/package' )
  1302. return sys_path
  1303. <
  1304. A more advanced example can be found in YCM's own '.ycm_extra_conf.py' [59].
  1305. -------------------------------------------------------------------------------
  1306. *youcompleteme-configuring-through-vim-options*
  1307. Configuring through Vim options ~
  1308. You may find inconvenient to have to create a '.ycm_extra_conf.py' file at the
  1309. root of each one of your projects in order to set the path to the Python
  1310. interpreter and/or add paths to 'sys.path' and would prefer to be able to
  1311. configure those through Vim options. Don't worry, this is possible by using the
  1312. |g:ycm_extra_conf_vim_data| option and creating a global extra configuration
  1313. file. Let's take an example. Suppose that you want to set the interpreter path
  1314. with the 'g:ycm_python_interpreter_path' option and prepend paths to 'sys.path'
  1315. with the 'g:ycm_python_sys_path' option. Suppose also that you want to name the
  1316. global extra configuration file 'global_extra_conf.py' and that you want to put
  1317. it in your HOME folder. You should then add the following lines to your vimrc:
  1318. >
  1319. let g:ycm_python_interpreter_path = ''
  1320. let g:ycm_python_sys_path = []
  1321. let g:ycm_extra_conf_vim_data = [
  1322. \ 'g:ycm_python_interpreter_path',
  1323. \ 'g:ycm_python_sys_path'
  1324. \]
  1325. let g:ycm_global_ycm_extra_conf = '~/global_extra_conf.py'
  1326. <
  1327. and create the '~/global_extra_conf.py' file with the following contents:
  1328. >
  1329. def Settings( **kwargs ):
  1330. client_data = kwargs[ 'client_data' ]
  1331. return {
  1332. 'interpreter_path': client_data[ 'g:ycm_python_interpreter_path' ],
  1333. 'sys_path': client_data[ 'g:ycm_python_sys_path' ]
  1334. }
  1335. <
  1336. That's it. You are done. Note that you don't need to restart the server when
  1337. setting one of the options. YCM will automatically pick the new values.
  1338. -------------------------------------------------------------------------------
  1339. *youcompleteme-rust-semantic-completion*
  1340. Rust Semantic Completion ~
  1341. Completions and GoTo commands within the current crate and its dependencies
  1342. should work out of the box with no additional configuration (provided that you
  1343. built YCM with the '--rust-completer' flag; see the _Installation_ section for
  1344. details). For semantic analysis inclusive of the standard library, you must
  1345. have a local copy of the Rust source code [60]. If using rustup [61], run the
  1346. following command to download the code:
  1347. >
  1348. rustup component add rust-src
  1349. <
  1350. YCM will find its location automatically. Otherwise, download the archive,
  1351. extract it somewhere, and set the following option so YCM can locate it:
  1352. >
  1353. " In this example, the Rust source code archive has been extracted to
  1354. " /usr/local/rust/rustc-1.20.0
  1355. let g:ycm_rust_src_path = '/usr/local/rust/rustc-1.20.0/src'
  1356. <
  1357. -------------------------------------------------------------------------------
  1358. *youcompleteme-javascript-typescript-semantic-completion*
  1359. JavaScript and TypeScript Semantic Completion ~
  1360. **NOTE:** YCM originally used the Tern [62] engine for JavaScript but due to
  1361. Tern [62] not being maintained anymore by its main author and the TSServer [13]
  1362. engine offering more features, YCM is moving to TSServer [13]. This won't
  1363. affect you if you were already using Tern [62] but you are encouraged to do the
  1364. switch by deleting the 'third_party/ycmd/third_party/tern_runtime/node_modules'
  1365. directory in YCM folder. If you are a new user but still want to use Tern [62],
  1366. you should pass the '--js-completer' option to the 'install.py' script during
  1367. installation. Further instructions on how to setup YCM with Tern [62] are
  1368. available on the wiki [63].
  1369. All JavaScript and TypeScript features are provided by the TSServer [13]
  1370. engine, which is included in the TypeScript SDK. To enable these features,
  1371. install Node.js and npm [24] and call the 'install.py' script with the
  1372. '--ts-completer' flag.
  1373. TSServer [13] relies on the 'jsconfig.json' file [64] for JavaScript and the
  1374. 'tsconfig.json' file [65] for TypeScript to analyze your project. Ensure the
  1375. file exists at the root of your project.
  1376. To get diagnostics in JavaScript, set the 'checkJs' option to 'true' in your
  1377. 'jsconfig.json' file:
  1378. >
  1379. {
  1380. "compilerOptions": {
  1381. "checkJs": true
  1382. }
  1383. }
  1384. <
  1385. -------------------------------------------------------------------------------
  1386. *youcompleteme-semantic-completion-for-other-languages*
  1387. Semantic Completion for Other Languages ~
  1388. C-family, C#, Go, Java, Python, Rust, and JavaScript/TypeScript languages are
  1389. supported natively by YouCompleteMe using the Clang [7], OmniSharp [10], Gocode
  1390. [11]/Godef [12], jdt.ls [15], Jedi [9], racer [14], and TSServer [13] engines,
  1391. respectively. Check the installation section for instructions to enable these
  1392. features if desired.
  1393. YCM will use your 'omnifunc' (see ':h omnifunc' in Vim) as a source for
  1394. semantic completions if it does not have a native semantic completion engine
  1395. for your file's filetype. Vim comes with okayish omnifuncs for various
  1396. languages like Ruby, PHP, etc. It depends on the language.
  1397. You can get a stellar omnifunc for Ruby with Eclim [66]. Just make sure you
  1398. have the _latest_ Eclim installed and configured (this means Eclim '>= 2.2.*'
  1399. and Eclipse '>= 4.2.*').
  1400. After installing Eclim remember to create a new Eclipse project within your
  1401. application by typing ':ProjectCreate <path-to-your-project> -n ruby' inside
  1402. vim and don't forget to have "let g:EclimCompletionMethod = 'omnifunc'" in your
  1403. vimrc. This will make YCM and Eclim play nice; YCM will use Eclim's omnifuncs
  1404. as the data source for semantic completions and provide the auto-triggering and
  1405. subsequence-based matching (and other YCM features) on top of it.
  1406. -------------------------------------------------------------------------------
  1407. *youcompleteme-writing-new-semantic-completers*
  1408. Writing New Semantic Completers ~
  1409. You have two options here: writing an 'omnifunc' for Vim's omnicomplete system
  1410. that YCM will then use through its omni-completer, or a custom completer for
  1411. YCM using the Completer API [67].
  1412. Here are the differences between the two approaches:
  1413. - You have to use VimScript to write the omnifunc, but get to use Python to
  1414. write for the Completer API; this by itself should make you want to use the
  1415. API.
  1416. - The Completer API is a _much_ more powerful way to integrate with YCM and
  1417. it provides a wider set of features. For instance, you can make your
  1418. Completer query your semantic back-end in an asynchronous fashion, thus not
  1419. blocking Vim's GUI thread while your completion system is processing stuff.
  1420. This is impossible with VimScript. All of YCM's completers use the
  1421. Completer API.
  1422. - Performance with the Completer API is better since Python executes faster
  1423. than VimScript.
  1424. If you want to use the 'omnifunc' system, see the relevant Vim docs with ':h
  1425. complete-functions'. For the Completer API, see the API docs [67].
  1426. If you want to upstream your completer into YCM's source, you should use the
  1427. Completer API.
  1428. -------------------------------------------------------------------------------
  1429. *youcompleteme-diagnostic-display*
  1430. Diagnostic Display ~
  1431. YCM will display diagnostic notifications for the C-family, C#, Java,
  1432. JavaScript, and TypeScript languages. Since YCM continuously recompiles your
  1433. file as you type, you'll get notified of errors and warnings in your file as
  1434. fast as possible.
  1435. Here are the various pieces of the diagnostic UI:
  1436. - Icons show up in the Vim gutter on lines that have a diagnostic.
  1437. - Regions of text related to diagnostics are highlighted (by default, a red
  1438. wavy underline in 'gvim' and a red background in 'vim').
  1439. - Moving the cursor to a line with a diagnostic echoes the diagnostic text.
  1440. - Vim's location list is automatically populated with diagnostic data (off by
  1441. default, see options).
  1442. The new diagnostics (if any) will be displayed the next time you press any key
  1443. on the keyboard. So if you stop typing and just wait for the new diagnostics to
  1444. come in, that _will not work_. You need to press some key for the GUI to
  1445. update.
  1446. Having to press a key to get the updates is unfortunate, but cannot be changed
  1447. due to the way Vim internals operate; there is no way that a background task
  1448. can update Vim's GUI after it has finished running. You _have to_ press a key.
  1449. This will make YCM check for any pending diagnostics updates.
  1450. You _can_ force a full, blocking compilation cycle with the
  1451. |:YcmForceCompileAndDiagnostics| command (you may want to map that command to a
  1452. key; try putting 'nnoremap <F5> :YcmForceCompileAndDiagnostics<CR>' in your
  1453. vimrc). Calling this command will force YCM to immediately recompile your file
  1454. and display any new diagnostics it encounters. Do note that recompilation with
  1455. this command may take a while and during this time the Vim GUI _will_ be
  1456. blocked.
  1457. YCM will display a short diagnostic message when you move your cursor to the
  1458. line with the error. You can get a detailed diagnostic message with the
  1459. '<leader>d' key mapping (can be changed in the options) YCM provides when your
  1460. cursor is on the line with the diagnostic.
  1461. You can also see the full diagnostic message for all the diagnostics in the
  1462. current file in Vim's 'locationlist', which can be opened with the ':lopen' and
  1463. ':lclose' commands (make sure you have set 'let
  1464. g:ycm_always_populate_location_list = 1' in your vimrc). A good way to toggle
  1465. the display of the 'locationlist' with a single key mapping is provided by
  1466. another (very small) Vim plugin called ListToggle [68] (which also makes it
  1467. possible to change the height of the 'locationlist' window), also written by
  1468. yours truly.
  1469. -------------------------------------------------------------------------------
  1470. *youcompleteme-diagnostic-highlighting-groups*
  1471. Diagnostic Highlighting Groups ~
  1472. You can change the styling for the highlighting groups YCM uses. For the signs
  1473. in the Vim gutter, the relevant groups are:
  1474. - 'YcmErrorSign', which falls back to group 'SyntasticErrorSign' and then
  1475. 'error' if they exist
  1476. - 'YcmWarningSign', which falls back to group 'SyntasticWarningSign' and then
  1477. 'todo' if they exist
  1478. You can also style the line that has the warning/error with these groups:
  1479. - 'YcmErrorLine', which falls back to group 'SyntasticErrorLine' if it exists
  1480. - 'YcmWarningLine', which falls back to group 'SyntasticWarningLine' if it
  1481. exists
  1482. Note that the line highlighting groups only work when the
  1483. |g:ycm_enable_diagnostic_signs| option is set. If you want highlighted lines
  1484. but no signs in the Vim gutter, ensure that your Vim version is 7.4.2201 or
  1485. later and set the 'signcolumn' option to 'off' in your vimrc:
  1486. >
  1487. set signcolumn=off
  1488. <
  1489. The syntax groups used to highlight regions of text with errors/warnings: -
  1490. 'YcmErrorSection', which falls back to group 'SyntasticError' if it exists and
  1491. then 'SpellBad' - 'YcmWarningSection', which falls back to group
  1492. 'SyntasticWarning' if it exists and then 'SpellCap'
  1493. Here's how you'd change the style for a group:
  1494. >
  1495. highlight YcmErrorLine guibg=#3f0000
  1496. <
  1497. ===============================================================================
  1498. *youcompleteme-commands*
  1499. Commands ~
  1500. -------------------------------------------------------------------------------
  1501. The *:YcmRestartServer* command
  1502. If the ycmd completion server [43] suddenly stops for some reason, you can
  1503. restart it with this command.
  1504. -------------------------------------------------------------------------------
  1505. The *:YcmForceCompileAndDiagnostics* command
  1506. Calling this command will force YCM to immediately recompile your file and
  1507. display any new diagnostics it encounters. Do note that recompilation with this
  1508. command may take a while and during this time the Vim GUI _will_ be blocked.
  1509. You may want to map this command to a key; try putting 'nnoremap <F5>
  1510. :YcmForceCompileAndDiagnostics<CR>' in your vimrc.
  1511. -------------------------------------------------------------------------------
  1512. The *:YcmDiags* command
  1513. Calling this command will fill Vim's 'locationlist' with errors or warnings if
  1514. any were detected in your file and then open it. If a given error or warning
  1515. can be fixed by a call to ':YcmCompleter FixIt', then '(FixIt available)' is
  1516. appended to the error or warning text. See the |FixIt| completer subcommand for
  1517. more information.
  1518. **NOTE:** The absence of '(FixIt available)' does not strictly imply a fix-it
  1519. is not available as not all completers are able to provide this indication. For
  1520. example, the c-sharp completer provides many fix-its but does not add this
  1521. additional indication.
  1522. The |g:ycm_open_loclist_on_ycm_diags| option can be used to prevent the
  1523. location list from opening, but still have it filled with new diagnostic data.
  1524. See the _Options_ section for details.
  1525. -------------------------------------------------------------------------------
  1526. The *:YcmShowDetailedDiagnostic* command
  1527. This command shows the full diagnostic text when the user's cursor is on the
  1528. line with the diagnostic.
  1529. -------------------------------------------------------------------------------
  1530. The *:YcmDebugInfo* command
  1531. This will print out various debug information for the current file. Useful to
  1532. see what compile commands will be used for the file if you're using the
  1533. semantic completion engine.
  1534. -------------------------------------------------------------------------------
  1535. The *:YcmToggleLogs* command
  1536. This command presents the list of logfiles created by YCM, the ycmd server
  1537. [43], and the semantic engine server for the current filetype, if any. One of
  1538. these logfiles can be opened in the editor (or closed if already open) by
  1539. entering the corresponding number or by clicking on it with the mouse.
  1540. Additionally, this command can take the logfile names as arguments. Use the
  1541. '<TAB>' key (or any other key defined by the 'wildchar' option) to complete the
  1542. arguments or to cycle through them (depending on the value of the 'wildmode'
  1543. option). Each logfile given as an argument is directly opened (or closed if
  1544. already open) in the editor. Only for debugging purposes.
  1545. -------------------------------------------------------------------------------
  1546. The *:YcmCompleter* command
  1547. This command gives access to a number of additional IDE-like features in YCM,
  1548. for things like semantic GoTo, type information, FixIt and refactoring.
  1549. This command accepts a range that can either be specified through a selection
  1550. in one of Vim's visual modes (see ':h visual-use') or on the command line. For
  1551. instance, ':2,5YcmCompleter' will apply the command from line 2 to line 5. This
  1552. is useful for the |Format| subcommand.
  1553. Call 'YcmCompleter' without further arguments for a list of the commands you
  1554. can call for the current completer.
  1555. See the file type feature summary for an overview of the features available for
  1556. each file type. See the _YcmCompleter subcommands_ section for more information
  1557. on the available subcommands and their usage.
  1558. ===============================================================================
  1559. *youcompleteme-ycmcompleter-subcommands*
  1560. YcmCompleter Subcommands ~
  1561. **NOTE:** See the docs for the 'YcmCompleter' command before tackling this
  1562. section.
  1563. The invoked subcommand is automatically routed to the currently active semantic
  1564. completer, so ':YcmCompleter GoToDefinition' will invoke the |GoToDefinition|
  1565. subcommand on the Python semantic completer if the currently active file is a
  1566. Python one and on the Clang completer if the currently active file is a
  1567. C-family language one.
  1568. You may also want to map the subcommands to something less verbose; for
  1569. instance, 'nnoremap <leader>jd :YcmCompleter GoTo<CR>' maps the '<leader>jd'
  1570. sequence to the longer subcommand invocation.
  1571. -------------------------------------------------------------------------------
  1572. *youcompleteme-goto-commands*
  1573. GoTo Commands ~
  1574. These commands are useful for jumping around and exploring code. When moving
  1575. the cursor, the subcommands add entries to Vim's 'jumplist' so you can use
  1576. 'CTRL-O' to jump back to where you were before invoking the command (and
  1577. 'CTRL-I' to jump forward; see ':h jumplist' for details). If there is more than
  1578. one destination, the quickfix list (see ':h quickfix') is populated with the
  1579. available locations and opened to full width at the bottom of the screen. You
  1580. can change this behavior by using the |YcmQuickFixOpened| autocommand.
  1581. -------------------------------------------------------------------------------
  1582. The *GoToInclude* subcommand
  1583. Looks up the current line for a header and jumps to it.
  1584. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1585. -------------------------------------------------------------------------------
  1586. The *GoToDeclaration* subcommand
  1587. Looks up the symbol under the cursor and jumps to its declaration.
  1588. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  1589. python, rust, typescript'
  1590. -------------------------------------------------------------------------------
  1591. The *GoToDefinition* subcommand
  1592. Looks up the symbol under the cursor and jumps to its definition.
  1593. **NOTE:** For C-family languages **this only works in certain situations**,
  1594. namely when the definition of the symbol is in the current translation unit. A
  1595. translation unit consists of the file you are editing and all the files you are
  1596. including with '#include' directives (directly or indirectly) in that file.
  1597. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  1598. python, rust, typescript'
  1599. -------------------------------------------------------------------------------
  1600. The *GoTo* subcommand
  1601. This command tries to perform the "most sensible" GoTo operation it can.
  1602. Currently, this means that it tries to look up the symbol under the cursor and
  1603. jumps to its definition if possible; if the definition is not accessible from
  1604. the current translation unit, jumps to the symbol's declaration. For C-family
  1605. languages, it first tries to look up the current line for a header and jump to
  1606. it. For C#, implementations are also considered and preferred.
  1607. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  1608. python, rust, typescript'
  1609. -------------------------------------------------------------------------------
  1610. The *GoToImprecise* subcommand
  1611. WARNING: This command trades correctness for speed!
  1612. Same as the |GoTo| command except that it doesn't recompile the file with
  1613. libclang before looking up nodes in the AST. This can be very useful when
  1614. you're editing files that take long to compile but you know that you haven't
  1615. made any changes since the last parse that would lead to incorrect jumps. When
  1616. you're just browsing around your codebase, this command can spare you quite a
  1617. bit of latency.
  1618. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1619. -------------------------------------------------------------------------------
  1620. The *GoToReferences* subcommand
  1621. This command attempts to find all of the references within the project to the
  1622. identifier under the cursor and populates the quickfix list with those
  1623. locations.
  1624. Supported in filetypes: 'java, javascript, python, typescript'
  1625. -------------------------------------------------------------------------------
  1626. The *GoToImplementation* subcommand
  1627. Looks up the symbol under the cursor and jumps to its implementation (i.e.
  1628. non-interface). If there are multiple implementations, instead provides a list
  1629. of implementations to choose from.
  1630. Supported in filetypes: 'cs, java'
  1631. -------------------------------------------------------------------------------
  1632. The *GoToImplementationElseDeclaration* subcommand
  1633. Looks up the symbol under the cursor and jumps to its implementation if one,
  1634. else jump to its declaration. If there are multiple implementations, instead
  1635. provides a list of implementations to choose from.
  1636. Supported in filetypes: 'cs'
  1637. -------------------------------------------------------------------------------
  1638. The *GoToType* subcommand
  1639. Looks up the symbol under the cursor and jumps to the definition of its type
  1640. e.g. if the symbol is an object, go to the definition of its class.
  1641. Supported in filetypes: 'java, javascript, typescript'
  1642. -------------------------------------------------------------------------------
  1643. *youcompleteme-semantic-information-commands*
  1644. Semantic Information Commands ~
  1645. These commands are useful for finding static information about the code, such
  1646. as the types of variables, viewing declarations and documentation strings.
  1647. -------------------------------------------------------------------------------
  1648. The *GetType* subcommand
  1649. Echos the type of the variable or method under the cursor, and where it
  1650. differs, the derived type.
  1651. For example:
  1652. >
  1653. std::string s;
  1654. <
  1655. Invoking this command on 's' returns 'std::string => std::basic_string<char>'
  1656. **NOTE:** Causes re-parsing of the current translation unit.
  1657. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, java, javascript, python,
  1658. typescript'
  1659. -------------------------------------------------------------------------------
  1660. The *GetTypeImprecise* subcommand
  1661. WARNING: This command trades correctness for speed!
  1662. Same as the |GetType| command except that it doesn't recompile the file with
  1663. libclang before looking up nodes in the AST. This can be very useful when
  1664. you're editing files that take long to compile but you know that you haven't
  1665. made any changes since the last parse that would lead to incorrect type. When
  1666. you're just browsing around your codebase, this command can spare you quite a
  1667. bit of latency.
  1668. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1669. -------------------------------------------------------------------------------
  1670. The *GetParent* subcommand
  1671. Echos the semantic parent of the point under the cursor.
  1672. The semantic parent is the item that semantically contains the given position.
  1673. For example:
  1674. >
  1675. class C {
  1676. void f();
  1677. };
  1678. void C::f() {
  1679. }
  1680. <
  1681. In the out-of-line definition of 'C::f', the semantic parent is the class 'C',
  1682. of which this function is a member.
  1683. In the example above, both declarations of 'C::f' have 'C' as their semantic
  1684. context, while the lexical context of the first 'C::f' is 'C' and the lexical
  1685. context of the second 'C::f' is the translation unit.
  1686. For global declarations, the semantic parent is the translation unit.
  1687. **NOTE:** Causes re-parsing of the current translation unit.
  1688. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1689. -------------------------------------------------------------------------------
  1690. The *GetDoc* subcommand
  1691. Displays the preview window populated with quick info about the identifier
  1692. under the cursor. Depending on the file type, this includes things like:
  1693. - The type or declaration of identifier,
  1694. - Doxygen/javadoc comments,
  1695. - Python docstrings,
  1696. - etc.
  1697. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, java, javascript,
  1698. python, typescript, rust'
  1699. -------------------------------------------------------------------------------
  1700. The *GetDocImprecise* subcommand
  1701. WARNING: This command trades correctness for speed!
  1702. Same as the |GetDoc| command except that it doesn't recompile the file with
  1703. libclang before looking up nodes in the AST. This can be very useful when
  1704. you're editing files that take long to compile but you know that you haven't
  1705. made any changes since the last parse that would lead to incorrect docs. When
  1706. you're just browsing around your codebase, this command can spare you quite a
  1707. bit of latency.
  1708. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1709. -------------------------------------------------------------------------------
  1710. *youcompleteme-refactoring-commands*
  1711. Refactoring Commands ~
  1712. These commands make changes to your source code in order to perform refactoring
  1713. or code correction. YouCompleteMe does not perform any action which cannot be
  1714. undone, and never saves or writes files to the disk.
  1715. -------------------------------------------------------------------------------
  1716. The *FixIt* subcommand
  1717. Where available, attempts to make changes to the buffer to correct diagnostics
  1718. on the current line. Where multiple suggestions are available (such as when
  1719. there are multiple ways to resolve a given warning, or where multiple
  1720. diagnostics are reported for the current line), the options are presented and
  1721. one can be selected.
  1722. Completers which provide diagnostics may also provide trivial modifications to
  1723. the source in order to correct the diagnostic. Examples include syntax errors
  1724. such as missing trailing semi-colons, spurious characters, or other errors
  1725. which the semantic engine can deterministically suggest corrections.
  1726. If no fix-it is available for the current line, or there is no diagnostic on
  1727. the current line, this command has no effect on the current buffer. If any
  1728. modifications are made, the number of changes made to the buffer is echo'd and
  1729. the user may use the editor's undo command to revert.
  1730. When a diagnostic is available, and |g:ycm_echo_current_diagnostic| is set to
  1731. 1, then the text '(FixIt)' is appended to the echo'd diagnostic when the
  1732. completer is able to add this indication. The text '(FixIt available)' is also
  1733. appended to the diagnostic text in the output of the |:YcmDiags| command for
  1734. any diagnostics with available fix-its (where the completer can provide this
  1735. indication).
  1736. **NOTE:** Causes re-parsing of the current translation unit.
  1737. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, java, javascript,
  1738. typescript'
  1739. -------------------------------------------------------------------------------
  1740. *RefactorRename-new-name*
  1741. The 'RefactorRename <new name>' subcommand ~
  1742. In supported file types, this command attempts to perform a semantic rename of
  1743. the identifier under the cursor. This includes renaming declarations,
  1744. definitions and usages of the identifier, or any other language-appropriate
  1745. action. The specific behavior is defined by the semantic engine in use.
  1746. Similar to |FixIt|, this command applies automatic modifications to your source
  1747. files. Rename operations may involve changes to multiple files, which may or
  1748. may not be open in Vim buffers at the time. YouCompleteMe handles all of this
  1749. for you. The behavior is described in the following section.
  1750. Supported in filetypes: 'java, javascript, typescript'
  1751. -------------------------------------------------------------------------------
  1752. *youcompleteme-multi-file-refactor*
  1753. Multi-file Refactor ~
  1754. When a Refactor or FixIt command touches multiple files, YouCompleteMe attempts
  1755. to apply those modifications to any existing open, visible buffer in the
  1756. current tab. If no such buffer can be found, YouCompleteMe opens the file in a
  1757. new small horizontal split at the top of the current window, applies the
  1758. change, and then _hides_ the window. **NOTE:** The buffer remains open, and
  1759. must be manually saved. A confirmation dialog is opened prior to doing this to
  1760. remind you that this is about to happen.
  1761. Once the modifications have been made, the quickfix list (see ':help quickfix')
  1762. is populated with the locations of all modifications. This can be used to
  1763. review all automatic changes made by using ':copen'. Typically, use the 'CTRL-W
  1764. <enter>' combination to open the selected file in a new split. It is possible
  1765. to customize how the quickfix window is opened by using the |YcmQuickFixOpened|
  1766. autocommand.
  1767. The buffers are _not_ saved automatically. That is, you must save the modified
  1768. buffers manually after reviewing the changes from the quickfix list. Changes
  1769. can be undone using Vim's powerful undo features (see ':help undo'). Note that
  1770. Vim's undo is per-buffer, so to undo all changes, the undo commands must be
  1771. applied in each modified buffer separately.
  1772. **NOTE:** While applying modifications, Vim may find files which are already
  1773. open and have a swap file. The command is aborted if you select Abort or Quit
  1774. in any such prompts. This leaves the Refactor operation partially complete and
  1775. must be manually corrected using Vim's undo features. The quickfix list is
  1776. _not_ populated in this case. Inspect ':buffers' or equivalent (see ':help
  1777. buffers') to see the buffers that were opened by the command.
  1778. -------------------------------------------------------------------------------
  1779. The *Format* subcommand
  1780. This command formats the whole buffer or some part of it according to the value
  1781. of the Vim options 'shiftwidth' and 'expandtab' (see ":h 'sw'" and ':h et'
  1782. respectively). To format a specific part of your document, you can either
  1783. select it in one of Vim's visual modes (see ':h visual-use') and run the
  1784. command or directly enter the range on the command line, e.g. ':2,5YcmCompleter
  1785. Format' to format it from line 2 to line 5.
  1786. Supported in filetypes: 'java, javascript, typescript'
  1787. -------------------------------------------------------------------------------
  1788. The *OrganizeImports* subcommand
  1789. This command removes unused imports and sorts imports in the current file. It
  1790. can also group imports from the same module in TypeScript and resolves imports
  1791. in Java.
  1792. Supported in filetypes: 'java, javascript, typescript'
  1793. -------------------------------------------------------------------------------
  1794. *youcompleteme-miscellaneous-commands*
  1795. Miscellaneous Commands ~
  1796. These commands are for general administration, rather than IDE-like features.
  1797. They cover things like the semantic engine server instance and compilation
  1798. flags.
  1799. -------------------------------------------------------------------------------
  1800. The *RestartServer* subcommand
  1801. Restarts the semantic-engine-as-localhost-server for those semantic engines
  1802. that work as separate servers that YCM talks to.
  1803. Supported in filetypes: 'cs, go, java, javascript, rust, typescript'
  1804. -------------------------------------------------------------------------------
  1805. The *ClearCompilationFlagCache* subcommand
  1806. YCM caches the flags it gets from the 'Settings' function in your
  1807. '.ycm_extra_conf.py' file unless you return them with the 'do_cache' parameter
  1808. set to 'False'. It also caches the flags extracted from the compilation
  1809. database. The cache is in memory and is never invalidated (unless you restart
  1810. the server with the |:YcmRestartServer| command).
  1811. This command clears that cache entirely. YCM will then re-query your 'Settings'
  1812. function or your compilation database as needed in the future.
  1813. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1814. -------------------------------------------------------------------------------
  1815. The *ReloadSolution* subcommand
  1816. Instruct the Omnisharp server to clear its cache and reload all files from
  1817. disk. This is useful when files are added, removed, or renamed in the solution,
  1818. files are changed outside of Vim, or whenever Omnisharp cache is out-of-sync.
  1819. Supported in filetypes: 'cs'
  1820. ===============================================================================
  1821. *youcompleteme-functions*
  1822. Functions ~
  1823. -------------------------------------------------------------------------------
  1824. The *youcompleteme#GetErrorCount* function
  1825. Get the number of YCM Diagnostic errors. If no errors are present, this
  1826. function returns 0.
  1827. For example:
  1828. >
  1829. call youcompleteme#GetErrorCount()
  1830. <
  1831. Both this function and |youcompleteme#GetWarningCount| can be useful when
  1832. integrating YCM with other Vim plugins. For example, a lightline [69] user
  1833. could add a diagnostics section to their statusline which would display the
  1834. number of errors and warnings.
  1835. -------------------------------------------------------------------------------
  1836. The *youcompleteme#GetWarningCount* function
  1837. Get the number of YCM Diagnostic warnings. If no warnings are present, this
  1838. function returns 0.
  1839. For example:
  1840. >
  1841. call youcompleteme#GetWarningCount()
  1842. <
  1843. ===============================================================================
  1844. *youcompleteme-autocommands*
  1845. Autocommands ~
  1846. -------------------------------------------------------------------------------
  1847. The *YcmLocationOpened* autocommand
  1848. This 'User' autocommand is fired when YCM opens the location list window in
  1849. response to the 'YcmDiags' command. By default, the location list window is
  1850. opened to the bottom of the current window and its height is set to fit all
  1851. entries. This behavior can be overridden by using the |YcmLocationOpened|
  1852. autocommand which is triggered while the cursor is in the location list window.
  1853. For instance:
  1854. >
  1855. function! s:CustomizeYcmLocationWindow()
  1856. " Move the window to the top of the screen.
  1857. wincmd K
  1858. " Set the window height to 5.
  1859. 5wincmd _
  1860. " Switch back to working window.
  1861. wincmd p
  1862. endfunction
  1863. autocmd User YcmLocationOpened call s:CustomizeYcmLocationWindow()
  1864. <
  1865. -------------------------------------------------------------------------------
  1866. The *YcmQuickFixOpened* autocommand
  1867. This 'User' autocommand is fired when YCM opens the quickfix window in response
  1868. to the 'GoTo*' and 'RefactorRename' subcommands. By default, the quickfix
  1869. window is opened to full width at the bottom of the screen and its height is
  1870. set to fit all entries. This behavior can be overridden by using the
  1871. |YcmQuickFixOpened| autocommand which is triggered while the cursor is in the
  1872. quickfix window. For instance:
  1873. >
  1874. function! s:CustomizeYcmQuickFixWindow()
  1875. " Move the window to the top of the screen.
  1876. wincmd K
  1877. " Set the window height to 5.
  1878. 5wincmd _
  1879. endfunction
  1880. autocmd User YcmQuickFixOpened call s:CustomizeYcmQuickFixWindow()
  1881. <
  1882. ===============================================================================
  1883. *youcompleteme-options*
  1884. Options ~
  1885. All options have reasonable defaults so if the plug-in works after installation
  1886. you don't need to change any options. These options can be configured in your
  1887. vimrc script [31] by including a line like this:
  1888. >
  1889. let g:ycm_min_num_of_chars_for_completion = 1
  1890. <
  1891. Note that after changing an option in your vimrc script [31] you have to
  1892. restart ycmd [43] with the |:YcmRestartServer| command for the changes to take
  1893. effect.
  1894. -------------------------------------------------------------------------------
  1895. The *g:ycm_min_num_of_chars_for_completion* option
  1896. This option controls the number of characters the user needs to type before
  1897. identifier-based completion suggestions are triggered. For example, if the
  1898. option is set to '2', then when the user types a second alphanumeric character
  1899. after a whitespace character, completion suggestions will be triggered. This
  1900. option is NOT used for semantic completion.
  1901. Setting this option to a high number like '99' effectively turns off the
  1902. identifier completion engine and just leaves the semantic engine.
  1903. Default: '2'
  1904. >
  1905. let g:ycm_min_num_of_chars_for_completion = 2
  1906. <
  1907. -------------------------------------------------------------------------------
  1908. The *g:ycm_min_num_identifier_candidate_chars* option
  1909. This option controls the minimum number of characters that a completion
  1910. candidate coming from the identifier completer must have to be shown in the
  1911. popup menu.
  1912. A special value of '0' means there is no limit.
  1913. **NOTE:** This option only applies to the identifier completer; it has no
  1914. effect on the various semantic completers.
  1915. Default: '0'
  1916. >
  1917. let g:ycm_min_num_identifier_candidate_chars = 0
  1918. <
  1919. -------------------------------------------------------------------------------
  1920. The *g:ycm_max_num_candidates* option
  1921. This option controls the maximum number of semantic completion suggestions
  1922. shown in the completion menu. This only applies to suggestions from semantic
  1923. completion engines; see the 'g:ycm_max_identifier_candidates' option to limit
  1924. the number of suggestions from the identifier-based engine.
  1925. A special value of '0' means there is no limit.
  1926. **NOTE:** Setting this option to '0' or to a value greater than '100' is not
  1927. recommended as it will slow down completion when there are a very large number
  1928. of suggestions.
  1929. Default: '50'
  1930. >
  1931. let g:ycm_max_num_candidates = 50
  1932. <
  1933. -------------------------------------------------------------------------------
  1934. The *g:ycm_max_num_identifier_candidates* option
  1935. This option controls the maximum number of completion suggestions from the
  1936. identifier-based engine shown in the completion menu.
  1937. A special value of '0' means there is no limit.
  1938. **NOTE:** Setting this option to '0' or to a value greater than '100' is not
  1939. recommended as it will slow down completion when there are a very large number
  1940. of suggestions.
  1941. Default: '10'
  1942. >
  1943. let g:ycm_max_num_identifier_candidates = 10
  1944. <
  1945. -------------------------------------------------------------------------------
  1946. The *g:ycm_auto_trigger* option
  1947. When set to '0', this option turns off YCM's identifier completer (the
  1948. as-you-type popup) _and_ the semantic triggers (the popup you'd get after
  1949. typing '.' or '->' in say C++). You can still force semantic completion with
  1950. the '<C-Space>' shortcut.
  1951. If you want to just turn off the identifier completer but keep the semantic
  1952. triggers, you should set |g:ycm_min_num_of_chars_for_completion| to a high
  1953. number like '99'.
  1954. Default: '1'
  1955. >
  1956. let g:ycm_auto_trigger = 1
  1957. <
  1958. -------------------------------------------------------------------------------
  1959. The *g:ycm_filetype_whitelist* option
  1960. This option controls for which Vim filetypes (see ':h filetype') should YCM be
  1961. turned on. The option value should be a Vim dictionary with keys being filetype
  1962. strings (like 'python', 'cpp', etc.) and values being unimportant (the
  1963. dictionary is used like a hash set, meaning that only the keys matter).
  1964. The '*' key is special and matches all filetypes. By default, the whitelist
  1965. contains only this '*' key.
  1966. YCM also has a |g:ycm_filetype_blacklist| option that lists filetypes for which
  1967. YCM shouldn't be turned on. YCM will work only in filetypes that both the
  1968. whitelist and the blacklist allow (the blacklist "allows" a filetype by _not_
  1969. having it as a key).
  1970. For example, let's assume you want YCM to work in files with the 'cpp'
  1971. filetype. The filetype should then be present in the whitelist either directly
  1972. ('cpp' key in the whitelist) or indirectly through the special '*' key. It
  1973. should _not_ be present in the blacklist.
  1974. Filetypes that are blocked by the either of the lists will be completely
  1975. ignored by YCM, meaning that neither the identifier-based completion engine nor
  1976. the semantic engine will operate in them.
  1977. You can get the filetype of the current file in Vim with ':set ft?'.
  1978. Default: "{'*': 1}"
  1979. >
  1980. let g:ycm_filetype_whitelist = {'*': 1}
  1981. <
  1982. -------------------------------------------------------------------------------
  1983. The *g:ycm_filetype_blacklist* option
  1984. This option controls for which Vim filetypes (see ':h filetype') should YCM be
  1985. turned off. The option value should be a Vim dictionary with keys being
  1986. filetype strings (like 'python', 'cpp', etc.) and values being unimportant (the
  1987. dictionary is used like a hash set, meaning that only the keys matter).
  1988. See the |g:ycm_filetype_whitelist| option for more details on how this works.
  1989. Default: '[see next line]'
  1990. >
  1991. let g:ycm_filetype_blacklist = {
  1992. \ 'tagbar': 1,
  1993. \ 'notes': 1,
  1994. \ 'markdown': 1,
  1995. \ 'netrw': 1,
  1996. \ 'unite': 1,
  1997. \ 'text': 1,
  1998. \ 'vimwiki': 1,
  1999. \ 'pandoc': 1,
  2000. \ 'infolog': 1,
  2001. \ 'mail': 1
  2002. \}
  2003. <
  2004. -------------------------------------------------------------------------------
  2005. The *g:ycm_filetype_specific_completion_to_disable* option
  2006. This option controls for which Vim filetypes (see ':h filetype') should the YCM
  2007. semantic completion engine be turned off. The option value should be a Vim
  2008. dictionary with keys being filetype strings (like 'python', 'cpp', etc.) and
  2009. values being unimportant (the dictionary is used like a hash set, meaning that
  2010. only the keys matter). The listed filetypes will be ignored by the YCM semantic
  2011. completion engine, but the identifier-based completion engine will still
  2012. trigger in files of those filetypes.
  2013. Note that even if semantic completion is not turned off for a specific
  2014. filetype, you will not get semantic completion if the semantic engine does not
  2015. support that filetype.
  2016. You can get the filetype of the current file in Vim with ':set ft?'.
  2017. Default: '[see next line]'
  2018. >
  2019. let g:ycm_filetype_specific_completion_to_disable = {
  2020. \ 'gitcommit': 1
  2021. \}
  2022. <
  2023. -------------------------------------------------------------------------------
  2024. The *g:ycm_filepath_blacklist* option
  2025. This option controls for which Vim filetypes (see ':h filetype') should
  2026. filepath completion be disabled. The option value should be a Vim dictionary
  2027. with keys being filetype strings (like 'python', 'cpp', etc.) and values being
  2028. unimportant (the dictionary is used like a hash set, meaning that only the keys
  2029. matter).
  2030. The '*' key is special and matches all filetypes. Use this key if you want to
  2031. completely disable filepath completion:
  2032. >
  2033. let g:ycm_filepath_blacklist = {'*': 1}
  2034. <
  2035. You can get the filetype of the current file in Vim with ':set ft?'.
  2036. Default: '[see next line]'
  2037. >
  2038. let g:ycm_filepath_blacklist = {
  2039. \ 'html': 1,
  2040. \ 'jsx': 1,
  2041. \ 'xml': 1,
  2042. \}
  2043. <
  2044. -------------------------------------------------------------------------------
  2045. The *g:ycm_show_diagnostics_ui* option
  2046. When set, this option turns on YCM's diagnostic display features. See the
  2047. _Diagnostic display_ section in the _User Manual_ for more details.
  2048. Specific parts of the diagnostics UI (like the gutter signs, text highlighting,
  2049. diagnostic echo and auto location list population) can be individually turned
  2050. on or off. See the other options below for details.
  2051. Note that YCM's diagnostics UI is only supported for C-family languages.
  2052. When set, this option also makes YCM remove all Syntastic checkers set for the
  2053. 'c', 'cpp', 'objc', 'objcpp', and 'cuda' filetypes since this would conflict
  2054. with YCM's own diagnostics UI.
  2055. If you're using YCM's identifier completer in C-family languages but cannot use
  2056. the clang-based semantic completer for those languages _and_ want to use the
  2057. GCC Syntastic checkers, unset this option.
  2058. Default: '1'
  2059. >
  2060. let g:ycm_show_diagnostics_ui = 1
  2061. <
  2062. -------------------------------------------------------------------------------
  2063. The *g:ycm_error_symbol* option
  2064. YCM will use the value of this option as the symbol for errors in the Vim
  2065. gutter.
  2066. This option is part of the Syntastic compatibility layer; if the option is not
  2067. set, YCM will fall back to the value of the 'g:syntastic_error_symbol' option
  2068. before using this option's default.
  2069. Default: '>>'
  2070. >
  2071. let g:ycm_error_symbol = '>>'
  2072. <
  2073. -------------------------------------------------------------------------------
  2074. The *g:ycm_warning_symbol* option
  2075. YCM will use the value of this option as the symbol for warnings in the Vim
  2076. gutter.
  2077. This option is part of the Syntastic compatibility layer; if the option is not
  2078. set, YCM will fall back to the value of the 'g:syntastic_warning_symbol' option
  2079. before using this option's default.
  2080. Default: '>>'
  2081. >
  2082. let g:ycm_warning_symbol = '>>'
  2083. <
  2084. -------------------------------------------------------------------------------
  2085. The *g:ycm_enable_diagnostic_signs* option
  2086. When this option is set, YCM will put icons in Vim's gutter on lines that have
  2087. a diagnostic set. Turning this off will also turn off the 'YcmErrorLine' and
  2088. 'YcmWarningLine' highlighting.
  2089. This option is part of the Syntastic compatibility layer; if the option is not
  2090. set, YCM will fall back to the value of the 'g:syntastic_enable_signs' option
  2091. before using this option's default.
  2092. Default: '1'
  2093. >
  2094. let g:ycm_enable_diagnostic_signs = 1
  2095. <
  2096. -------------------------------------------------------------------------------
  2097. The *g:ycm_enable_diagnostic_highlighting* option
  2098. When this option is set, YCM will highlight regions of text that are related to
  2099. the diagnostic that is present on a line, if any.
  2100. This option is part of the Syntastic compatibility layer; if the option is not
  2101. set, YCM will fall back to the value of the 'g:syntastic_enable_highlighting'
  2102. option before using this option's default.
  2103. Default: '1'
  2104. >
  2105. let g:ycm_enable_diagnostic_highlighting = 1
  2106. <
  2107. -------------------------------------------------------------------------------
  2108. The *g:ycm_echo_current_diagnostic* option
  2109. When this option is set, YCM will echo the text of the diagnostic present on
  2110. the current line when you move your cursor to that line. If a |FixIt| is
  2111. available for the current diagnostic, then '(FixIt)' is appended.
  2112. This option is part of the Syntastic compatibility layer; if the option is not
  2113. set, YCM will fall back to the value of the 'g:syntastic_echo_current_error'
  2114. option before using this option's default.
  2115. Default: '1'
  2116. >
  2117. let g:ycm_echo_current_diagnostic = 1
  2118. <
  2119. -------------------------------------------------------------------------------
  2120. The *g:ycm_filter_diagnostics* option
  2121. This option controls which diagnostics will be rendered by YCM. This option
  2122. holds a dictionary of key-values, where the keys are Vim's filetype strings
  2123. delimited by commas and values are dictionaries describing the filter.
  2124. A filter is a dictionary of key-values, where the keys are the type of filter,
  2125. and the value is a list of arguments to that filter. In the case of just a
  2126. single item in the list, you may omit the brackets and just provide the
  2127. argument directly. If any filter matches a diagnostic, it will be dropped and
  2128. YCM will not render it.
  2129. The following filter types are supported:
  2130. - "regex": Accepts a string regular expression [70]. This type matches when
  2131. the regex (treated as case-insensitive) is found in the diagnostic text.
  2132. - "level": Accepts a string level, either "warning" or "error." This type
  2133. matches when the diagnostic has the same level.
  2134. **NOTE:** The regex syntax is **NOT** Vim's, it's Python's [70].
  2135. Default: '{}'
  2136. >
  2137. let g:ycm_filter_diagnostics = {
  2138. \ "java": {
  2139. \ "regex": [ ".*taco.*", ... ],
  2140. \ "level": "error",
  2141. \ ...
  2142. \ }
  2143. \ }
  2144. <
  2145. -------------------------------------------------------------------------------
  2146. The *g:ycm_always_populate_location_list* option
  2147. When this option is set, YCM will populate the location list automatically
  2148. every time it gets new diagnostic data. This option is off by default so as not
  2149. to interfere with other data you might have placed in the location list.
  2150. See ':help location-list' in Vim to learn more about the location list.
  2151. This option is part of the Syntastic compatibility layer; if the option is not
  2152. set, YCM will fall back to the value of the
  2153. 'g:syntastic_always_populate_loc_list' option before using this option's
  2154. default.
  2155. Default: '0'
  2156. >
  2157. let g:ycm_always_populate_location_list = 0
  2158. <
  2159. -------------------------------------------------------------------------------
  2160. The *g:ycm_open_loclist_on_ycm_diags* option
  2161. When this option is set, |:YcmDiags| will automatically open the location list
  2162. after forcing a compilation and filling the list with diagnostic data.
  2163. See ':help location-list' in Vim to learn more about the location list.
  2164. Default: '1'
  2165. >
  2166. let g:ycm_open_loclist_on_ycm_diags = 1
  2167. <
  2168. -------------------------------------------------------------------------------
  2169. The *g:ycm_complete_in_comments* option
  2170. When this option is set to '1', YCM will show the completion menu even when
  2171. typing inside comments.
  2172. Default: '0'
  2173. >
  2174. let g:ycm_complete_in_comments = 0
  2175. <
  2176. -------------------------------------------------------------------------------
  2177. The *g:ycm_complete_in_strings* option
  2178. When this option is set to '1', YCM will show the completion menu even when
  2179. typing inside strings.
  2180. Note that this is turned on by default so that you can use the filename
  2181. completion inside strings. This is very useful for instance in C-family files
  2182. where typing '#include "' will trigger the start of filename completion. If you
  2183. turn off this option, you will turn off filename completion in such situations
  2184. as well.
  2185. Default: '1'
  2186. >
  2187. let g:ycm_complete_in_strings = 1
  2188. <
  2189. -------------------------------------------------------------------------------
  2190. The *g:ycm_collect_identifiers_from_comments_and_strings* option
  2191. When this option is set to '1', YCM's identifier completer will also collect
  2192. identifiers from strings and comments. Otherwise, the text in comments and
  2193. strings will be ignored.
  2194. Default: '0'
  2195. >
  2196. let g:ycm_collect_identifiers_from_comments_and_strings = 0
  2197. <
  2198. -------------------------------------------------------------------------------
  2199. The *g:ycm_collect_identifiers_from_tags_files* option
  2200. When this option is set to '1', YCM's identifier completer will also collect
  2201. identifiers from tags files. The list of tags files to examine is retrieved
  2202. from the 'tagfiles()' Vim function which examines the 'tags' Vim option. See
  2203. ":h 'tags'" for details.
  2204. YCM will re-index your tags files if it detects that they have been modified.
  2205. The only supported tag format is the Exuberant Ctags format [71]. The format
  2206. from "plain" ctags is NOT supported. Ctags needs to be called with the
  2207. '--fields=+l' option (that's a lowercase 'L', not a one) because YCM needs the
  2208. 'language:<lang>' field in the tags output.
  2209. See the _FAQ_ for pointers if YCM does not appear to read your tag files.
  2210. This option is off by default because it makes Vim slower if your tags are on a
  2211. network directory.
  2212. Default: '0'
  2213. >
  2214. let g:ycm_collect_identifiers_from_tags_files = 0
  2215. <
  2216. -------------------------------------------------------------------------------
  2217. The *g:ycm_seed_identifiers_with_syntax* option
  2218. When this option is set to '1', YCM's identifier completer will seed its
  2219. identifier database with the keywords of the programming language you're
  2220. writing.
  2221. Since the keywords are extracted from the Vim syntax file for the filetype, all
  2222. keywords may not be collected, depending on how the syntax file was written.
  2223. Usually at least 95% of the keywords are successfully extracted.
  2224. Default: '0'
  2225. >
  2226. let g:ycm_seed_identifiers_with_syntax = 0
  2227. <
  2228. -------------------------------------------------------------------------------
  2229. The *g:ycm_extra_conf_vim_data* option
  2230. If you're using semantic completion for C-family files, this option might come
  2231. handy; it's a way of sending data from Vim to your 'Settings' function in your
  2232. '.ycm_extra_conf.py' file.
  2233. This option is supposed to be a list of VimScript expression strings that are
  2234. evaluated for every request to the ycmd server [43] and then passed to your
  2235. 'Settings' function as a 'client_data' keyword argument.
  2236. For instance, if you set this option to "['v:version']", your 'Settings'
  2237. function will be called like this:
  2238. >
  2239. # The '801' value is of course contingent on Vim 8.1; in 8.0 it would be '800'
  2240. Settings( ..., client_data = { 'v:version': 801 } )
  2241. <
  2242. So the 'client_data' parameter is a dictionary mapping Vim expression strings
  2243. to their values at the time of the request.
  2244. The correct way to define parameters for your 'Settings' function:
  2245. >
  2246. def Settings( **kwargs ):
  2247. <
  2248. You can then get to 'client_data' with "kwargs['client_data']".
  2249. Default: '[]'
  2250. >
  2251. let g:ycm_extra_conf_vim_data = []
  2252. <
  2253. -------------------------------------------------------------------------------
  2254. The *g:ycm_server_python_interpreter* option
  2255. YCM will by default search for an appropriate Python interpreter on your
  2256. system. You can use this option to override that behavior and force the use of
  2257. a specific interpreter of your choosing.
  2258. **NOTE:** This interpreter is only used for the ycmd server [43]. The YCM
  2259. client running inside Vim always uses the Python interpreter that's embedded
  2260. inside Vim.
  2261. Default: "''"
  2262. >
  2263. let g:ycm_server_python_interpreter = ''
  2264. <
  2265. -------------------------------------------------------------------------------
  2266. The *g:ycm_keep_logfiles* option
  2267. When this option is set to '1', YCM and the ycmd completion server [43] will
  2268. keep the logfiles around after shutting down (they are deleted on shutdown by
  2269. default).
  2270. To see where the logfiles are, call |:YcmDebugInfo|.
  2271. Default: '0'
  2272. >
  2273. let g:ycm_keep_logfiles = 0
  2274. <
  2275. -------------------------------------------------------------------------------
  2276. The *g:ycm_log_level* option
  2277. The logging level that YCM and the ycmd completion server [43] use. Valid
  2278. values are the following, from most verbose to least verbose: - 'debug' -
  2279. 'info' - 'warning' - 'error' - 'critical'
  2280. Note that 'debug' is _very_ verbose.
  2281. Default: 'info'
  2282. >
  2283. let g:ycm_log_level = 'info'
  2284. <
  2285. -------------------------------------------------------------------------------
  2286. The *g:ycm_auto_start_csharp_server* option
  2287. When set to '1', the OmniSharp server will be automatically started (once per
  2288. Vim session) when you open a C# file.
  2289. Default: '1'
  2290. >
  2291. let g:ycm_auto_start_csharp_server = 1
  2292. <
  2293. -------------------------------------------------------------------------------
  2294. The *g:ycm_auto_stop_csharp_server* option
  2295. When set to '1', the OmniSharp server will be automatically stopped upon
  2296. closing Vim.
  2297. Default: '1'
  2298. >
  2299. let g:ycm_auto_stop_csharp_server = 1
  2300. <
  2301. -------------------------------------------------------------------------------
  2302. The *g:ycm_csharp_server_port* option
  2303. When g:ycm_auto_start_csharp_server is set to '1', specifies the port for the
  2304. OmniSharp server to listen on. When set to '0' uses an unused port provided by
  2305. the OS.
  2306. Default: '0'
  2307. >
  2308. let g:ycm_csharp_server_port = 0
  2309. <
  2310. -------------------------------------------------------------------------------
  2311. The *g:ycm_csharp_insert_namespace_expr* option
  2312. By default, when YCM inserts a namespace, it will insert the 'using' statement
  2313. under the nearest 'using' statement. You may prefer that the 'using' statement
  2314. is inserted somewhere, for example, to preserve sorting. If so, you can set
  2315. this option to override this behavior.
  2316. When this option is set, instead of inserting the 'using' statement itself, YCM
  2317. will set the global variable 'g:ycm_namespace_to_insert' to the namespace to
  2318. insert, and then evaluate this option's value as an expression. The option's
  2319. expression is responsible for inserting the namespace - the default insertion
  2320. will not occur.
  2321. Default: ''
  2322. >
  2323. let g:ycm_csharp_insert_namespace_expr = ''
  2324. <
  2325. -------------------------------------------------------------------------------
  2326. The *g:ycm_add_preview_to_completeopt* option
  2327. When this option is set to '1', YCM will add the 'preview' string to Vim's
  2328. 'completeopt' option (see ':h completeopt'). If your 'completeopt' option
  2329. already has 'preview' set, there will be no effect. You can see the current
  2330. state of your 'completeopt' setting with ':set completeopt?' (yes, the question
  2331. mark is important).
  2332. When 'preview' is present in 'completeopt', YCM will use the 'preview' window
  2333. at the top of the file to store detailed information about the current
  2334. completion candidate (but only if the candidate came from the semantic engine).
  2335. For instance, it would show the full function prototype and all the function
  2336. overloads in the window if the current completion is a function name.
  2337. Default: '0'
  2338. >
  2339. let g:ycm_add_preview_to_completeopt = 0
  2340. <
  2341. -------------------------------------------------------------------------------
  2342. The *g:ycm_autoclose_preview_window_after_completion* option
  2343. When this option is set to '1', YCM will auto-close the 'preview' window after
  2344. the user accepts the offered completion string. If there is no 'preview' window
  2345. triggered because there is no 'preview' string in 'completeopt', this option is
  2346. irrelevant. See the |g:ycm_add_preview_to_completeopt| option for more details.
  2347. Default: '0'
  2348. >
  2349. let g:ycm_autoclose_preview_window_after_completion = 0
  2350. <
  2351. -------------------------------------------------------------------------------
  2352. The *g:ycm_autoclose_preview_window_after_insertion* option
  2353. When this option is set to '1', YCM will auto-close the 'preview' window after
  2354. the user leaves insert mode. This option is irrelevant if
  2355. |g:ycm_autoclose_preview_window_after_completion| is set or if no 'preview'
  2356. window is triggered. See the |g:ycm_add_preview_to_completeopt| option for more
  2357. details.
  2358. Default: '0'
  2359. >
  2360. let g:ycm_autoclose_preview_window_after_insertion = 0
  2361. <
  2362. -------------------------------------------------------------------------------
  2363. The *g:ycm_max_diagnostics_to_display* option
  2364. This option controls the maximum number of diagnostics shown to the user when
  2365. errors or warnings are detected in the file. This option is only relevant for
  2366. the C-family, C#, Java, JavaScript, and TypeScript languages.
  2367. A special value of '0' means there is no limit.
  2368. Default: '30'
  2369. >
  2370. let g:ycm_max_diagnostics_to_display = 30
  2371. <
  2372. -------------------------------------------------------------------------------
  2373. The *g:ycm_key_list_select_completion* option
  2374. This option controls the key mappings used to select the first completion
  2375. string. Invoking any of them repeatedly cycles forward through the completion
  2376. list.
  2377. Some users like adding '<Enter>' to this list.
  2378. Default: "['<TAB>', '<Down>']"
  2379. >
  2380. let g:ycm_key_list_select_completion = ['<TAB>', '<Down>']
  2381. <
  2382. -------------------------------------------------------------------------------
  2383. The *g:ycm_key_list_previous_completion* option
  2384. This option controls the key mappings used to select the previous completion
  2385. string. Invoking any of them repeatedly cycles backwards through the completion
  2386. list.
  2387. Note that one of the defaults is '<S-TAB>' which means Shift-TAB. That mapping
  2388. will probably only work in GUI Vim (Gvim or MacVim) and not in plain console
  2389. Vim because the terminal usually does not forward modifier key combinations to
  2390. Vim.
  2391. Default: "['<S-TAB>', '<Up>']"
  2392. >
  2393. let g:ycm_key_list_previous_completion = ['<S-TAB>', '<Up>']
  2394. <
  2395. -------------------------------------------------------------------------------
  2396. The *g:ycm_key_list_stop_completion* option
  2397. This option controls the key mappings used to close the completion menu. This
  2398. is useful when the menu is blocking the view, when you need to insert the
  2399. '<TAB>' character, or when you want to expand a snippet from UltiSnips [19] and
  2400. navigate through it.
  2401. Default: "['<C-y>']"
  2402. >
  2403. let g:ycm_key_list_stop_completion = ['<C-y>']
  2404. <
  2405. -------------------------------------------------------------------------------
  2406. The *g:ycm_key_invoke_completion* option
  2407. This option controls the key mapping used to invoke the completion menu for
  2408. semantic completion. By default, semantic completion is triggered automatically
  2409. after typing '.', '->' and '::' in insert mode (if semantic completion support
  2410. has been compiled in). This key mapping can be used to trigger semantic
  2411. completion anywhere. Useful for searching for top-level functions and classes.
  2412. Console Vim (not Gvim or MacVim) passes '<Nul>' to Vim when the user types
  2413. '<C-Space>' so YCM will make sure that '<Nul>' is used in the map command when
  2414. you're editing in console Vim, and '<C-Space>' in GUI Vim. This means that you
  2415. can just press '<C-Space>' in both console and GUI Vim and YCM will do the
  2416. right thing.
  2417. Setting this option to an empty string will make sure no mapping is created.
  2418. Default: '<C-Space>'
  2419. >
  2420. let g:ycm_key_invoke_completion = '<C-Space>'
  2421. <
  2422. -------------------------------------------------------------------------------
  2423. The *g:ycm_key_detailed_diagnostics* option
  2424. This option controls the key mapping used to show the full diagnostic text when
  2425. the user's cursor is on the line with the diagnostic. It basically calls
  2426. |:YcmShowDetailedDiagnostic|.
  2427. Setting this option to an empty string will make sure no mapping is created.
  2428. Default: '<leader>d'
  2429. >
  2430. let g:ycm_key_detailed_diagnostics = '<leader>d'
  2431. <
  2432. -------------------------------------------------------------------------------
  2433. The *g:ycm_global_ycm_extra_conf* option
  2434. Normally, YCM searches for a '.ycm_extra_conf.py' file for compilation flags
  2435. (see the User Guide for more details on how this works). This option specifies
  2436. a fallback path to a config file which is used if no '.ycm_extra_conf.py' is
  2437. found.
  2438. You can place such a global file anywhere in your filesystem.
  2439. Default: "''"
  2440. >
  2441. let g:ycm_global_ycm_extra_conf = ''
  2442. <
  2443. -------------------------------------------------------------------------------
  2444. The *g:ycm_confirm_extra_conf* option
  2445. When this option is set to '1' YCM will ask once per '.ycm_extra_conf.py' file
  2446. if it is safe to be loaded. This is to prevent execution of malicious code from
  2447. a '.ycm_extra_conf.py' file you didn't write.
  2448. To selectively get YCM to ask/not ask about loading certain
  2449. '.ycm_extra_conf.py' files, see the |g:ycm_extra_conf_globlist| option.
  2450. Default: '1'
  2451. >
  2452. let g:ycm_confirm_extra_conf = 1
  2453. <
  2454. -------------------------------------------------------------------------------
  2455. The *g:ycm_extra_conf_globlist* option
  2456. This option is a list that may contain several globbing patterns. If a pattern
  2457. starts with a '!' all '.ycm_extra_conf.py' files matching that pattern will be
  2458. blacklisted, that is they won't be loaded and no confirmation dialog will be
  2459. shown. If a pattern does not start with a '!' all files matching that pattern
  2460. will be whitelisted. Note that this option is not used when confirmation is
  2461. disabled using |g:ycm_confirm_extra_conf| and that items earlier in the list
  2462. will take precedence over the later ones.
  2463. Rules:
  2464. - '*' matches everything
  2465. - '?' matches any single character
  2466. - '[seq]' matches any character in seq
  2467. - '[!seq]' matches any char not in seq
  2468. Example:
  2469. >
  2470. let g:ycm_extra_conf_globlist = ['~/dev/*','!~/*']
  2471. <
  2472. - The first rule will match everything contained in the '~/dev' directory so
  2473. '.ycm_extra_conf.py' files from there will be loaded.
  2474. - The second rule will match everything in the home directory so a
  2475. '.ycm_extra_conf.py' file from there won't be loaded.
  2476. - As the first rule takes precedence everything in the home directory
  2477. excluding the '~/dev' directory will be blacklisted.
  2478. **NOTE:** The glob pattern is first expanded with Python's
  2479. 'os.path.expanduser()' and then resolved with 'os.path.abspath()' before being
  2480. matched against the filename.
  2481. Default: '[]'
  2482. >
  2483. let g:ycm_extra_conf_globlist = []
  2484. <
  2485. -------------------------------------------------------------------------------
  2486. The *g:ycm_filepath_completion_use_working_dir* option
  2487. By default, YCM's filepath completion will interpret relative paths like '../'
  2488. as being relative to the folder of the file of the currently active buffer.
  2489. Setting this option will force YCM to always interpret relative paths as being
  2490. relative to Vim's current working directory.
  2491. Default: '0'
  2492. >
  2493. let g:ycm_filepath_completion_use_working_dir = 0
  2494. <
  2495. -------------------------------------------------------------------------------
  2496. The *g:ycm_semantic_triggers* option
  2497. This option controls the character-based triggers for the various semantic
  2498. completion engines. The option holds a dictionary of key-values, where the keys
  2499. are Vim's filetype strings delimited by commas and values are lists of strings,
  2500. where the strings are the triggers.
  2501. Setting key-value pairs on the dictionary _adds_ semantic triggers to the
  2502. internal default set (listed below). You cannot remove the default triggers,
  2503. only add new ones.
  2504. A "trigger" is a sequence of one or more characters that trigger semantic
  2505. completion when typed. For instance, C++ ('cpp' filetype) has '.' listed as a
  2506. trigger. So when the user types 'foo.', the semantic engine will trigger and
  2507. serve 'foo''s list of member functions and variables. Since C++ also has '->'
  2508. listed as a trigger, the same thing would happen when the user typed 'foo->'.
  2509. It's also possible to use a regular expression as a trigger. You have to prefix
  2510. your trigger with 're!' to signify it's a regex trigger. For instance,
  2511. 're!\w+\.' would only trigger after the '\w+\.' regex matches.
  2512. **NOTE:** The regex syntax is **NOT** Vim's, it's Python's [70].
  2513. Default: '[see next line]'
  2514. >
  2515. let g:ycm_semantic_triggers = {
  2516. \ 'c': ['->', '.'],
  2517. \ 'objc': ['->', '.', 're!\[[_a-zA-Z]+\w*\s', 're!^\s*[^\W\d]\w*\s',
  2518. \ 're!\[.*\]\s'],
  2519. \ 'ocaml': ['.', '#'],
  2520. \ 'cpp,cuda,objcpp': ['->', '.', '::'],
  2521. \ 'perl': ['->'],
  2522. \ 'php': ['->', '::'],
  2523. \ 'cs,d,elixir,go,groovy,java,javascript,julia,perl6,python,scala,typescript,vb': ['.'],
  2524. \ 'ruby,rust': ['.', '::'],
  2525. \ 'lua': ['.', ':'],
  2526. \ 'erlang': [':'],
  2527. \ }
  2528. <
  2529. -------------------------------------------------------------------------------
  2530. The *g:ycm_cache_omnifunc* option
  2531. Some omnicompletion engines do not work well with the YCM cache—in particular,
  2532. they might not produce all possible results for a given prefix. By unsetting
  2533. this option you can ensure that the omnicompletion engine is re-queried on
  2534. every keypress. That will ensure all completions will be presented, but might
  2535. cause stuttering and lagginess if the omnifunc is slow.
  2536. Default: '1'
  2537. >
  2538. let g:ycm_cache_omnifunc = 1
  2539. <
  2540. -------------------------------------------------------------------------------
  2541. The *g:ycm_use_ultisnips_completer* option
  2542. By default, YCM will query the UltiSnips plugin for possible completions of
  2543. snippet triggers. This option can turn that behavior off.
  2544. Default: '1'
  2545. >
  2546. let g:ycm_use_ultisnips_completer = 1
  2547. <
  2548. -------------------------------------------------------------------------------
  2549. The *g:ycm_goto_buffer_command* option
  2550. Defines where 'GoTo*' commands result should be opened. Can take one of the
  2551. following values: "'same-buffer'", "'split'", or "'split-or-existing-window'".
  2552. If this option is set to the "'same-buffer'" but current buffer can not be
  2553. switched (when buffer is modified and 'nohidden' option is set), then result
  2554. will be opened in a split. When the option is set to
  2555. "'split-or-existing-window'", if the result is already open in a window of the
  2556. current tab page (or any tab pages with the ':tab' modifier; see below), it
  2557. will jump to that window. Otherwise, the result will be opened in a split as if
  2558. the option was set to "'split'".
  2559. To customize the way a new window is split, prefix the 'GoTo*' command with one
  2560. of the following modifiers: ':aboveleft', ':belowright', ':botright',
  2561. ':leftabove', ':rightbelow', ':topleft', and ':vertical'. For instance, to
  2562. split vertically to the right of the current window, run the command:
  2563. >
  2564. :rightbelow vertical YcmCompleter GoTo
  2565. <
  2566. To open in a new tab page, use the ':tab' modifier with the "'split'" or
  2567. "'split-or-existing-window'" options e.g.:
  2568. >
  2569. :tab YcmCompleter GoTo
  2570. <
  2571. **NOTE:** command modifiers were added in Vim 7.4.1898. If you are using an
  2572. older version, you can still configure this by setting the option to one of the
  2573. deprecated values: "'vertical-split'", "'new-tab'", or "'new-or-existing-tab'".
  2574. Default: "'same-buffer'"
  2575. >
  2576. let g:ycm_goto_buffer_command = 'same-buffer'
  2577. <
  2578. -------------------------------------------------------------------------------
  2579. The *g:ycm_disable_for_files_larger_than_kb* option
  2580. Defines the max size (in Kb) for a file to be considered for completion. If
  2581. this option is set to 0 then no check is made on the size of the file you're
  2582. opening.
  2583. Default: 1000
  2584. >
  2585. let g:ycm_disable_for_files_larger_than_kb = 1000
  2586. <
  2587. -------------------------------------------------------------------------------
  2588. The *g:ycm_use_clangd* option
  2589. This option controls whether **clangd** should be used as completion engine for
  2590. C-family languages. Can take one of the following values: '1', '0', with
  2591. meanings:
  2592. - '1': YCM will use clangd if clangd binary exists in third party or it was
  2593. provided with 'ycm_clangd_binary_path' option.
  2594. - '0': YCM will never use clangd completer.
  2595. Default: '1'
  2596. >
  2597. let g:ycm_use_clangd = 1
  2598. <
  2599. -------------------------------------------------------------------------------
  2600. The *g:ycm_clangd_binary_path* option
  2601. When 'ycm_use_clangd' option is set to '1', this option sets the path to
  2602. **clangd** binary.
  2603. Default: "''"
  2604. >
  2605. let g:ycm_clangd_binary_path = ''
  2606. <
  2607. -------------------------------------------------------------------------------
  2608. The *g:ycm_clangd_args* option
  2609. This option controls the command line arguments passed to the clangd binary. It
  2610. appends new options and overrides the existing ones.
  2611. Default: '[]'
  2612. >
  2613. let g:ycm_clangd_args = []
  2614. <
  2615. -------------------------------------------------------------------------------
  2616. The *g:ycm_clangd_uses_ycmd_caching* option
  2617. This option controls which ranking and filtering algorithm to use for
  2618. completion items. It can take values:
  2619. - '1': Uses ycmd's caching and filtering logic.
  2620. - '0': Uses clangd's caching and filtering logic.
  2621. Default: '1'
  2622. >
  2623. let g:ycm_clangd_uses_ycmd_caching = 1
  2624. <
  2625. ===============================================================================
  2626. *youcompleteme-faq*
  2627. FAQ ~
  2628. -------------------------------------------------------------------------------
  2629. *youcompleteme-i-used-to-be-able-to-import-vim-in-.ycm_extra_conf.py-but-now-cant*
  2630. I used to be able to 'import vim' in '.ycm_extra_conf.py', but now can't ~
  2631. YCM was rewritten to use a client-server architecture where most of the logic
  2632. is in the ycmd server [43]. So the magic 'vim' module you could have previously
  2633. imported in your '.ycm_extra_conf.py' files doesn't exist anymore.
  2634. To be fair, importing the magic 'vim' module in extra conf files was never
  2635. supported in the first place; it only ever worked by accident and was never a
  2636. part of the extra conf API.
  2637. But fear not, you should be able to tweak your extra conf files to continue
  2638. working by using the |g:ycm_extra_conf_vim_data| option. See the docs on that
  2639. option for details.
  2640. -------------------------------------------------------------------------------
  2641. *youcompleteme-i-get-importerror-exceptions-that-mention-pyinit_ycm_core-or-initycm_core*
  2642. I get 'ImportError' exceptions that mention 'PyInit_ycm_core' or ~
  2643. 'initycm_core' ~
  2644. These errors are caused by building the YCM native libraries for Python 2 and
  2645. trying to load them into a Python 3 process (or the other way around).
  2646. For instance, if building for Python 2 but loading in Python 3:
  2647. >
  2648. ImportError: dynamic module does not define init function (PyInit_ycm_core)
  2649. <
  2650. If building for Python 3 but loading in Python 2:
  2651. >
  2652. ImportError: dynamic module does not define init function (initycm_core)
  2653. <
  2654. Setting the |g:ycm_server_python_interpreter| option to force the use of a
  2655. specific Python interpreter for 'ycmd' is usually the easiest way to solve the
  2656. problem. Common values for that option are '/usr/bin/python' and
  2657. '/usr/bin/python3'.
  2658. -------------------------------------------------------------------------------
  2659. *youcompleteme-i-get-linker-warning-regarding-libpython-on-macos-when-compiling-ycm*
  2660. I get a linker warning regarding 'libpython' on macOS when compiling YCM ~
  2661. If the warning is "ld: warning: path '/usr/lib/libpython2.7.dylib' following -L
  2662. not a directory", then feel free to ignore it; it's caused by a limitation of
  2663. CMake and is not an issue. Everything should still work fine.
  2664. -------------------------------------------------------------------------------
  2665. *youcompleteme-i-get-weird-window-at-top-of-my-file-when-i-use-semantic-engine*
  2666. I get a weird window at the top of my file when I use the semantic engine ~
  2667. This is Vim's 'preview' window. Vim uses it to show you extra information about
  2668. something if such information is available. YCM provides Vim with such extra
  2669. information. For instance, when you select a function in the completion list,
  2670. the 'preview' window will hold that function's prototype and the prototypes of
  2671. any overloads of the function. It will stay there after you select the
  2672. completion so that you can use the information about the parameters and their
  2673. types to write the function call.
  2674. If you would like this window to auto-close after you select a completion
  2675. string, set the |g:ycm_autoclose_preview_window_after_completion| option to '1'
  2676. in your 'vimrc' file. Similarly, the
  2677. |g:ycm_autoclose_preview_window_after_insertion| option can be set to close the
  2678. 'preview' window after leaving insert mode.
  2679. If you don't want this window to ever show up, add 'set completeopt-=preview'
  2680. to your 'vimrc'. Also make sure that the |g:ycm_add_preview_to_completeopt|
  2681. option is set to '0'.
  2682. -------------------------------------------------------------------------------
  2683. *youcompleteme-it-appears-that-ycm-is-not-working*
  2684. It appears that YCM is not working ~
  2685. In Vim, run ':messages' and carefully read the output. YCM will echo messages
  2686. to the message log if it encounters problems. It's likely you misconfigured
  2687. something and YCM is complaining about it.
  2688. Also, you may want to run the |:YcmDebugInfo| command; it will make YCM spew
  2689. out various debugging information, including the YCM and ycmd [43] logfile
  2690. paths and the compile flags for the current file if the file is a C-family
  2691. language file and you have compiled in Clang support. Logfiles can be opened in
  2692. the editor using the |:YcmToggleLogs| command.
  2693. -------------------------------------------------------------------------------
  2694. *youcompleteme-sometimes-it-takes-much-longer-to-get-semantic-completions-than-normal*
  2695. Sometimes it takes much longer to get semantic completions than normal ~
  2696. This means that libclang (which YCM uses for C-family semantic completion)
  2697. failed to pre-compile your file's preamble. In other words, there was an error
  2698. compiling some of the source code you pulled in through your header files. I
  2699. suggest calling the |:YcmDiags| command to see what they were.
  2700. Bottom line, if libclang can't pre-compile your file's preamble because there
  2701. were errors in it, you're going to get slow completions because there's no AST
  2702. cache.
  2703. -------------------------------------------------------------------------------
  2704. *youcompleteme-ycm-auto-inserts-completion-strings-i-dont-want*
  2705. YCM auto-inserts completion strings I don't want! ~
  2706. If this happens when Vim automatically wraps text then it's a Vim bug that has
  2707. been fixed in version 8.0.0127. Update your Vim to this version or later.
  2708. This could also be some mappings that interfere with YCM's internal ones. Make
  2709. sure you don't have something mapped to '<C-p>', '<C-x>' or '<C-u>' (in insert
  2710. mode).
  2711. YCM _never_ selects something for you; it just shows you a menu and the user
  2712. has to explicitly select something. If something is being selected
  2713. automatically, this means there's a bug or a misconfiguration somewhere.
  2714. -------------------------------------------------------------------------------
  2715. *youcompleteme-i-get-e227-mapping-already-exists-for-blah-error-when-i-start-vim*
  2716. I get a 'E227: mapping already exists for <blah>' error when I start Vim ~
  2717. This means that YCM tried to set up a key mapping but failed because you
  2718. already had something mapped to that key combination. The '<blah>' part of the
  2719. message will tell you what was the key combination that failed.
  2720. Look in the _Options_ section and see if any of the default mappings conflict
  2721. with your own. Then change that option value to something else so that the
  2722. conflict goes away.
  2723. -------------------------------------------------------------------------------
  2724. *youcompleteme-i-get-glibc_2.xx-not-found-when-starting-vim*
  2725. I get "'GLIBC_2.XX' not found (required by libclang.so)" when starting Vim ~
  2726. Your system is too old for the precompiled binaries from llvm.org. Compile
  2727. Clang on your machine and then link against the 'libclang.so' you just
  2728. produced. See the full installation guide for help.
  2729. -------------------------------------------------------------------------------
  2730. *youcompleteme-i-get-long_bit-definition-appears-wrong-for-platform-when-compiling*
  2731. I get 'LONG_BIT definition appears wrong for platform' when compiling ~
  2732. Look at the output of your CMake call. There should be a line in it like the
  2733. following (with '.dylib' in place of '.so' on macOS):
  2734. >
  2735. -- Found PythonLibs: /usr/lib/libpython2.7.so (Required is at least version "2.5")
  2736. <
  2737. That would be the **correct** output. An example of **incorrect** output would
  2738. be the following:
  2739. >
  2740. -- Found PythonLibs: /usr/lib/libpython2.7.so (found suitable version "2.5.1", minimum required is "2.5")
  2741. <
  2742. Notice how there's an extra bit of output there, the 'found suitable version
  2743. "<version>"' part, where '<version>' is not the same as the version of the
  2744. dynamic library. In the example shown, the library is version 2.7 but the
  2745. second string is version '2.5.1'.
  2746. This means that CMake found one version of Python headers and a different
  2747. version for the library. This is wrong. It can happen when you have multiple
  2748. versions of Python installed on your machine.
  2749. You should probably add the following flags to your cmake call (again, 'dylib'
  2750. instead of 'so' on macOS):
  2751. >
  2752. -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so
  2753. <
  2754. This will force the paths to the Python include directory and the Python
  2755. library to use. You may need to set these flags to something else, but you need
  2756. to make sure you use the same version of Python that your Vim binary is built
  2757. against, which is highly likely to be the system's default Python.
  2758. -------------------------------------------------------------------------------
  2759. *youcompleteme-i-get-libpython2.7.a-...-relocation-r_x86_64_32-when-compiling*
  2760. I get 'libpython2.7.a [...] relocation R_X86_64_32' when compiling ~
  2761. The error is usually encountered when compiling YCM on Centos or RHEL. The full
  2762. error looks something like the following:
  2763. >
  2764. /usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
  2765. <
  2766. It's possible to get a slightly different error that's similar to the one
  2767. above. Here's the problem and how you solve it:
  2768. Your 'libpython2.7.a' was not compiled with '-fPIC' so it can't be linked into
  2769. 'ycm_core.so'. Use the '-DPYTHON_LIBRARY=' CMake flag to point it to a '.so'
  2770. version of libpython on your machine (for instance,
  2771. '-DPYTHON_LIBRARY=/usr/lib/libpython2.7.so'). Naturally, this means you'll have
  2772. to go through the full installation guide by hand.
  2773. -------------------------------------------------------------------------------
  2774. *youcompleteme-i-see-undefined-symbol-clang_getcompletionfixit-in-server-logs.*
  2775. I see 'undefined symbol: clang_getCompletionFixIt' in the server logs. ~
  2776. This means that the server is trying to load a version of libclang that is too
  2777. old. You need at least libclang 8.0.0. We recommend running the 'install.py'
  2778. script without '--system-libclang' or downloading the latest prebuilt binaries
  2779. from llvm.org [37] when going through the full installation guide.
  2780. -------------------------------------------------------------------------------
  2781. *youcompleteme-i-get-fatal-python-error-pythreadstate_get-no-current-thread-on-startup*
  2782. I get 'Fatal Python error: PyThreadState_Get: no current thread' on startup ~
  2783. This is caused by linking a static version of 'libpython' into ycmd's
  2784. 'ycm_core.so'. This leads to multiple copies of the python interpreter loaded
  2785. when 'python' loads 'ycmd_core.so' and this messes up python's global state.
  2786. The details aren't important.
  2787. The solution is that the version of Python linked and run against must be built
  2788. with either '--enable-shared' or '--enable-framework' (on OS X). This is
  2789. achieved as follows (**NOTE:** for macOS, replace '--enable-shared' with
  2790. '--enable-framework'):
  2791. - When building python from source: './configure --enable-shared {options}'
  2792. - When building python from pyenv: 'PYTHON_CONFIGURE_OPTS="--enable-shared"
  2793. pyenv install {version}'
  2794. -------------------------------------------------------------------------------
  2795. *youcompleteme-install.py-says-python-must-be-compiled-with-enable-framework-.-wat*
  2796. 'install.py' says python must be compiled with '--enable-framework'. Wat? ~
  2797. See the previous answer for how to ensure your python is built to support
  2798. dynamic modules.
  2799. -------------------------------------------------------------------------------
  2800. *youcompleteme-ycm-does-not-read-identifiers-from-my-tags-files*
  2801. YCM does not read identifiers from my tags files ~
  2802. First, put 'let g:ycm_collect_identifiers_from_tags_files = 1' in your vimrc.
  2803. Make sure you are using Exuberant Ctags [72] to produce your tags files since
  2804. the only supported tag format is the Exuberant Ctags format [71]. The format
  2805. from "plain" ctags is NOT supported. The output of 'ctags --version' should
  2806. list "Exuberant Ctags". See Universal Ctags [73] for a maintained version.
  2807. Ctags needs to be called with the '--fields=+l' (that's a lowercase 'L', not a
  2808. one) option because YCM needs the 'language:<lang>' field in the tags output.
  2809. **NOTE:** Exuberant Ctags [72] by default sets language tag for '*.h' files as
  2810. 'C++'. If you have C (not C++) project, consider giving parameter
  2811. '--langmap=c:.c.h' to ctags to see tags from '*.h' files.
  2812. **NOTE:** macOS comes with "plain" ctags installed by default. 'brew install
  2813. ctags' will get you the Exuberant Ctags version.
  2814. Also make sure that your Vim 'tags' option is set correctly. See ":h 'tags'"
  2815. for details. If you want to see which tag files YCM will read for a given
  2816. buffer, run ':echo tagfiles()' with the relevant buffer active. Note that that
  2817. function will only list tag files that already exist.
  2818. -------------------------------------------------------------------------------
  2819. *youcompleteme-ctrl-u-in-insert-mode-does-not-work-while-completion-menu-is-visible*
  2820. 'CTRL-U' in insert mode does not work while the completion menu is visible ~
  2821. YCM uses 'completefunc' completion mode to show suggestions and Vim disables
  2822. '<C-U>' in that mode as a "feature." Sadly there's nothing I can do about this.
  2823. -------------------------------------------------------------------------------
  2824. *youcompleteme-my-ctrl-r-mapping-does-not-work-while-completion-menu-is-visible*
  2825. My 'CTRL-R' mapping does not work while the completion menu is visible ~
  2826. Vim prevents remapping of the '<C-R>' key in all '<C-X>' completion modes
  2827. (except the '<C-X><C-N>'/'<C-X><C-P>' mode which operates in the same mode as
  2828. '<C-N>'/'<C-P>') and YCM uses the '<C-X><C-U>' ('completefunc') mode for
  2829. completions. This means that adding '<C-R>' to any of the 'g:ycm_key_list_*'
  2830. options has no effect. You need to use another key.
  2831. -------------------------------------------------------------------------------
  2832. *youcompleteme-ycm-conflicts-with-ultisnips-tab-key-usage*
  2833. YCM conflicts with UltiSnips TAB key usage ~
  2834. YCM comes with support for UltiSnips (snippet suggestions in the popup menu),
  2835. but you'll have to change the UltiSnips mappings. See ':h UltiSnips-triggers'
  2836. in Vim for details. You'll probably want to change some/all of the following
  2837. options:
  2838. >
  2839. g:UltiSnipsExpandTrigger
  2840. g:UltiSnipsJumpForwardTrigger
  2841. g:UltiSnipsJumpBackwardTrigger
  2842. <
  2843. -------------------------------------------------------------------------------
  2844. *youcompleteme-snippets-added-with-ultisnipsaddfiletypes-do-not-appear-in-popup-menu*
  2845. Snippets added with ':UltiSnipsAddFiletypes' do not appear in the popup menu ~
  2846. For efficiency, YCM only fetches UltiSnips snippets in specific scenarios like
  2847. visiting a buffer or setting its filetype. You can force YCM to retrieve them
  2848. by manually triggering the 'FileType' autocommand:
  2849. >
  2850. :doautocmd FileType
  2851. <
  2852. -------------------------------------------------------------------------------
  2853. *youcompleteme-why-isnt-ycm-just-written-in-plain-vimscript-ffs*
  2854. Why isn't YCM just written in plain VimScript, FFS? ~
  2855. Because of the identifier completion engine and subsequence-based filtering.
  2856. Let's say you have _many_ dozens of files open in a single Vim instance (I
  2857. often do); the identifier-based engine then needs to store thousands (if not
  2858. tens of thousands) of identifiers in its internal data-structures. When the
  2859. user types, YCM needs to perform subsequence-based filtering on _all_ of those
  2860. identifiers (every single one!) in less than 10 milliseconds.
  2861. I'm sorry, but that level of performance is just plain impossible to achieve
  2862. with VimScript. I've tried, and the language is just too slow. No, you can't
  2863. get acceptable performance even if you limit yourself to just the identifiers
  2864. in the current file and simple prefix-based filtering.
  2865. -------------------------------------------------------------------------------
  2866. *youcompleteme-why-does-ycm-demand-such-recent-version-of-vim*
  2867. Why does YCM demand such a recent version of Vim? ~
  2868. YCM needs a version of Vim with the timers feature to achieve full
  2869. asynchronicity. This feature is available since Vim 7.4.1578.
  2870. -------------------------------------------------------------------------------
  2871. *youcompleteme-nasty-bugs-happen-if-i-have-vim-autoclose-plugin-installed*
  2872. Nasty bugs happen if I have the 'vim-autoclose' plugin installed ~
  2873. Use the delimitMate [74] plugin instead. It does the same thing without
  2874. conflicting with YCM.
  2875. -------------------------------------------------------------------------------
  2876. *youcompleteme-is-there-sort-of-ycm-mailing-list-i-have-questions*
  2877. Is there some sort of YCM mailing list? I have questions ~
  2878. If you have questions about the plugin or need help, please use the ycm-users
  2879. [75] mailing list, _don't_ create issues on the tracker. The tracker is for bug
  2880. reports and feature requests.
  2881. -------------------------------------------------------------------------------
  2882. *youcompleteme-i-get-an-internal-compiler-error-when-installing*
  2883. I get an internal compiler error when installing ~
  2884. This can be a problem on virtual servers with limited memory. A possible
  2885. solution is to add more swap memory. A more practical solution would be to
  2886. force the build script to run only one compile job at a time. You can do this
  2887. by setting the 'YCM_CORES' environment variable to '1'. Example:
  2888. >
  2889. YCM_CORES=1 ./install.py --clang-completer
  2890. <
  2891. -------------------------------------------------------------------------------
  2892. *youcompleteme-i-get-weird-errors-when-i-press-ctrl-c-in-vim*
  2893. I get weird errors when I press 'Ctrl-C' in Vim ~
  2894. _Never_ use 'Ctrl-C' in Vim.
  2895. Using 'Ctrl-C' to exit insert mode in Vim is a bad idea. The main issue here is
  2896. that 'Ctrl-C' in Vim doesn't just leave insert mode, it leaves it without
  2897. triggering 'InsertLeave' autocommands (as per Vim docs). This is a bad idea and
  2898. is likely to break many other things and not just YCM.
  2899. Bottom line, if you use 'Ctrl-C' to exit insert mode in Vim, you're gonna have
  2900. a bad time.
  2901. If pressing '<esc>' is too annoying (agreed, it is), we suggest mapping it to
  2902. something more convenient. On a QWERTY keyboard, a good pick for the '<esc>'
  2903. map is 'inoremap jk <Esc>'. This is right on the home row, it's an incredibly
  2904. rare digraph in English and if you ever need to type those two chars in
  2905. sequence in insert mode, you just type 'j', then wait 500ms, then type 'k'.
  2906. -------------------------------------------------------------------------------
  2907. *youcompleteme-why-did-ycm-stop-using-syntastic-for-diagnostics-display*
  2908. Why did YCM stop using Syntastic for diagnostics display? ~
  2909. Previously, YCM would send any diagnostics it would receive from the libclang
  2910. semantic engine to Syntastic for display as signs in the gutter, red squiggles
  2911. etc. Today, YCM uses its own code to do that.
  2912. Using Syntastic for this was always a kludge. Syntastic assumes its "checker"
  2913. plugins behave in a certain way; those assumptions have never fit YCM. For
  2914. instance, YCM continuously recompiles your code in the background for C-family
  2915. languages and tries to push new diagnostics to the user as fast as possible,
  2916. even while the user types.
  2917. Syntastic assumes that a checker only runs on file save ("active" mode) or even
  2918. less frequently, when the user explicitly invokes it ("passive" mode). This
  2919. mismatch in assumptions causes performance problems since Syntastic code isn't
  2920. optimized for this use case of constant diagnostic refreshing.
  2921. Poor support for this use case also led to crash bugs in Vim caused by
  2922. Syntastic-Vim interactions (issue #593 [76]) and other problems, like random
  2923. Vim flickering. Attempts were made to resolve these issues in Syntastic, but
  2924. ultimately some of them failed (for various reasons).
  2925. Implementing diagnostic display code directly in YCM resolves all of these
  2926. problems. Performance also improved substantially since the relevant code is
  2927. now written in Python instead of VimScript (which is very slow) and is tailored
  2928. only for YCM's use-cases. We were also able to introduce new features in this
  2929. area since we're now not limited to the Syntastic checker API.
  2930. We've tried to implement this in the most backwards-compatible way possible;
  2931. YCM options that control diagnostic display fall back to Syntastic options that
  2932. control the same concepts if the user has those set.
  2933. Still, some Syntastic-specific configuration you might have had might not be
  2934. supported by the new code. Please file issues on the tracker in such cases; if
  2935. we find the request to be reasonable, we'll find a way to address it.
  2936. -------------------------------------------------------------------------------
  2937. *youcompleteme-completion-doesnt-work-with-c-standard-library-headers*
  2938. Completion doesn't work with the C++ standard library headers ~
  2939. This is caused by an issue with libclang that only affects some operating
  2940. systems. Compiling with 'clang' the binary will use the correct default header
  2941. search paths but compiling with 'libclang.so' (which YCM uses) does not.
  2942. macOS is normally affected, but there's a workaround in YCM for that specific
  2943. OS. If you're not running that OS but still have the same problem, continue
  2944. reading.
  2945. The workaround is to call 'echo | clang -v -E -x c++ -' and look at the paths
  2946. under the '#include <...> search starts here:' heading. You should take those
  2947. paths, prepend '-isystem' to each individual path and append them all to the
  2948. list of flags you return from your 'Settings' function in your
  2949. '.ycm_extra_conf.py' file.
  2950. See issue #303 [77] for details.
  2951. -------------------------------------------------------------------------------
  2952. *youcompleteme-when-i-start-vim-i-get-runtime-error-saying-r6034-an-application-has-made-an-attempt-to-load-c-runtime-library-incorrectly.*
  2953. When I start vim I get a runtime error saying 'R6034 An application has made ~
  2954. an attempt to load the C runtime library incorrectly.' ~
  2955. CMake and other things seem to screw up the PATH with their own msvcrXX.dll
  2956. versions. [78] Add the following to the very top of your vimrc to remove these
  2957. entries from the path.
  2958. >
  2959. python << EOF
  2960. import os
  2961. import re
  2962. path = os.environ['PATH'].split(';')
  2963. def contains_msvcr_lib(folder):
  2964. try:
  2965. for item in os.listdir(folder):
  2966. if re.match(r'msvcr\d+\.dll', item):
  2967. return True
  2968. except:
  2969. pass
  2970. return False
  2971. path = [folder for folder in path if not contains_msvcr_lib(folder)]
  2972. os.environ['PATH'] = ';'.join(path)
  2973. EOF
  2974. <
  2975. -------------------------------------------------------------------------------
  2976. *youcompleteme-i-hear-that-ycm-only-supports-python-2-is-that-true*
  2977. I hear that YCM only supports Python 2, is that true? ~
  2978. **No.** Both the Vim client and the ycmd server [43] run on Python 2 or 3. If
  2979. you are talking about code completion in a project, you can configure the
  2980. Python used for your project through a '.ycm_extra_conf.py' file. See the
  2981. Python Semantic Completion section for more details.
  2982. -------------------------------------------------------------------------------
  2983. *youcompleteme-on-windows-i-get-e887-sorry-this-command-is-disabled-pythons-site-module-could-not-be-loaded*
  2984. On Windows I get "E887: Sorry, this command is disabled, the Python's site ~
  2985. module could not be loaded" ~
  2986. If you are running vim on Windows with Python 2.7.11, this is likely caused by
  2987. a bug [79]. Follow this workaround [80] or use a different version (Python
  2988. 2.7.12 does not suffer from the bug).
  2989. -------------------------------------------------------------------------------
  2990. *youcompleteme-i-cant-complete-python-packages-in-virtual-environment.*
  2991. I can't complete Python packages in a virtual environment. ~
  2992. This means that the Python used to run Jedi [9] is not the Python of the
  2993. virtual environment you're in. To resolve this you should create a
  2994. '.ycm_extra_conf.py' file at the root of your project that sets the
  2995. 'interpreter_path' option to the Python of your virtual environment, e.g.
  2996. >
  2997. def Settings(**kwargs):
  2998. return {
  2999. 'interpreter_path': '/path/to/virtual/env/bin/python'
  3000. }
  3001. <
  3002. See the Python Semantic Completion section for more details.
  3003. -------------------------------------------------------------------------------
  3004. *i-want-to-defer-loading-of-youcompleteme-until-after-vim-finishes-booting*
  3005. I want to defer loading of YouCompleteMe until after Vim finishes booting ~
  3006. In recent versions of Vim, you can install YCM in a folder under
  3007. '~/.vim/pack/*/opt' and then load it once the user is idle via an autocommand:
  3008. >
  3009. augroup load_ycm
  3010. autocmd!
  3011. autocmd CursorHold, CursorHoldI * :packadd YouCompleteMe
  3012. \ | autocmd! load_ycm
  3013. augroup END
  3014. <
  3015. -------------------------------------------------------------------------------
  3016. *youcompleteme-ycm-does-not-shut-down-when-i-quit-vim*
  3017. YCM does not shut down when I quit Vim ~
  3018. YCM relies on the 'VimLeave' event to shut down the ycmd server [43]. Some
  3019. plugins prevent this event from triggering by exiting Vim through an
  3020. autocommand without using the 'nested' keyword (see ':h autocmd-nested'). You
  3021. should identify which plugin is responsible for the issue and report it to the
  3022. plugin author. Note that when this happens, ycmd [43] will automatically shut
  3023. itself down after 30 minutes.
  3024. -------------------------------------------------------------------------------
  3025. *youcompleteme-ycm-does-not-work-with-my-anaconda-python-setup*
  3026. YCM does not work with my Anaconda Python setup ~
  3027. Anaconda is often incompatible with the pre-built libclang used by YCM and
  3028. therefore is not supported. The recommended way to solve this is to run
  3029. '/path/to/real/python install.py' (for example '/usr/bin/python install.py').
  3030. If you want completion in Anaconda projects, point the 'interpreter_path'
  3031. option in your '.ycm_extra_conf.py' file to the path of your Anaconda Python
  3032. e.g.
  3033. >
  3034. def Settings(**kwargs):
  3035. return {
  3036. 'interpreter_path': '/path/to/anaconda/python'
  3037. }
  3038. <
  3039. See the Python Semantic Completion section for more details.
  3040. -------------------------------------------------------------------------------
  3041. *youcompleteme-automatic-import-insertion-after-selecting-completion-breaks-undo*
  3042. Automatic import insertion after selecting a completion breaks undo ~
  3043. This is a Vim bug fixed in version 8.1.0256. Update your Vim to this version or
  3044. later.
  3045. -------------------------------------------------------------------------------
  3046. *youcompleteme-tab-is-already-mapped-to-trigger-completion-in-command-line-window*
  3047. 'TAB' is already mapped to trigger completion in the command-line window ~
  3048. Vim automatically maps the key set by the 'wildchar' option, which is 'TAB' by
  3049. default, to complete commands in the command-line window. If you would prefer
  3050. using this key to cycle through YCM's suggestions without changing the value of
  3051. 'wildchar', add the following to your vimrc:
  3052. >
  3053. autocmd CmdwinEnter * inoremap <expr><buffer> <TAB>
  3054. \ pumvisible() ? "\<C-n>" : "\<TAB>"
  3055. <
  3056. ===============================================================================
  3057. *youcompleteme-contributor-code-of-conduct*
  3058. Contributor Code of Conduct ~
  3059. Please note that this project is released with a Contributor Code of Conduct
  3060. [81]. By participating in this project you agree to abide by its terms.
  3061. ===============================================================================
  3062. *youcompleteme-contact*
  3063. Contact ~
  3064. If you have questions about the plugin or need help, please join the Gitter
  3065. room [1] or use the ycm-users [75] mailing list.
  3066. If you have bug reports or feature suggestions, please use the issue tracker
  3067. [82]. Before you do, please carefully read CONTRIBUTING.md [58] as this asks
  3068. for important diagnostics which the team will use to help get you going.
  3069. The latest version of the plugin is available at
  3070. http://valloric.github.io/YouCompleteMe/.
  3071. The author's homepage is http://val.markovic.io.
  3072. Please do **NOT** go to #vim on freenode for support. Please contact the
  3073. YouCompleteMe maintainers directly using the contact details.
  3074. ===============================================================================
  3075. *youcompleteme-license*
  3076. License ~
  3077. This software is licensed under the GPL v3 license [83]. © 2015-2018
  3078. YouCompleteMe contributors
  3079. ===============================================================================
  3080. *youcompleteme-references*
  3081. References ~
  3082. [1] https://gitter.im/Valloric/YouCompleteMe
  3083. [2] https://img.shields.io/gitter/room/Valloric/YouCompleteMe.svg
  3084. [3] https://dev.azure.com/YouCompleteMe/YCM/_build/latest?definitionId=1&branchName=master
  3085. [4] https://dev.azure.com/YouCompleteMe/YCM/_apis/build/status/Valloric.YouCompleteMe?branchName=master
  3086. [5] https://codecov.io/gh/Valloric/YouCompleteMe
  3087. [6] https://img.shields.io/codecov/c/github/Valloric/YouCompleteMe/master.svg
  3088. [7] http://clang.llvm.org/
  3089. [8] https://clang.llvm.org/extra/clangd.html
  3090. [9] https://github.com/davidhalter/jedi
  3091. [10] https://github.com/OmniSharp/omnisharp-server
  3092. [11] https://github.com/nsf/gocode
  3093. [12] https://github.com/Manishearth/godef
  3094. [13] https://github.com/Microsoft/TypeScript/tree/master/src/server
  3095. [14] https://github.com/phildawes/racer
  3096. [15] https://github.com/eclipse/eclipse.jdt.ls
  3097. [16] http://i.imgur.com/0OP4ood.gif
  3098. [17] https://en.wikipedia.org/wiki/Subsequence
  3099. [18] https://github.com/scrooloose/syntastic
  3100. [19] https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt
  3101. [20] https://macvim-dev.github.io/macvim/
  3102. [21] http://brew.sh
  3103. [22] http://www.mono-project.com/docs/getting-started/install/mac/
  3104. [23] https://golang.org/doc/install
  3105. [24] https://docs.npmjs.com/getting-started/installing-node#1-install-nodejs--npm
  3106. [25] https://www.rust-lang.org/
  3107. [26] http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  3108. [27] https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source
  3109. [28] https://github.com/VundleVim/Vundle.vim#about
  3110. [29] https://www.mono-project.com/download/stable/#download-lin
  3111. [30] https://github.com/vim/vim-win32-installer/releases
  3112. [31] http://vimhelp.appspot.com/starting.txt.html#vimrc
  3113. [32] https://www.python.org/downloads/windows/
  3114. [33] https://cmake.org/download/
  3115. [34] https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15
  3116. [35] http://stackoverflow.com/questions/6319274/how-do-i-run-msbuild-from-the-command-line-using-windows-sdk-7-1
  3117. [36] https://github.com/tpope/vim-pathogen#pathogenvim
  3118. [37] http://llvm.org/releases/download.html
  3119. [38] http://www.7-zip.org/download.html
  3120. [39] https://pypi.org/project/regex/
  3121. [40] http://www.mono-project.com/docs/getting-started/install/
  3122. [41] http://download.eclipse.org/jdtls/milestones
  3123. [42] https://www.unicode.org/glossary/#diacritic
  3124. [43] https://github.com/Valloric/ycmd
  3125. [44] http://clang.llvm.org/docs/JSONCompilationDatabase.html
  3126. [45] https://ninja-build.org/manual.html
  3127. [46] https://github.com/rizsotto/Bear
  3128. [47] https://clang.llvm.org/docs/JSONCompilationDatabase.html#alternatives
  3129. [48] https://raw.githubusercontent.com/Valloric/ycmd/66030cd94299114ae316796f3cad181cac8a007c/.ycm_extra_conf.py
  3130. [49] https://github.com/rdnetto/YCM-Generator
  3131. [50] https://clang.llvm.org/extra/clangd.html#project-wide-indexing
  3132. [51] https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fproject_description_file.html
  3133. [52] https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
  3134. [53] https://docs.gradle.org/current/userguide/tutorial_java_projects.html
  3135. [54] https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FIClasspathEntry.html
  3136. [55] https://github.com/Valloric/ycmd/tree/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_eclipse_project
  3137. [56] https://github.com/Valloric/ycmd/blob/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_maven_project/pom.xml
  3138. [57] https://github.com/Valloric/ycmd/tree/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_gradle_project
  3139. [58] https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
  3140. [59] https://github.com/Valloric/YouCompleteMe/blob/master/.ycm_extra_conf.py
  3141. [60] https://www.rust-lang.org/downloads.html
  3142. [61] https://www.rustup.rs/
  3143. [62] http://ternjs.net
  3144. [63] https://github.com/Valloric/YouCompleteMe/wiki/JavaScript-Semantic-Completion-through-Tern
  3145. [64] https://code.visualstudio.com/docs/languages/jsconfig
  3146. [65] https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
  3147. [66] http://eclim.org/
  3148. [67] https://github.com/Valloric/ycmd/blob/master/ycmd/completers/completer.py
  3149. [68] https://github.com/Valloric/ListToggle
  3150. [69] https://github.com/itchyny/lightline.vim
  3151. [70] https://docs.python.org/2/library/re.html#regular-expression-syntax
  3152. [71] http://ctags.sourceforge.net/FORMAT
  3153. [72] http://ctags.sourceforge.net/
  3154. [73] https://github.com/universal-ctags/ctags
  3155. [74] https://github.com/Raimondi/delimitMate
  3156. [75] https://groups.google.com/forum/?hl=en#!forum/ycm-users
  3157. [76] https://github.com/Valloric/YouCompleteMe/issues/593
  3158. [77] https://github.com/Valloric/YouCompleteMe/issues/303
  3159. [78] http://stackoverflow.com/questions/14552348/runtime-error-r6034-in-embedded-python-application/34696022
  3160. [79] https://github.com/vim/vim/issues/717
  3161. [80] https://github.com/vim/vim-win32-installer/blob/a27bbdba9bb87fa0e44c8a00d33d46be936822dd/appveyor.bat#L86-L88
  3162. [81] https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md
  3163. [82] https://github.com/Valloric/YouCompleteMe/issues?state=open
  3164. [83] http://www.gnu.org/copyleft/gpl.html
  3165. vim: ft=help