youcompleteme.txt 151 KB

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