youcompleteme.txt 175 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184
  1. *youcompleteme* YouCompleteMe: a code-completion engine for Vim
  2. ===============================================================================
  3. Contents ~
  4. 1. Introduction |youcompleteme-introduction|
  5. 1. Help, Advice, Support |youcompleteme-help-advice-support|
  6. 2. Vundle |youcompleteme-vundle|
  7. 1. Contents |youcompleteme-contents|
  8. 2. Intro |youcompleteme-intro|
  9. 3. Installation |youcompleteme-installation|
  10. 1. Requirements |youcompleteme-requirements|
  11. 1. Supported Vim Versions |youcompleteme-supported-vim-versions|
  12. 2. Supported Python runtime |youcompleteme-supported-python-runtime|
  13. 3. Supported Compilers |youcompleteme-supported-compilers|
  14. 4. Individual completer requirements |youcompleteme-individual-completer-requirements|
  15. 2. macOS |youcompleteme-macos|
  16. 1. Quick start, installing all completers |youcompleteme-quick-start-installing-all-completers|
  17. 2. Explanation for the quick start |youcompleteme-explanation-for-quick-start|
  18. 3. Linux 64-bit |youcompleteme-linux-64-bit|
  19. 1. Quick start, installing all completers
  20. 2. Explanation for the quick start
  21. 4. Windows |youcompleteme-windows|
  22. 1. Quick start, installing all completers
  23. 2. Explanation for the quick start
  24. 5. Full Installation Guide |youcompleteme-full-installation-guide|
  25. 4. Quick Feature Summary |youcompleteme-quick-feature-summary|
  26. 1. General (all languages) |youcompleteme-general|
  27. 2. C-family languages (C, C++, Objective C, Objective C++, CUDA) |youcompleteme-c-family-languages|
  28. 3. C♯ |youcompleteme-c|
  29. 4. Python |youcompleteme-python|
  30. 5. Go |youcompleteme-go|
  31. 6. JavaScript and TypeScript |youcompleteme-javascript-typescript|
  32. 7. Rust |youcompleteme-rust|
  33. 8. Java |youcompleteme-java|
  34. 5. User Guide |youcompleteme-user-guide|
  35. 1. General Usage |youcompleteme-general-usage|
  36. 2. Client-Server Architecture |youcompleteme-client-server-architecture|
  37. 3. Completion String Ranking |youcompleteme-completion-string-ranking|
  38. 4. Signature Help |youcompleteme-signature-help|
  39. 1. Dismiss signature help |youcompleteme-dismiss-signature-help|
  40. 5. Semantic highlighting |youcompleteme-semantic-highlighting|
  41. 1. Customising the highlight groups |youcompleteme-customising-highlight-groups|
  42. 6. Inlay hints |youcompleteme-inlay-hints|
  43. 1. Highlight groups |youcompleteme-highlight-groups|
  44. 2. Options |youcompleteme-options|
  45. 3. Toggling |youcompleteme-toggling|
  46. 4. General Semantic Completion |youcompleteme-general-semantic-completion|
  47. 5. C-family Semantic Completion |youcompleteme-c-family-semantic-completion|
  48. 1. Installation
  49. 2. Compile flags |youcompleteme-compile-flags|
  50. 3. Option 1: Use a compilation database [53] |youcompleteme-option-1-use-compilation-database-53|
  51. 4. Option 2: Provide the flags manually |youcompleteme-option-2-provide-flags-manually|
  52. 5. Errors during compilation |youcompleteme-errors-during-compilation|
  53. 6. Java Semantic Completion |youcompleteme-java-semantic-completion|
  54. 1. Java quick Start |youcompleteme-java-quick-start|
  55. 2. Java Project Files |youcompleteme-java-project-files|
  56. 3. Diagnostic display - Syntastic |youcompleteme-diagnostic-display-syntastic|
  57. 4. Diagnostic display - Eclim |youcompleteme-diagnostic-display-eclim|
  58. 5. Eclipse Projects |youcompleteme-eclipse-projects|
  59. 6. Maven Projects |youcompleteme-maven-projects|
  60. 7. Gradle Projects |youcompleteme-gradle-projects|
  61. 8. Troubleshooting |youcompleteme-troubleshooting|
  62. 7. C# Semantic Completion |youcompleteme-c-semantic-completion|
  63. 1. Automatically discovered solution files |youcompleteme-automatically-discovered-solution-files|
  64. 2. Manually specified solution files |youcompleteme-manually-specified-solution-files|
  65. 8. Python Semantic Completion |youcompleteme-python-semantic-completion|
  66. 1. Working with virtual environments |youcompleteme-working-with-virtual-environments|
  67. 2. Working with third-party packages |youcompleteme-working-with-third-party-packages|
  68. 3. Configuring through Vim options |youcompleteme-configuring-through-vim-options|
  69. 9. Rust Semantic Completion |youcompleteme-rust-semantic-completion|
  70. 10. Go Semantic Completion |youcompleteme-go-semantic-completion|
  71. 11. JavaScript and TypeScript Semantic Completion |youcompleteme-javascript-typescript-semantic-completion|
  72. 12. Semantic Completion for Other Languages |youcompleteme-semantic-completion-for-other-languages|
  73. 1. Plugging an arbitrary LSP server |youcompleteme-plugging-an-arbitrary-lsp-server|
  74. 2. LSP Configuration |youcompleteme-lsp-configuration|
  75. 3. Using 'omnifunc' for semantic completion |youcompleteme-using-omnifunc-for-semantic-completion|
  76. 13. Writing New Semantic Completers |youcompleteme-writing-new-semantic-completers|
  77. 14. Diagnostic Display |youcompleteme-diagnostic-display|
  78. 1. Diagnostic Highlighting Groups |youcompleteme-diagnostic-highlighting-groups|
  79. 15. Symbol Search |youcompleteme-symbol-search|
  80. 1. Closing the popup |youcompleteme-closing-popup|
  81. 7. Commands |youcompleteme-commands|
  82. 1. The |:YcmRestartServer| command
  83. 2. The |:YcmForceCompileAndDiagnostics| command
  84. 3. The |:YcmDiags| command
  85. 4. The |:YcmShowDetailedDiagnostic| command
  86. 5. The |:YcmDebugInfo| command
  87. 6. The |:YcmToggleLogs| command
  88. 7. The |:YcmCompleter| command
  89. 8. YcmCompleter Subcommands |youcompleteme-ycmcompleter-subcommands|
  90. 1. GoTo Commands |youcompleteme-goto-commands|
  91. 1. The |GoToInclude| subcommand
  92. 2. The |GoToAlternateFile| subcommand
  93. 3. The |GoToDeclaration| subcommand
  94. 4. The |GoToDefinition| subcommand
  95. 5. The |GoTo| subcommand
  96. 6. The |GoToImprecise| subcommand
  97. 7. The 'GoToSymbol <symbol query>' subcommand |GoToSymbol-symbol-query|
  98. 8. The |GoToReferences| subcommand
  99. 9. The |GoToImplementation| subcommand
  100. 10. The |GoToImplementationElseDeclaration| subcommand
  101. 11. The |GoToType| subcommand
  102. 12. The |GoToDocumentOutline| subcommand
  103. 13. The |GoToCallers| and 'GoToCallees' subcommands
  104. 2. Semantic Information Commands |youcompleteme-semantic-information-commands|
  105. 1. The |GetType| subcommand
  106. 2. The |GetTypeImprecise| subcommand
  107. 3. The |GetParent| subcommand
  108. 4. The |GetDoc| subcommand
  109. 5. The |GetDocImprecise| subcommand
  110. 3. Refactoring Commands |youcompleteme-refactoring-commands|
  111. 1. The |FixIt| subcommand
  112. 2. The 'RefactorRename <new name>' subcommand |RefactorRename-new-name|
  113. 3. Python refactorings |youcompleteme-python-refactorings|
  114. 4. Multi-file Refactor |youcompleteme-multi-file-refactor|
  115. 5. The |Format| subcommand
  116. 6. The |OrganizeImports| subcommand
  117. 4. Miscellaneous Commands |youcompleteme-miscellaneous-commands|
  118. 1. The 'ExecuteCommand <args>' subcommand |ExecuteCommand-args|
  119. 2. The |RestartServer| subcommand
  120. 3. The |ReloadSolution| subcommand
  121. 9. Functions |youcompleteme-functions|
  122. 1. The |youcompleteme#GetErrorCount| function
  123. 2. The |youcompleteme#GetWarningCount| function
  124. 3. The 'youcompleteme#GetCommandResponse( ... )' function |youcompleteme#GetCommandResponse()|
  125. 4. The 'youcompleteme#GetCommandResponseAsync( callback, ... )' function |youcompleteme#GetCommandResponseAsync()|
  126. 10. Autocommands |youcompleteme-autocommands|
  127. 1. The |YcmLocationOpened| autocommand
  128. 2. The |YcmQuickFixOpened| autocommand
  129. 11. Options
  130. 1. The |g:ycm_min_num_of_chars_for_completion| option
  131. 2. The |g:ycm_min_num_identifier_candidate_chars| option
  132. 3. The |g:ycm_max_num_candidates| option
  133. 4. The |g:ycm_max_num_candidates_to_detail| option
  134. 5. The |g:ycm_max_num_identifier_candidates| option
  135. 6. The |g:ycm_auto_trigger| option
  136. 7. The |g:ycm_filetype_whitelist| option
  137. 8. The |g:ycm_filetype_blacklist| option
  138. 9. The |g:ycm_filetype_specific_completion_to_disable| option
  139. 10. The |g:ycm_filepath_blacklist| option
  140. 11. The |g:ycm_show_diagnostics_ui| option
  141. 12. The |g:ycm_error_symbol| option
  142. 13. The |g:ycm_warning_symbol| option
  143. 14. The |g:ycm_enable_diagnostic_signs| option
  144. 15. The |g:ycm_enable_diagnostic_highlighting| option
  145. 16. The |g:ycm_echo_current_diagnostic| option
  146. 17. The |g:ycm_auto_hover| option
  147. 18. The |g:ycm_filter_diagnostics| option
  148. 19. The |g:ycm_always_populate_location_list| option
  149. 20. The |g:ycm_open_loclist_on_ycm_diags| option
  150. 21. The |g:ycm_complete_in_comments| option
  151. 22. The |g:ycm_complete_in_strings| option
  152. 23. The |g:ycm_collect_identifiers_from_comments_and_strings| option
  153. 24. The |g:ycm_collect_identifiers_from_tags_files| option
  154. 25. The |g:ycm_seed_identifiers_with_syntax| option
  155. 26. The |g:ycm_extra_conf_vim_data| option
  156. 27. The |g:ycm_server_python_interpreter| option
  157. 28. The |g:ycm_keep_logfiles| option
  158. 29. The |g:ycm_log_level| option
  159. 30. The |g:ycm_auto_start_csharp_server| option
  160. 31. The |g:ycm_auto_stop_csharp_server| option
  161. 32. The |g:ycm_csharp_server_port| option
  162. 33. The |g:ycm_csharp_insert_namespace_expr| option
  163. 34. The |g:ycm_add_preview_to_completeopt| option
  164. 35. The |g:ycm_autoclose_preview_window_after_completion| option
  165. 36. The |g:ycm_autoclose_preview_window_after_insertion| option
  166. 37. The |g:ycm_max_diagnostics_to_display| option
  167. 38. The |g:ycm_key_list_select_completion| option
  168. 39. The |g:ycm_key_list_previous_completion| option
  169. 40. The |g:ycm_key_list_stop_completion| option
  170. 41. The |g:ycm_key_invoke_completion| option
  171. 42. The |g:ycm_key_detailed_diagnostics| option
  172. 43. The |g:ycm_show_detailed_diag_in_popup| option
  173. 44. The |g:ycm_global_ycm_extra_conf| option
  174. 45. The |g:ycm_confirm_extra_conf| option
  175. 46. The |g:ycm_extra_conf_globlist| option
  176. 47. The |g:ycm_filepath_completion_use_working_dir| option
  177. 48. The |g:ycm_semantic_triggers| option
  178. 49. The |g:ycm_cache_omnifunc| option
  179. 50. The |g:ycm_use_ultisnips_completer| option
  180. 51. The |g:ycm_goto_buffer_command| option
  181. 52. The |g:ycm_disable_for_files_larger_than_kb| option
  182. 53. The |g:ycm_use_clangd| option
  183. 54. The |g:ycm_clangd_binary_path| option
  184. 55. The |g:ycm_clangd_args| option
  185. 56. The |g:ycm_clangd_uses_ycmd_caching| option
  186. 57. The |g:ycm_language_server| option
  187. 58. The |g:ycm_disable_signature_help| option
  188. 59. The |g:ycm_signature_help_disable_syntax| option
  189. 60. The |g:ycm_gopls_binary_path| option
  190. 61. The |g:ycm_gopls_args| option
  191. 62. The |g:ycm_rls_binary_path| and 'g:ycm_rustc_binary_path' options
  192. 63. The |g:ycm_rust_toolchain_root| option
  193. 64. The |g:ycm_tsserver_binary_path| option
  194. 65. The |g:ycm_roslyn_binary_path| option
  195. 66. The |g:ycm_update_diagnostics_in_insert_mode| option
  196. 12. FAQ |youcompleteme-faq|
  197. 13. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct|
  198. 14. Contact |youcompleteme-contact|
  199. 15. License |youcompleteme-license|
  200. 16. Sponsorship |youcompleteme-sponsorship|
  201. 3. References |youcompleteme-references|
  202. ===============================================================================
  203. *youcompleteme-introduction*
  204. Introduction ~
  205. Image: Gitter room [1] Image: Build status [3] Image: Coverage status [5]
  206. -------------------------------------------------------------------------------
  207. *youcompleteme-help-advice-support*
  208. Help, Advice, Support ~
  209. Looking for help, advice or support? Having problems getting YCM to work?
  210. First carefully read the installation instructions for your OS. We recommend
  211. you use the supplied 'install.py' - the "full" installation guide is for rare,
  212. advanced use cases and most users should use 'install.py'.
  213. If the server isn't starting and you're getting a "YouCompleteMe unavailable"
  214. error, check the Troubleshooting [7] guide.
  215. Next check the User Guide section on the semantic completer that you are using.
  216. For C/C++/Objective-C/Objective-C++/CUDA, you _must_ read this section.
  217. Finally, check the FAQ [8].
  218. If, after reading the installation and user guides, and checking the FAQ,
  219. you're still having trouble, check the contacts section below for how to get in
  220. touch.
  221. Please do **NOT** go to #vim on Freenode for support. Please contact the
  222. YouCompleteMe maintainers directly using the contact details below.
  223. ===============================================================================
  224. *youcompleteme-vundle*
  225. Vundle ~
  226. Please note that the below instructions suggest using Vundle. Currently there
  227. are problems with Vundle, so here are some alternative instructions [9] using
  228. Vim packages.
  229. -------------------------------------------------------------------------------
  230. *youcompleteme-contents*
  231. Contents ~
  232. - Intro
  233. - Installation
  234. - Requirements
  235. - macOS
  236. - Linux 64-bit
  237. - Windows
  238. - Full Installation Guide
  239. - Quick Feature Summary
  240. - User Guide
  241. - General Usage
  242. - Client-Server Architecture
  243. - Completion String Ranking
  244. - General Semantic Completion
  245. - Signature Help
  246. - Semantic Highlighting
  247. - Inlay Hints
  248. - C-family Semantic Completion
  249. - Java Semantic Completion
  250. - C# Semantic Completion
  251. - Python Semantic Completion
  252. - Rust Semantic Completion
  253. - Go Semantic Completion
  254. - JavaScript and TypeScript Semantic Completion
  255. - Semantic Completion for Other Languages
  256. - LSP Configuration
  257. - Writing New Semantic Completers
  258. - Diagnostic Display
  259. - Diagnostic Highlighting Groups
  260. - Symbol Search
  261. - Commands
  262. - YcmCompleter subcommands
  263. - GoTo Commands
  264. - Semantic Information Commands
  265. - Refactoring Commands
  266. - Miscellaneous Commands
  267. - Functions
  268. - Autocommands
  269. - Options
  270. - FAQ
  271. - Contributor Code of Conduct
  272. - Contact
  273. - License
  274. - Sponsorship
  275. -------------------------------------------------------------------------------
  276. *youcompleteme-intro*
  277. Intro ~
  278. YouCompleteMe is a fast, as-you-type, fuzzy-search code completion,
  279. comprehension and refactoring engine for Vim [10].
  280. It has several completion engines built in and supports any protocol-compliant
  281. Language Server, so can work with practically any language. YouCompleteMe
  282. contains:
  283. - an identifier-based engine that works with every programming language,
  284. - a powerful clangd [11]-based engine that provides native semantic code
  285. completion for C/C++/Objective-C/Objective-C++/CUDA (from now on referred
  286. to as "the C-family languages"),
  287. - a Jedi [12]-based completion engine for Python 2 and 3,
  288. - an OmniSharp-Roslyn [13]-based completion engine for C#,
  289. - a Gopls [14]-based completion engine for Go,
  290. - a TSServer [15]-based completion engine for JavaScript and TypeScript,
  291. - a rust-analyzer [16]-based completion engine for Rust,
  292. - a jdt.ls [17]-based completion engine for Java.
  293. - a generic Language Server Protocol implementation for any language
  294. - and an omnifunc-based completer that uses data from Vim's omnicomplete
  295. system to provide semantic completions for many other languages (Ruby, PHP
  296. etc.).
  297. Image: YouCompleteMe GIF completion demo (see reference [18])
  298. Here's an explanation of what happens in the last GIF demo above.
  299. First, realize that **no keyboard shortcuts had to be pressed** to get the list
  300. of completion candidates at any point in the demo. The user just types and the
  301. suggestions pop up by themselves. If the user doesn't find the completion
  302. suggestions relevant and/or just wants to type, they can do so; the completion
  303. engine will not interfere.
  304. When the user sees a useful completion string being offered, they press the TAB
  305. key to accept it. This inserts the completion string. Repeated presses of the
  306. TAB key cycle through the offered completions.
  307. If the offered completions are not relevant enough, the user can continue
  308. typing to further filter out unwanted completions.
  309. A critical thing to notice is that the completion **filtering is NOT based on
  310. the input being a string prefix of the completion** (but that works too). The
  311. input needs to be a _subsequence [19] match_ of a completion. This is a fancy
  312. way of saying that any input characters need to be present in a completion
  313. string in the order in which they appear in the input. So 'abc' is a
  314. subsequence of 'xaybgc', but not of 'xbyxaxxc'. After the filter, a complicated
  315. sorting system ranks the completion strings so that the most relevant ones rise
  316. to the top of the menu (so you usually need to press TAB just once).
  317. **All of the above works with any programming language** because of the
  318. identifier-based completion engine. It collects all of the identifiers in the
  319. current file and other files you visit (and your tags files) and searches them
  320. when you type (identifiers are put into per-filetype groups).
  321. The demo also shows the semantic engine in use. When the user presses '.', '->'
  322. or '::' while typing in insert mode (for C++; different triggers are used for
  323. other languages), the semantic engine is triggered (it can also be triggered
  324. with a keyboard shortcut; see the rest of the docs).
  325. The last thing that you can see in the demo is YCM's diagnostic display
  326. features (the little red X that shows up in the left gutter; inspired by
  327. Syntastic [20]) if you are editing a C-family file. As the completer engine
  328. compiles your file and detects warnings or errors, they will be presented in
  329. various ways. You don't need to save your file or press any keyboard shortcut
  330. to trigger this, it "just happens" in the background.
  331. **And that's not all...**
  332. YCM might be the only Vim completion engine with the correct Unicode support.
  333. Though we do assume UTF-8 everywhere.
  334. Image: YouCompleteMe GIF unicode demo (see reference [21])
  335. YCM also provides semantic IDE-like features in a number of languages,
  336. including:
  337. - displaying signature help (argument hints) when entering the arguments to a
  338. function call (Vim only)
  339. - finding declarations, definitions, usages, etc. of identifiers, and an
  340. interactive symbol finder
  341. - displaying type information for classes, variables, functions etc.,
  342. - displaying documentation for methods, members, etc. in the preview window,
  343. or in a popup next to the cursor (Vim only)
  344. - fixing common coding errors, like missing semi-colons, typos, etc.,
  345. - semantic renaming of variables across files,
  346. - formatting code,
  347. - removing unused imports, sorting imports, etc.
  348. For example, here's a demo of signature help:
  349. Image: Signature Help Early Demo (see reference [22])
  350. Below we can see YCM being able to do a few things:
  351. - Retrieve references across files
  352. - Go to declaration/definition
  353. - Expand 'auto' in C++
  354. - Fix some common errors, and provide refactorings, with |FixIt|
  355. - Not shown in the GIF is |GoToImplementation| and |GoToType| for servers
  356. that support it.
  357. Image: YouCompleteMe GIF subcommands demo (see reference [23])
  358. And here's some documentation being shown in a hover popup, automatically and
  359. manually:
  360. Image: hover demo (see reference [24])
  361. Features vary by file type, so make sure to check out the file type feature
  362. summary and the full list of completer subcommands to find out what's available
  363. for your favourite languages.
  364. You'll also find that YCM has filepath completers (try typing './' in a file)
  365. and a completer that integrates with UltiSnips [25].
  366. -------------------------------------------------------------------------------
  367. *youcompleteme-installation*
  368. Installation ~
  369. -------------------------------------------------------------------------------
  370. *youcompleteme-requirements*
  371. Requirements ~
  372. ===============================================================================
  373. | _Runtime_ | _Min Version_ | _Recommended Version (full support)_ | _Python_ |
  374. ===============================================================================
  375. | Vim | 8.1.2269 | 9.0.214 | 3.8 |
  376. -------------------------------------------------------------------------------
  377. | Neovim | 0.5 | Vim 9.0.214 | 3.8 |
  378. -------------------------------------------------------------------------------
  379. -------------------------------------------------------------------------------
  380. *youcompleteme-supported-vim-versions*
  381. Supported Vim Versions ~
  382. Our policy is to support the Vim version that's in the latest LTS of Ubuntu.
  383. That's currently Ubuntu 20.04 which contains 'vim-nox' at 'v8.1.2269'.
  384. Vim must have a working Python 3 runtime.
  385. For Neovim users, our policy is to require the latest released version.
  386. Currently, Neovim 0.5.0 is required. Please note that some features are not
  387. available in Neovim, and Neovim is not officially supported.
  388. -------------------------------------------------------------------------------
  389. *youcompleteme-supported-python-runtime*
  390. Supported Python runtime ~
  391. YCM has two components: A server and a client. Both the server and client
  392. require Python 3.8 or later 3.x release.
  393. For the Vim client, Vim must be, compiled with '--enable-shared' (or
  394. '--enable-framework' on macOS). You can check if this is working with ':py3
  395. import sys; print( sys.version)'. It should say something like '3.8.2 (...)'.
  396. For Neovim, you must have a python 3.8 runtime and the Neovim python
  397. extensions. See Neovim's ':help provider-python' for how to set that up.
  398. For the server, you must run the 'install.py' script with a python 3.8 (or
  399. later) runtime. Anaconda etc. are not supported. YCM will remember the runtime
  400. you used to run 'install.py' and will use that when launching the server, so if
  401. you usually use anaconda, then make sure to use the full path to a real
  402. cpython3, e.g. '/usr/bin/python3 install.py --all' etc.
  403. Our policy is to support the python3 version that's availble in the latest
  404. Ubuntu LTS (similar to our Vim version policy). We don't increase the python
  405. runtime version without a reason, though. Typically, we do this when the
  406. current python version wer're using goes out of support. At that time we will
  407. typically pick a version that will be supported for a number of years.
  408. -------------------------------------------------------------------------------
  409. *youcompleteme-supported-compilers*
  410. Supported Compilers ~
  411. In order to provide the best possible performance and stability, ycmd has
  412. updated its code to C++17. This requires a version bump of the minimum
  413. supported compilers. The new requirements are:
  414. ===============================
  415. | _Compiler_ | _Current Min_ |
  416. ===============================
  417. | GCC | 8 |
  418. -------------------------------
  419. | Clang | 7 |
  420. -------------------------------
  421. | MSVC | 15.7 (VS 2017) |
  422. -------------------------------
  423. YCM requires CMake 3.13 or greater. If your CMake is too old, you may be able
  424. to simply 'pip install --user cmake' to get a really new version.
  425. -------------------------------------------------------------------------------
  426. *youcompleteme-individual-completer-requirements*
  427. Individual completer requirements ~
  428. When enabling language support for a particular language, there may be runtime
  429. requirements, such as needing a very recent Java Development Kit for Java
  430. support. In general, YCM is not in control of the required versions for the
  431. downstream compilers, though we do our best to signal where we know them.
  432. -------------------------------------------------------------------------------
  433. *youcompleteme-macos*
  434. macOS ~
  435. -------------------------------------------------------------------------------
  436. *youcompleteme-quick-start-installing-all-completers*
  437. Quick start, installing all completers ~
  438. - Install YCM plugin via Vundle [26]
  439. - Install CMake, MacVim and Python 3; Note that the pre-installed _macOS
  440. system_ Vim is not supported (due to it having broken Python integration).
  441. >
  442. $ brew install cmake python go nodejs
  443. <
  444. - Install mono from Mono Project [27] (NOTE: on Intel Macs you can also 'brew
  445. install mono'. On arm Macs, you may require Rosetta)
  446. - For java support you must install a JDK, one way to do this is with
  447. Homebrew:
  448. >
  449. $ brew install java
  450. $ sudo ln -sfn $(brew --prefix java)/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
  451. <
  452. - Pre-installed macOS _system_ Vim does not support Python 3. So you need to
  453. install either a Vim that supports Python 3 OR MacVim [28] with Homebrew
  454. [29]:
  455. - Option 1: Installing a Vim that supports Python 3
  456. >
  457. brew install vim
  458. <
  459. - Option 2: Installing MacVim [28]
  460. >
  461. brew install macvim
  462. <
  463. - Compile YCM.
  464. - For Intel and arm64 Macs, the bundled libclang/clangd work:
  465. >
  466. cd ~/.vim/bundle/YouCompleteMe
  467. python3 install.py --all
  468. <
  469. - If you have troubles with finding system frameworks or C++ standard
  470. library, try using the homebrew llvm:
  471. >
  472. brew install llvm
  473. cd ~/.vim/bundle/YouCompleteMe
  474. python3 install.py --system-libclang --all
  475. <
  476. And edit your vimrc to add the following line to use the Homebrew llvm's
  477. clangd:
  478. >
  479. " Use homebrew's clangd
  480. let g:ycm_clangd_binary_path = trim(system('brew --prefix llvm')).'/bin/clangd'
  481. <
  482. - For using an arbitrary LSP server, check the relevant section
  483. -------------------------------------------------------------------------------
  484. *youcompleteme-explanation-for-quick-start*
  485. Explanation for the quick start ~
  486. These instructions (using 'install.py') are the quickest way to install
  487. YouCompleteMe, however they may not work for everyone. If the following
  488. instructions don't work for you, check out the full installation guide.
  489. A supported Vim version with Python 3 is required. MacVim [28] is a good
  490. option, even if you only use the terminal. YCM won't work with the
  491. pre-installed Vim from Apple as its Python support is broken. If you don't
  492. already use a Vim that supports Python 3 or MacVim [28], install it with
  493. Homebrew [29]. Install CMake as well:
  494. >
  495. brew install vim cmake
  496. <
  497. OR
  498. >
  499. brew install macvim cmake
  500. <
  501. Install YouCompleteMe with Vundle [26].
  502. **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
  503. using Vundle and the 'ycm_core' library APIs have changed (happens rarely), YCM
  504. will notify you to recompile it. You should then rerun the install process.
  505. **NOTE:** If you want C-family completion, you MUST have the latest Xcode
  506. installed along with the latest Command Line Tools (they are installed
  507. automatically when you run 'clang' for the first time, or manually by running
  508. 'xcode-select --install')
  509. Compiling YCM **with** semantic support for C-family languages through
  510. **clangd**:
  511. >
  512. cd ~/.vim/bundle/YouCompleteMe
  513. ./install.py --clangd-completer
  514. <
  515. Compiling YCM **without** semantic support for C-family languages:
  516. >
  517. cd ~/.vim/bundle/YouCompleteMe
  518. ./install.py
  519. <
  520. The following additional language support options are available:
  521. - C# support: install by downloading the Mono macOS package [30] and add
  522. '--cs-completer' when calling 'install.py'.
  523. - Go support: install Go [31] and add '--go-completer' when calling
  524. 'install.py'.
  525. - JavaScript and TypeScript support: install Node.js and npm [32] and add
  526. '--ts-completer' when calling 'install.py'.
  527. - Rust support: add '--rust-completer' when calling 'install.py'.
  528. - Java support: install JDK 17 [33] and add '--java-completer' when calling
  529. 'install.py'.
  530. To simply compile with everything enabled, there's a '--all' flag. So, to
  531. install with all language features, ensure 'xbuild', 'go', 'node' and 'npm'
  532. tools are installed and in your 'PATH', then simply run:
  533. >
  534. cd ~/.vim/bundle/YouCompleteMe
  535. ./install.py --all
  536. <
  537. That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
  538. Don't forget that if you want the C-family semantic completion engine to work,
  539. you will need to provide the compilation flags for your project to YCM. It's
  540. all in the User Guide.
  541. YCM comes with sane defaults for its options, but you still may want to take a
  542. look at what's available for configuration. There are a few interesting options
  543. that are conservatively turned off by default that you may want to turn on.
  544. -------------------------------------------------------------------------------
  545. *youcompleteme-linux-64-bit*
  546. Linux 64-bit ~
  547. The following assume you're using Ubuntu 20.04.
  548. -------------------------------------------------------------------------------
  549. Quick start, installing all completers ~
  550. - Install YCM plugin via Vundle [26]
  551. - Install CMake, Vim and Python
  552. >
  553. apt install build-essential cmake vim-nox python3-dev
  554. <
  555. - Install mono-complete, go, node, java and npm
  556. >
  557. apt install mono-complete golang nodejs openjdk-17-jdk openjdk-17-jre npm
  558. <
  559. - Compile YCM
  560. >
  561. cd ~/.vim/bundle/YouCompleteMe
  562. python3 install.py --all
  563. <
  564. - For plugging an arbitrary LSP server, check the relevant section
  565. -------------------------------------------------------------------------------
  566. Explanation for the quick start ~
  567. These instructions (using 'install.py') are the quickest way to install
  568. YouCompleteMe, however they may not work for everyone. If the following
  569. instructions don't work for you, check out the full installation guide.
  570. Make sure you have a supported version of Vim with Python 3 support, and a
  571. supported compiler. The latest LTS of Ubuntu is the minimum platform for simple
  572. installation. For earlier releases or other distributions, you may have to do
  573. some work to acquire the dependencies.
  574. If your Vim version is too old, you may need to compile Vim from source [34]
  575. (don't worry, it's easy).
  576. Install YouCompleteMe with Vundle [26].
  577. **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
  578. using Vundle and the 'ycm_core' library APIs have changed (happens rarely), YCM
  579. will notify you to recompile it. You should then rerun the install process.
  580. Install development tools, CMake, and Python headers:
  581. - Fedora-like distributions:
  582. >
  583. sudo dnf install cmake gcc-c++ make python3-devel
  584. <
  585. - Ubuntu LTS:
  586. >
  587. sudo apt install build-essential cmake3 python3-dev
  588. <
  589. Compiling YCM **with** semantic support for C-family languages through
  590. **clangd**:
  591. >
  592. cd ~/.vim/bundle/YouCompleteMe
  593. python3 install.py --clangd-completer
  594. <
  595. Compiling YCM **without** semantic support for C-family languages:
  596. >
  597. cd ~/.vim/bundle/YouCompleteMe
  598. python3 install.py
  599. <
  600. The following additional language support options are available:
  601. - C# support: install Mono [35] and add '--cs-completer' when calling
  602. 'install.py'.
  603. - Go support: install Go [31] and add '--go-completer' when calling
  604. 'install.py'.
  605. - JavaScript and TypeScript support: install Node.js and npm [32] and add
  606. '--ts-completer' when calling 'install.py'.
  607. - Rust support: add '--rust-completer' when calling 'install.py'.
  608. - Java support: install JDK 17 [33] and add '--java-completer' when calling
  609. 'install.py'.
  610. To simply compile with everything enabled, there's a '--all' flag. So, to
  611. install with all language features, ensure 'xbuild', 'go', 'node' and 'npm'
  612. tools are installed and in your 'PATH', then simply run:
  613. >
  614. cd ~/.vim/bundle/YouCompleteMe
  615. python3 install.py --all
  616. <
  617. That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
  618. Don't forget that if you want the C-family semantic completion engine to work,
  619. you will need to provide the compilation flags for your project to YCM. It's
  620. all in the User Guide.
  621. YCM comes with sane defaults for its options, but you still may want to take a
  622. look at what's available for configuration. There are a few interesting options
  623. that are conservatively turned off by default that you may want to turn on.
  624. -------------------------------------------------------------------------------
  625. *youcompleteme-windows*
  626. Windows ~
  627. -------------------------------------------------------------------------------
  628. Quick start, installing all completers ~
  629. - Install YCM plugin via Vundle [26]
  630. - Install Visual Studio Build Tools 2019 [36]
  631. - Install CMake, Vim and Python
  632. - Install go, node and npm
  633. - Compile YCM
  634. >
  635. cd YouCompleteMe
  636. python3 install.py --all
  637. <
  638. - Add 'set encoding=utf-8' to your vimrc [37]
  639. - For plugging an arbitrary LSP server, check the relevant section
  640. -------------------------------------------------------------------------------
  641. Explanation for the quick start ~
  642. These instructions (using 'install.py') are the quickest way to install
  643. YouCompleteMe, however they may not work for everyone. If the following
  644. instructions don't work for you, check out the full installation guide.
  645. **Important:** we assume that you are using the 'cmd.exe' command prompt and
  646. that you know how to add an executable to the PATH environment variable.
  647. Make sure you have a supported Vim version with Python 3 support. You can check
  648. the version and which Python is supported by typing ':version' inside Vim. Look
  649. at the features included: '+python3/dyn' for Python 3. Take note of the Vim
  650. architecture, i.e. 32 or 64-bit. It will be important when choosing the Python
  651. installer. We recommend using a 64-bit client. Daily updated installers of
  652. 32-bit and 64-bit Vim with Python 3 support [38] are available.
  653. Add the following line to your vimrc [37] if not already present.:
  654. >
  655. set encoding=utf-8
  656. <
  657. This option is required by YCM. Note that it does not prevent you from editing
  658. a file in another encoding than UTF-8. You can do that by specifying the
  659. '|++enc|' argument to the ':e' command.
  660. Install YouCompleteMe with Vundle [26].
  661. **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
  662. using Vundle and the 'ycm_core' library APIs have changed (happens rarely), YCM
  663. will notify you to recompile it. You should then rerun the install process.
  664. Download and install the following software:
  665. - Python 3 [39]. Be sure to pick the version corresponding to your Vim
  666. architecture. It is _Windows x86_ for a 32-bit Vim and _Windows x86-64_ for
  667. a 64-bit Vim. We recommend installing Python 3. Additionally, the version
  668. of Python you install must match up exactly with the version of Python that
  669. Vim is looking for. Type ':version' and look at the bottom of the page at
  670. the list of compiler flags. Look for flags that look similar to
  671. '-DDYNAMIC_PYTHON3_DLL=\"python36.dll\"'. This indicates that Vim is
  672. looking for Python 3.6. You'll need one or the other installed, matching
  673. the version number exactly.
  674. - CMake [40]. Add CMake executable to the PATH environment variable.
  675. - Build Tools for Visual Studio 2019 [36]. During setup, select _C++ build
  676. tools_ in _Workloads_.
  677. Compiling YCM **with** semantic support for C-family languages through
  678. **clangd**:
  679. >
  680. cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
  681. python install.py --clangd-completer
  682. <
  683. Compiling YCM **without** semantic support for C-family languages:
  684. >
  685. cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
  686. python install.py
  687. <
  688. The following additional language support options are available:
  689. - C# support: add '--cs-completer' when calling 'install.py'. Be sure that
  690. the build utility 'msbuild' is in your PATH [41].
  691. - Go support: install Go [31] and add '--go-completer' when calling
  692. 'install.py'.
  693. - JavaScript and TypeScript support: install Node.js and npm [32] and add
  694. '--ts-completer' when calling 'install.py'.
  695. - Rust support: add '--rust-completer' when calling 'install.py'.
  696. - Java support: install JDK 17 [33] and add '--java-completer' when calling
  697. 'install.py'.
  698. To simply compile with everything enabled, there's a '--all' flag. So, to
  699. install with all language features, ensure 'msbuild', 'go', 'node' and 'npm'
  700. tools are installed and in your 'PATH', then simply run:
  701. >
  702. cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
  703. python install.py --all
  704. <
  705. You can specify the Microsoft Visual C++ (MSVC) version using the '--msvc'
  706. option. YCM officially supports MSVC 15 (2017), MSVC 16 (Visual Studio 2019)
  707. and MSVC 17 (Visual Studio 17 2022).
  708. That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
  709. Don't forget that if you want the C-family semantic completion engine to work,
  710. you will need to provide the compilation flags for your project to YCM. It's
  711. all in the User Guide.
  712. YCM comes with sane defaults for its options, but you still may want to take a
  713. look at what's available for configuration. There are a few interesting options
  714. that are conservatively turned off by default that you may want to turn on.
  715. -------------------------------------------------------------------------------
  716. *youcompleteme-full-installation-guide*
  717. Full Installation Guide ~
  718. The full installation guide [42] has been moved to the wiki.
  719. -------------------------------------------------------------------------------
  720. *youcompleteme-quick-feature-summary*
  721. Quick Feature Summary ~
  722. -------------------------------------------------------------------------------
  723. *youcompleteme-general*
  724. General (all languages) ~
  725. - Super-fast identifier completer including tags files and syntax elements
  726. - Intelligent suggestion ranking and filtering
  727. - File and path suggestions
  728. - Suggestions from Vim's omnifunc
  729. - UltiSnips snippet suggestions
  730. -------------------------------------------------------------------------------
  731. *youcompleteme-c-family-languages*
  732. C-family languages (C, C++, Objective C, Objective C++, CUDA) ~
  733. - Semantic auto-completion with automatic fixes
  734. - Signature help
  735. - Real-time diagnostic display
  736. - Go to include/declaration/definition (|GoTo|, etc.)
  737. - Go to alternate file (e.g. associated header |GoToAlternateFile|)
  738. - Find Symbol ('GoToSymbol'), with interactive search
  739. - Document outline (|GoToDocumentOutline|), with interactive search
  740. - View documentation comments for identifiers (|GetDoc|)
  741. - Type information for identifiers (|GetType|)
  742. - Automatically fix certain errors (|FixIt|)
  743. - Perform refactoring (|FixIt|)
  744. - Reference finding (|GoToReferences|)
  745. - Renaming symbols ('RefactorRename <new name>')
  746. - Code formatting (|Format|)
  747. - Semantic highlighting
  748. - Inlay hints
  749. -------------------------------------------------------------------------------
  750. *youcompleteme-c*
  751. C♯ ~
  752. - Semantic auto-completion
  753. - Signature help
  754. - Real-time diagnostic display
  755. - Go to declaration/definition (|GoTo|, etc.)
  756. - Go to implementation (|GoToImplementation|)
  757. - Find Symbol ('GoToSymbol'), with interactive search
  758. - View documentation comments for identifiers (|GetDoc|)
  759. - Type information for identifiers (|GetType|)
  760. - Automatically fix certain errors (|FixIt|)
  761. - Perform refactoring (|FixIt|)
  762. - Management of OmniSharp-Roslyn server instance
  763. - Renaming symbols ('RefactorRename <new name>')
  764. - Code formatting (|Format|)
  765. -------------------------------------------------------------------------------
  766. *youcompleteme-python*
  767. Python ~
  768. - Semantic auto-completion
  769. - Signature help
  770. - Go to definition (|GoTo|)
  771. - Find Symbol ('GoToSymbol'), with interactive search
  772. - Reference finding (|GoToReferences|)
  773. - View documentation comments for identifiers (|GetDoc|)
  774. - Type information for identifiers (|GetType|)
  775. - Renaming symbols ('RefactorRename <new name>')
  776. -------------------------------------------------------------------------------
  777. *youcompleteme-go*
  778. Go ~
  779. - Semantic auto-completion
  780. - Signature help
  781. - Real-time diagnostic display
  782. - Go to declaration/definition (|GoTo|, etc.)
  783. - Go to type definition (|GoToType|)
  784. - Go to implementation (|GoToImplementation|)
  785. - Document outline (|GoToDocumentOutline|), with interactive search
  786. - Automatically fix certain errors (|FixIt|)
  787. - Perform refactoring (|FixIt|)
  788. - View documentation comments for identifiers (|GetDoc|)
  789. - Type information for identifiers (|GetType|)
  790. - Code formatting (|Format|)
  791. - Management of 'gopls' server instance
  792. -------------------------------------------------------------------------------
  793. *youcompleteme-javascript-typescript*
  794. JavaScript and TypeScript ~
  795. - Semantic auto-completion with automatic import insertion
  796. - Signature help
  797. - Real-time diagnostic display
  798. - Go to definition (|GoTo|, |GoToDefinition|, and |GoToDeclaration| are
  799. identical)
  800. - Go to type definition (|GoToType|)
  801. - Go to implementation (|GoToImplementation|)
  802. - Find Symbol ('GoToSymbol'), with interactive search
  803. - Reference finding (|GoToReferences|)
  804. - View documentation comments for identifiers (|GetDoc|)
  805. - Type information for identifiers (|GetType|)
  806. - Automatically fix certain errors and perform refactoring (|FixIt|)
  807. - Perform refactoring (|FixIt|)
  808. - Renaming symbols ('RefactorRename <new name>')
  809. - Code formatting (|Format|)
  810. - Organize imports (|OrganizeImports|)
  811. - Management of 'TSServer' server instance
  812. - Inlay hints
  813. -------------------------------------------------------------------------------
  814. *youcompleteme-rust*
  815. Rust ~
  816. - Semantic auto-completion
  817. - Real-time diagnostic display
  818. - Go to declaration/definition (|GoTo|, etc.)
  819. - Go to implementation (|GoToImplementation|)
  820. - Reference finding (|GoToReferences|)
  821. - Document outline (|GoToDocumentOutline|), with interactive search
  822. - View documentation comments for identifiers (|GetDoc|)
  823. - Automatically fix certain errors (|FixIt|)
  824. - Perform refactoring (|FixIt|)
  825. - Type information for identifiers (|GetType|)
  826. - Renaming symbols ('RefactorRename <new name>')
  827. - Code formatting (|Format|)
  828. - Management of 'rust-analyzer' server instance
  829. - Semantic highlighting
  830. - Inlay hints
  831. -------------------------------------------------------------------------------
  832. *youcompleteme-java*
  833. Java ~
  834. - Semantic auto-completion with automatic import insertion
  835. - Signature help
  836. - Real-time diagnostic display
  837. - Go to definition (|GoTo|, |GoToDefinition|, and |GoToDeclaration| are
  838. identical)
  839. - Go to type definition (|GoToType|)
  840. - Go to implementation (|GoToImplementation|)
  841. - Find Symbol ('GoToSymbol'), with interactive search
  842. - Reference finding (|GoToReferences|)
  843. - Document outline (|GoToDocumentOutline|), with interactive search
  844. - View documentation comments for identifiers (|GetDoc|)
  845. - Type information for identifiers (|GetType|)
  846. - Automatically fix certain errors including code generation (|FixIt|)
  847. - Renaming symbols ('RefactorRename <new name>')
  848. - Code formatting (|Format|)
  849. - Organize imports (|OrganizeImports|)
  850. - Detection of java projects
  851. - Execute custom server command ('ExecuteCommand <args>')
  852. - Management of 'jdt.ls' server instance
  853. - Semantic highlighting
  854. -------------------------------------------------------------------------------
  855. *youcompleteme-user-guide*
  856. User Guide ~
  857. -------------------------------------------------------------------------------
  858. *youcompleteme-general-usage*
  859. General Usage ~
  860. If the offered completions are too broad, keep typing characters; YCM will
  861. continue refining the offered completions based on your input.
  862. Filtering is "smart-case" and "smart-diacritic [43]" sensitive; if you are
  863. typing only lowercase letters, then it's case-insensitive. If your input
  864. contains uppercase letters, then the uppercase letters in your query must match
  865. uppercase letters in the completion strings (the lowercase letters still match
  866. both). On top of that, a letter with no diacritic marks will match that letter
  867. with or without marks:
  868. ---------------------------------------------
  869. | _matches_ | _foo_ | _fôo_ | _fOo_ | _fÔo_ |
  870. ---------------------------------------------
  871. | _foo_ | ✔️ | ✔️ | ✔️ | ✔️ |
  872. ---------------------------------------------
  873. | _fôo_ | ❌ | ✔️ | ❌ | ✔️ |
  874. ---------------------------------------------
  875. | _fOo_ | ❌ | ❌ | ✔️ | ✔️ |
  876. ---------------------------------------------
  877. | _fÔo_ | ❌ | ❌ | ❌ | ✔️ |
  878. ---------------------------------------------
  879. Use the TAB key to accept a completion and continue pressing TAB to cycle
  880. through the completions. Use Shift-TAB to cycle backwards. Note that if you're
  881. using console Vim (that is, not gvim or MacVim) then it's likely that the
  882. Shift-TAB binding will not work because the console will not pass it to Vim.
  883. You can remap the keys; see the Options section below.
  884. Knowing a little bit about how YCM works internally will prevent confusion. YCM
  885. has several completion engines: an identifier-based completer that collects all
  886. of the identifiers in the current file and other files you visit (and your tags
  887. files) and searches them when you type (identifiers are put into per-filetype
  888. groups).
  889. There are also several semantic engines in YCM. There are libclang-based and
  890. clangd-based completers that provide semantic completion for C-family
  891. languages. There's a Jedi-based completer for semantic completion for Python.
  892. There's also an omnifunc-based completer that uses data from Vim's omnicomplete
  893. system to provide semantic completions when no native completer exists for that
  894. language in YCM.
  895. There are also other completion engines, like the UltiSnips completer and the
  896. filepath completer.
  897. YCM automatically detects which completion engine would be the best in any
  898. situation. On occasion, it queries several of them at once, merges the outputs
  899. and presents the results to you.
  900. -------------------------------------------------------------------------------
  901. *youcompleteme-client-server-architecture*
  902. Client-Server Architecture ~
  903. YCM has a client-server architecture; the Vim part of YCM is only a thin client
  904. that talks to the ycmd HTTP+JSON server [44] that has the vast majority of YCM
  905. logic and functionality. The server is started and stopped automatically as you
  906. start and stop Vim.
  907. -------------------------------------------------------------------------------
  908. *youcompleteme-completion-string-ranking*
  909. Completion String Ranking ~
  910. The subsequence filter removes any completions that do not match the input, but
  911. then the sorting system kicks in. It's actually very complicated and uses lots
  912. of factors, but suffice it to say that "word boundary" (WB) subsequence
  913. character matches are "worth" more than non-WB matches. In effect, this means
  914. given an input of "gua", the completion "getUserAccount" would be ranked higher
  915. in the list than the "Fooguxa" completion (both of which are subsequence
  916. matches). A word-boundary character are all capital characters, characters
  917. preceded by an underscore and the first letter character in the completion
  918. string.
  919. -------------------------------------------------------------------------------
  920. *youcompleteme-signature-help*
  921. Signature Help ~
  922. Valid signatures are displayed in a second popup menu and the current signature
  923. is highlighted along with the current argument.
  924. Signature help is triggered in insert mode automatically when
  925. |g:ycm_auto_trigger| is enabled and is not supported when it is not enabled.
  926. The signatures popup is hidden when there are no matching signatures or when
  927. you leave insert mode. If you want to manually control when it is visible, you
  928. can map something to '<plug>YCMToggleSignatureHelp' (see below).
  929. For more details on this feature and a few demos, check out the PR that
  930. proposed it [45].
  931. -------------------------------------------------------------------------------
  932. *youcompleteme-dismiss-signature-help*
  933. Dismiss signature help ~
  934. The signature help popup sometimes gets in the way. You can toggle its
  935. visibility with a mapping. YCM provides the "Plug" mapping
  936. '<Plug>(YCMToggleSignatureHelp)' for this.
  937. For example, to hide/show the signature help popup by pressing Ctrl+l in insert
  938. mode: 'imap <silent> <C-l> <Plug>(YCMToggleSignatureHelp)'.
  939. _NOTE_: No default mapping is provided because insert mappings are very
  940. difficult to create without breaking or overriding some existing functionality.
  941. Ctrl-l is not a suggestion, just an example.
  942. -------------------------------------------------------------------------------
  943. *youcompleteme-semantic-highlighting*
  944. Semantic highlighting ~
  945. **NOTE**: This feature is highly experimental and offered in the hope that it
  946. is useful. It shall not be considered stable; if you find issues with it, feel
  947. free to report them however.
  948. Semantic highlighting is the process where the buffer text is coloured
  949. according to the underlying semantic type of the word, rather than classic
  950. syntax highlighting based on regular expressions. This can be powerful
  951. additional data that we can process very quickly.
  952. This feature is only supported in Vim.
  953. For example, here is a function with classic highlighting:
  954. Image: highliting-classic (see reference [46])
  955. And here is the same function with semantic highlighting:
  956. Image: highliting-semantic (see reference [47])
  957. As you can see, the function calls, macros, etc. are correctly identified.
  958. This can be enabled globally with 'let g:ycm_enable_semantic_highlighting=1' or
  959. per buffer, by setting 'b:ycm_enable_semantic_highlighting'.
  960. -------------------------------------------------------------------------------
  961. *youcompleteme-customising-highlight-groups*
  962. Customising the highlight groups ~
  963. YCM uses text properties (see ':help text-prop-intro') for semantic
  964. highlighting. In order to customise the coloring, you can define the text
  965. properties that are used.
  966. If you define a text property named 'YCM_HL_<token type>', then it will be used
  967. in place of the defaults. The '<token type>' is defined as the Language Server
  968. Protocol semantic token type, defined in the LSP Spec [48].
  969. Some servers also use custom values. In this case, YCM prints a warning
  970. including the token type name that you can customise.
  971. For example, to render 'parameter' tokens using the 'Normal' highlight group,
  972. you can do this:
  973. >
  974. call prop_type_add( 'YCM_HL_parameter', { 'highlight': 'Normal' } )
  975. <
  976. More generally, this pattern can be useful for customising the groups:
  977. >
  978. let MY_YCM_HIGHLIGHT_GROUP = {
  979. \ 'typeParameter': 'PreProc',
  980. \ 'parameter': 'Normal',
  981. \ 'variable': 'Normal',
  982. \ 'property': 'Normal',
  983. \ 'enumMember': 'Normal',
  984. \ 'event': 'Special',
  985. \ 'member': 'Normal',
  986. \ 'method': 'Normal',
  987. \ 'class': 'Special',
  988. \ 'namespace': 'Special',
  989. \ }
  990. for tokenType in keys( MY_YCM_HIGHLIGHT_GROUP )
  991. call prop_type_add( 'YCM_HL_' . tokenType,
  992. \ { 'highlight': MY_YCM_HIGHLIGHT_GROUP[ tokenType ] } )
  993. endfor
  994. <
  995. -------------------------------------------------------------------------------
  996. *youcompleteme-inlay-hints*
  997. Inlay hints ~
  998. **NOTE**: Highly experimental feature, requiring Vim 9.0.214 or later (not
  999. supported in NeoVim).
  1000. When 'g:ycm_enable_inlay_hints' (globally) or 'b:ycm_enable_inlay_hints' (for a
  1001. specific buffer) is set to '1', then YCM will insert inlay hints as supported
  1002. by the language semantic engine.
  1003. An inlay hint is text rendered on the screen which is not part of the buffer
  1004. and is often used to mark up the type or name of arguments, parameters, etc.
  1005. which help the developer understand the semantics of the code.
  1006. Here are some examples:
  1007. - C
  1008. Image: c-inlay (see reference [49])
  1009. - TypeScript
  1010. Image: ts-inlay (see reference [50])
  1011. - Go
  1012. Image: go-inlay (see reference [51])
  1013. -------------------------------------------------------------------------------
  1014. *youcompleteme-highlight-groups*
  1015. Highlight groups ~
  1016. By default, YCM renders the inlay hints with the 'NonText' highlight group. To
  1017. override this, define the 'YcmInlayHint' highlight yourself, e.g. in your
  1018. '.vimrc':
  1019. >
  1020. hi link YcmInlayHint Comment
  1021. <
  1022. Similar to semantic highlighting above, you can override specific highlighting
  1023. for different inlay hint types by defining text properties named after the kind
  1024. of inlay hint, for example:
  1025. >
  1026. call prop_type_add( 'YCM_INLAY_Type', #{ highlight: 'Comment' } )
  1027. <
  1028. The list of inlay hint kinds can be found in 'python/ycm/inlay_hints.py'
  1029. -------------------------------------------------------------------------------
  1030. *youcompleteme-options*
  1031. Options ~
  1032. - 'g:ycm_enable_inlay_hints' or 'b:ycm_enable_inlay_hints' - enable/disable
  1033. globally or for local buffer
  1034. - 'g:ycm_clear_inlay_hints_in_insert_mode' - set to '1' to remove all inlay
  1035. hints when entering insert mode and reinstate them when leaving insert mode
  1036. -------------------------------------------------------------------------------
  1037. *youcompleteme-toggling*
  1038. Toggling ~
  1039. Inlay hints can add a lot of text to the screen and may be distracting. You can
  1040. toggle them on/off instantly, by mapping something to
  1041. '<Plug>(YCMToggleInlayHints)', for example:
  1042. >
  1043. nnoremap <silent> <localleader>h <Plug>(YCMToggleInlayHints)
  1044. <
  1045. No default mapping is provided for this due to the personal nature of mappings.
  1046. -------------------------------------------------------------------------------
  1047. *youcompleteme-general-semantic-completion*
  1048. General Semantic Completion ~
  1049. You can use Ctrl+Space to trigger the completion suggestions anywhere, even
  1050. without a string prefix. This is useful to see which top-level functions are
  1051. available for use.
  1052. -------------------------------------------------------------------------------
  1053. *youcompleteme-c-family-semantic-completion*
  1054. C-family Semantic Completion ~
  1055. **NOTE:** YCM originally used the 'libclang' based engine for C-family, but
  1056. users should migrate to clangd, as it provides more features and better
  1057. performance. Users who rely on 'override_filename' in their
  1058. '.ycm_extra_conf.py' will need to stay on the old 'libclang' engine.
  1059. Instructions on how to stay on the old engine are available on the wiki [52].
  1060. Some of the features of clangd:
  1061. - **Project wide indexing**: Clangd has both dynamic and static index
  1062. support. The dynamic index stores up-to-date symbols coming from any files
  1063. you are currently editing, whereas static index contains project-wide
  1064. symbol information. This symbol information is used for code completion and
  1065. code navigation. Whereas libclang is limited to the current translation
  1066. unit(TU).
  1067. - **Code navigation**: Clangd provides all the GoTo requests libclang
  1068. provides and it improves those using the above mentioned index information
  1069. to contain project-wide information rather than just the current TU.
  1070. - **Rename**: Clangd can perform semantic rename operations on the current
  1071. file, whereas libclang doesn't support such functionality.
  1072. - **Code Completion**: Clangd can perform code completions at a lower latency
  1073. than libclang; also, it has information about all the symbols in your
  1074. project so it can suggest items outside your current TU and also provides
  1075. proper '#include' insertions for those items.
  1076. - **Signature help**: Clangd provides signature help so that you can see the
  1077. names and types of arguments when calling functions.
  1078. - **Format Code**: Clangd provides code formatting either for the selected
  1079. lines or the whole file, whereas libclang doesn't have such functionality.
  1080. - **Performance**: Clangd has faster re-parse and code completion times
  1081. compared to libclang.
  1082. -------------------------------------------------------------------------------
  1083. Installation ~
  1084. On supported architectures, the 'install.py' script will download a suitable
  1085. clangd ('--clangd-completer') or libclang ('--clang-completer') for you.
  1086. Supported architectures are:
  1087. - Linux glibc >= 2.31 (Intel, armv7-a, aarch64) - built on ubuntu 20.04
  1088. - MacOS >=10.15 (Intel, arm64)
  1089. - For Intel, compatibility per clang.llvm.org downloads
  1090. - For arm64, macOS 10.15+
  1091. - Windows (Intel) - compatibility per clang.llvm.org downloads
  1092. **_clangd_**:
  1093. Typically, clangd is installed by the YCM installer (either with '--all' or
  1094. with '--clangd-completer'). This downloads a pre-built 'clangd' binary for your
  1095. architecture. If your OS or architecture is not supported or too old, you can
  1096. install a compatible 'clangd' and use |g:ycm_clangd_binary_path| to point to
  1097. it.
  1098. **_libclang_**:
  1099. 'libclang' can be enabled also with '--all' or '--clang-completer'. As with
  1100. 'clangd', YCM will try and download a version of 'libclang' that is suitable
  1101. for your environment, but again if your environment can't be supported, you can
  1102. build or acquire 'libclang' for yourself and specify it when building, as:
  1103. >
  1104. $ EXTRA_CMAKE_ARGS='-DPATH_TO_LLVM_ROOT=/path/to/your/llvm' ./install.py --clang-completer --system-libclang
  1105. <
  1106. Please note that if using custom 'clangd' or 'libclang' it _must_ match the
  1107. version that YCM requires. Currently YCM requires **_clang 17.0.1_**.
  1108. -------------------------------------------------------------------------------
  1109. *youcompleteme-compile-flags*
  1110. Compile flags ~
  1111. In order to perform semantic analysis such as code completion, |GoTo| and
  1112. diagnostics, YouCompleteMe uses 'clangd', which makes use of clang compiler,
  1113. sometimes also referred to as LLVM. Like any compiler, clang also requires a
  1114. set of compile flags in order to parse your code. Simply put: If clang can't
  1115. parse your code, YouCompleteMe can't provide semantic analysis.
  1116. There are 2 methods which can be used to provide compile flags to clang:
  1117. -------------------------------------------------------------------------------
  1118. *youcompleteme-option-1-use-compilation-database-53*
  1119. Option 1: Use a compilation database [53] ~
  1120. The easiest way to get YCM to compile your code is to use a compilation
  1121. database. A compilation database is usually generated by your build system
  1122. (e.g. 'CMake') and contains the compiler invocation for each compilation unit
  1123. in your project.
  1124. For information on how to generate a compilation database, see the clang
  1125. documentation [53]. In short:
  1126. - If using CMake, add '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON' when configuring
  1127. (or add 'set( CMAKE_EXPORT_COMPILE_COMMANDS ON )' to 'CMakeLists.txt') and
  1128. copy or symlink the generated database to the root of your project.
  1129. - If using Ninja, check out the 'compdb' tool ('-t compdb') in its docs [54].
  1130. - If using GNU make, check out compiledb [55] or Bear [56].
  1131. - For other build systems, check out '.ycm_extra_conf.py' below.
  1132. If no '.ycm_extra_conf.py' is found, YouCompleteMe automatically tries to load
  1133. a compilation database if there is one.
  1134. YCM looks for a file named 'compile_commands.json' in the directory of the
  1135. opened file or in any directory above it in the hierarchy (recursively); when
  1136. the file is found before a local '.ycm_extra_conf.py', YouCompleteMe stops
  1137. searching the directories and lets clangd take over and handle the flags.
  1138. -------------------------------------------------------------------------------
  1139. *youcompleteme-option-2-provide-flags-manually*
  1140. Option 2: Provide the flags manually ~
  1141. If you don't have a compilation database, or aren't able to generate one, you
  1142. have to tell YouCompleteMe how to compile your code some other way.
  1143. Every C-family project is different. It is not possible for YCM to guess what
  1144. compiler flags to supply for your project. Fortunately, YCM provides a
  1145. mechanism for you to generate the flags for a particular file with _arbitrary
  1146. complexity_. This is achieved by requiring you to provide a Python module which
  1147. implements a trivial function which, given the file name as argument, returns a
  1148. list of compiler flags to use to compile that file.
  1149. YCM looks for a '.ycm_extra_conf.py' file in the directory of the opened file
  1150. or in any directory above it in the hierarchy (recursively); when the file is
  1151. found, it is loaded (only once!) as a Python module. YCM calls a 'Settings'
  1152. method in that module which should provide it with the information necessary to
  1153. compile the current file. You can also provide a path to a global configuration
  1154. file with the |g:ycm_global_ycm_extra_conf| option, which will be used as a
  1155. fallback. To prevent the execution of malicious code from a file you didn't
  1156. write YCM will ask you once per '.ycm_extra_conf.py' if it is safe to load.
  1157. This can be disabled and you can white-/blacklist files. See the
  1158. |g:ycm_confirm_extra_conf| and |g:ycm_extra_conf_globlist| options
  1159. respectively.
  1160. This system was designed this way so that the user can perform any arbitrary
  1161. sequence of operations to produce a list of compilation flags YCM should hand
  1162. to Clang.
  1163. **NOTE**: It is highly recommended to include '-x <language>' flag to libclang.
  1164. This is so that the correct language is detected, particularly for header
  1165. files. Common values are '-x c' for C, '-x c++' for C++, '-x objc' for
  1166. Objective-C, and '-x cuda' for CUDA.
  1167. To give you an impression, if your C++ project is trivial, and your usual
  1168. compilation command is: 'g++ -Wall -Wextra -Werror -o FILE.o FILE.cc', then the
  1169. following '.ycm_extra_conf.py' is enough to get semantic analysis from
  1170. YouCompleteMe:
  1171. >
  1172. def Settings( **kwargs ):
  1173. return {
  1174. 'flags': [ '-x', 'c++', '-Wall', '-Wextra', '-Werror' ],
  1175. }
  1176. <
  1177. As you can see from the trivial example, YCM calls the 'Settings' method which
  1178. returns a dictionary with a single element "'flags'". This element is a 'list'
  1179. of compiler flags to pass to libclang for the current file. The absolute path
  1180. of that file is accessible under the 'filename' key of the 'kwargs' dictionary.
  1181. That's it! This is actually enough for most projects, but for complex projects
  1182. it is not uncommon to integrate directly with an existing build system using
  1183. the full power of the Python language.
  1184. For a more elaborate example, see ycmd's own '.ycm_extra_conf.py' [57]. You
  1185. should be able to use it _as a starting point_. **Don't** just copy/paste that
  1186. file somewhere and expect things to magically work; **your project needs
  1187. different flags**. Hint: just replace the strings in the 'flags' variable with
  1188. compilation flags necessary for your project. That should be enough for 99% of
  1189. projects.
  1190. You could also consider using YCM-Generator [58] to generate the
  1191. 'ycm_extra_conf.py' file.
  1192. -------------------------------------------------------------------------------
  1193. *youcompleteme-errors-during-compilation*
  1194. Errors during compilation ~
  1195. If Clang encounters errors when compiling the header files that your file
  1196. includes, then it's probably going to take a long time to get completions. When
  1197. the completion menu finally appears, it's going to have a large number of
  1198. unrelated completion strings (type/function names that are not actually
  1199. members). This is because Clang fails to build a precompiled preamble for your
  1200. file if there are any errors in the included headers and that preamble is key
  1201. to getting fast completions.
  1202. Call the |:YcmDiags| command to see if any errors or warnings were detected in
  1203. your file.
  1204. -------------------------------------------------------------------------------
  1205. *youcompleteme-java-semantic-completion*
  1206. Java Semantic Completion ~
  1207. -------------------------------------------------------------------------------
  1208. *youcompleteme-java-quick-start*
  1209. Java quick Start ~
  1210. 1. Ensure that you have enabled the Java completer. See the installation
  1211. guide for details.
  1212. 2. Create a project file (gradle or maven) file in the root directory of
  1213. your Java project, by following the instructions below.
  1214. 3. (Optional) Configure the LSP server. The jdt.ls configuration options
  1215. [59] can be found in their codebase.
  1216. 4. If you previously used Eclim or Syntastic for Java, disable them for
  1217. Java.
  1218. 5. Edit a Java file from your project.
  1219. -------------------------------------------------------------------------------
  1220. *youcompleteme-java-project-files*
  1221. Java Project Files ~
  1222. In order to provide semantic analysis, the Java completion engine requires
  1223. knowledge of your project structure. In particular it needs to know the class
  1224. path to use, when compiling your code. Fortunately jdt.ls [17] supports eclipse
  1225. project files [60], maven projects [61] and gradle projects [62].
  1226. **NOTE:** Our recommendation is to use either maven or gradle projects.
  1227. -------------------------------------------------------------------------------
  1228. *youcompleteme-diagnostic-display-syntastic*
  1229. Diagnostic display - Syntastic ~
  1230. The native support for Java includes YCM's native realtime diagnostics display.
  1231. This can conflict with other diagnostics plugins like Syntastic, so when
  1232. enabling Java support, please **manually disable Syntastic Java diagnostics**.
  1233. Add the following to your 'vimrc':
  1234. >
  1235. let g:syntastic_java_checkers = []
  1236. <
  1237. -------------------------------------------------------------------------------
  1238. *youcompleteme-diagnostic-display-eclim*
  1239. Diagnostic display - Eclim ~
  1240. The native support for Java includes YCM's native realtime diagnostics display.
  1241. This can conflict with other diagnostics plugins like Eclim, so when enabling
  1242. Java support, please **manually disable Eclim Java diagnostics**.
  1243. Add the following to your 'vimrc':
  1244. >
  1245. let g:EclimFileTypeValidate = 0
  1246. <
  1247. **NOTE**: We recommend disabling Eclim entirely when editing Java with YCM's
  1248. native Java support. This can be done temporarily with ':EclimDisable'.
  1249. -------------------------------------------------------------------------------
  1250. *youcompleteme-eclipse-projects*
  1251. Eclipse Projects ~
  1252. Eclipse style projects require two files: .project [60] and .classpath [63].
  1253. If your project already has these files due to previously being set up within
  1254. eclipse, then no setup is required. jdt.ls [17] should load the project just
  1255. fine (it's basically eclipse after all).
  1256. However, if not, it is possible (easy in fact) to craft them manually, though
  1257. it is not recommended. You're better off using gradle or maven (see below).
  1258. A simple eclipse style project example [64] can be found in the ycmd test
  1259. directory. Normally all that is required is to copy these files to the root of
  1260. your project and to edit the '.classpath' to add additional libraries, such as:
  1261. >
  1262. <classpathentry kind="lib" path="/path/to/external/jar" />
  1263. <classpathentry kind="lib" path="/path/to/external/java/source" />
  1264. <
  1265. It may also be necessary to change the directory in which your source files are
  1266. located (paths are relative to the .project file itself):
  1267. >
  1268. <classpathentry kind="src" output="target/classes" path="path/to/src/" />
  1269. <
  1270. **NOTE**: The eclipse project and classpath files are not a public interface
  1271. and it is highly recommended to use Maven or Gradle project definitions if you
  1272. don't already use eclipse to manage your projects.
  1273. -------------------------------------------------------------------------------
  1274. *youcompleteme-maven-projects*
  1275. Maven Projects ~
  1276. Maven needs a file named pom.xml [61] in the root of the project. Once again a
  1277. simple pom.xml [65] can be found in ycmd source.
  1278. The format of pom.xml [61] files is way beyond the scope of this document, but
  1279. we do recommend using the various tools that can generate them for you, if
  1280. you're not familiar with them already.
  1281. -------------------------------------------------------------------------------
  1282. *youcompleteme-gradle-projects*
  1283. Gradle Projects ~
  1284. Gradle projects require a build.gradle [62]. Again, there is a trivial example
  1285. in ycmd's tests [66].
  1286. The format of build.gradle [62] files is way beyond the scope of this document,
  1287. but we do recommend using the various tools that can generate them for you, if
  1288. you're not familiar with them already.
  1289. Some users have experienced issues with their jdt.ls when using the Groovy
  1290. language for their build.gradle. As such, try using Kotlin [67] instead.
  1291. -------------------------------------------------------------------------------
  1292. *youcompleteme-troubleshooting*
  1293. Troubleshooting ~
  1294. If you're not getting completions or diagnostics, check the server health:
  1295. - The Java completion engine takes a while to start up and parse your
  1296. project. You should be able to see its progress in the command line, and
  1297. |:YcmDebugInfo|. Ensure that the following lines are present:
  1298. >
  1299. -- jdt.ls Java Language Server running
  1300. -- jdt.ls Java Language Server Startup Status: Ready
  1301. <
  1302. - If the above lines don't appear after a few minutes, check the jdt.ls and
  1303. ycmd log files using |:YcmToggleLogs|. The jdt.ls log file is called '.log'
  1304. (for some reason).
  1305. If you get a message about "classpath is incomplete", then make sure you have
  1306. correctly configured the project files.
  1307. If you get messages about unresolved imports, then make sure you have correctly
  1308. configured the project files, in particular check that the classpath is set
  1309. correctly.
  1310. -------------------------------------------------------------------------------
  1311. *youcompleteme-c-semantic-completion*
  1312. C# Semantic Completion ~
  1313. YCM relies on OmniSharp-Roslyn [13] to provide completion and code navigation.
  1314. OmniSharp-Roslyn needs a solution file for a C# project and there are two ways
  1315. of letting YCM know about your solution files.
  1316. -------------------------------------------------------------------------------
  1317. *youcompleteme-automatically-discovered-solution-files*
  1318. Automatically discovered solution files ~
  1319. YCM will scan all parent directories of the file currently being edited and
  1320. look for file with '.sln' extension.
  1321. -------------------------------------------------------------------------------
  1322. *youcompleteme-manually-specified-solution-files*
  1323. Manually specified solution files ~
  1324. If YCM loads '.ycm_extra_conf.py' which contains 'CSharpSolutionFile' function,
  1325. YCM will try to use that to determine the solution file. This is useful when
  1326. one wants to override the default behaviour and specify a solution file that is
  1327. not in any of the parent directories of the currently edited file. Example:
  1328. >
  1329. def CSharpSolutionFile( filepath ):
  1330. # `filepath` is the path of the file user is editing
  1331. return '/path/to/solution/file' # Can be relative to the `.ycm_extra_conf.py`
  1332. <
  1333. If the path returned by 'CSharpSolutionFile' is not an actual file, YCM will
  1334. fall back to the other way of finding the file.
  1335. -------------------------------------------------------------------------------
  1336. *youcompleteme-python-semantic-completion*
  1337. Python Semantic Completion ~
  1338. YCM relies on the Jedi [12] engine to provide completion and code navigation.
  1339. By default, it will pick the version of Python running the ycmd server [44] and
  1340. use its 'sys.path'. While this is fine for simple projects, this needs to be
  1341. configurable when working with virtual environments or in a project with
  1342. third-party packages. The next sections explain how to do that.
  1343. -------------------------------------------------------------------------------
  1344. *youcompleteme-working-with-virtual-environments*
  1345. Working with virtual environments ~
  1346. A common practice when working on a Python project is to install its
  1347. dependencies in a virtual environment and develop the project inside that
  1348. environment. To support this, YCM needs to know the interpreter path of the
  1349. virtual environment. You can specify it by creating a '.ycm_extra_conf.py' file
  1350. at the root of your project with the following contents:
  1351. >
  1352. def Settings( **kwargs ):
  1353. return {
  1354. 'interpreter_path': '/path/to/virtual/environment/python'
  1355. }
  1356. <
  1357. Here, '/path/to/virtual/environment/python' is the path to the Python used by
  1358. the virtual environment you are working in. Typically, the executable can be
  1359. found in the 'Scripts' folder of the virtual environment directory on Windows
  1360. and in the 'bin' folder on other platforms.
  1361. If you don't like having to create a '.ycm_extra_conf.py' file at the root of
  1362. your project and would prefer to specify the interpreter path with a Vim
  1363. option, read the Configuring through Vim options section.
  1364. -------------------------------------------------------------------------------
  1365. *youcompleteme-working-with-third-party-packages*
  1366. Working with third-party packages ~
  1367. Another common practice is to put the dependencies directly into the project
  1368. and add their paths to 'sys.path' at runtime in order to import them. YCM needs
  1369. to be told about this path manipulation to support those dependencies. This can
  1370. be done by creating a '.ycm_extra_conf.py' file at the root of the project.
  1371. This file must define a 'Settings( **kwargs )' function returning a dictionary
  1372. with the list of paths to prepend to 'sys.path' under the 'sys_path' key. For
  1373. instance, the following '.ycm_extra_conf.py' adds the paths
  1374. '/path/to/some/third_party/package' and '/path/to/another/third_party/package'
  1375. at the start of 'sys.path':
  1376. >
  1377. def Settings( **kwargs ):
  1378. return {
  1379. 'sys_path': [
  1380. '/path/to/some/third_party/package',
  1381. '/path/to/another/third_party/package'
  1382. ]
  1383. }
  1384. <
  1385. If you would rather prepend paths to 'sys.path' with a Vim option, read the
  1386. Configuring through Vim options section.
  1387. If you need further control on how to add paths to 'sys.path', you should
  1388. define the 'PythonSysPath( **kwargs )' function in the '.ycm_extra_conf.py'
  1389. file. Its keyword arguments are 'sys_path' which contains the default
  1390. 'sys.path', and 'interpreter_path' which is the path to the Python interpreter.
  1391. Here's a trivial example that insert the '/path/to/third_party/package' path at
  1392. the second position of 'sys.path':
  1393. >
  1394. def PythonSysPath( **kwargs ):
  1395. sys_path = kwargs[ 'sys_path' ]
  1396. sys_path.insert( 1, '/path/to/third_party/package' )
  1397. return sys_path
  1398. <
  1399. A more advanced example can be found in YCM's own '.ycm_extra_conf.py' [68].
  1400. -------------------------------------------------------------------------------
  1401. *youcompleteme-configuring-through-vim-options*
  1402. Configuring through Vim options ~
  1403. You may find inconvenient to have to create a '.ycm_extra_conf.py' file at the
  1404. root of each one of your projects in order to set the path to the Python
  1405. interpreter and/or add paths to 'sys.path' and would prefer to be able to
  1406. configure those through Vim options. Don't worry, this is possible by using the
  1407. |g:ycm_extra_conf_vim_data| option and creating a global extra configuration
  1408. file. Let's take an example. Suppose that you want to set the interpreter path
  1409. with the 'g:ycm_python_interpreter_path' option and prepend paths to 'sys.path'
  1410. with the 'g:ycm_python_sys_path' option. Suppose also that you want to name the
  1411. global extra configuration file 'global_extra_conf.py' and that you want to put
  1412. it in your HOME folder. You should then add the following lines to your vimrc:
  1413. >
  1414. let g:ycm_python_interpreter_path = ''
  1415. let g:ycm_python_sys_path = []
  1416. let g:ycm_extra_conf_vim_data = [
  1417. \ 'g:ycm_python_interpreter_path',
  1418. \ 'g:ycm_python_sys_path'
  1419. \]
  1420. let g:ycm_global_ycm_extra_conf = '~/global_extra_conf.py'
  1421. <
  1422. Then, create the '~/global_extra_conf.py' file with the following contents:
  1423. >
  1424. def Settings( **kwargs ):
  1425. client_data = kwargs[ 'client_data' ]
  1426. return {
  1427. 'interpreter_path': client_data[ 'g:ycm_python_interpreter_path' ],
  1428. 'sys_path': client_data[ 'g:ycm_python_sys_path' ]
  1429. }
  1430. <
  1431. That's it. You are done. Note that you don't need to restart the server when
  1432. setting one of the options. YCM will automatically pick the new values.
  1433. -------------------------------------------------------------------------------
  1434. *youcompleteme-rust-semantic-completion*
  1435. Rust Semantic Completion ~
  1436. YCM uses rust-analyzer [16] for Rust semantic completion.
  1437. NOTE: Previously, YCM used rls [69] for rust completion. This is no longer
  1438. supported, as the Rust community has decided on rust-analyzer [16] as the
  1439. future of Rust tooling.
  1440. Completions and GoTo commands within the current crate and its dependencies
  1441. should work out of the box with no additional configuration (provided that you
  1442. built YCM with the '--rust-completer' flag; see the _Installation_ section for
  1443. details). The install script takes care of installing the Rust source code
  1444. [70], so no configuration is necessary.
  1445. 'rust-analyzer' supports a myriad of options. These are configured using LSP
  1446. configuration, and are documented here [71].
  1447. -------------------------------------------------------------------------------
  1448. *youcompleteme-go-semantic-completion*
  1449. Go Semantic Completion ~
  1450. Completions and GoTo commands should work out of the box (provided that you
  1451. built YCM with the '--go-completer' flag; see the _Installation_ section for
  1452. details). The server only works for projects with the "canonical" layout.
  1453. 'gopls' also has a load of documented options [72].
  1454. You can set these in your '.ycm_extra_conf.py'. For example, to set the build
  1455. tags:
  1456. >
  1457. def Settings( **kwargs ):
  1458. if kwargs[ 'language' ] == 'go':
  1459. return {
  1460. 'ls': {
  1461. 'build.buildFlags': [ '-tags=debug' ] }
  1462. }
  1463. }
  1464. <
  1465. -------------------------------------------------------------------------------
  1466. *youcompleteme-javascript-typescript-semantic-completion*
  1467. JavaScript and TypeScript Semantic Completion ~
  1468. **NOTE:** YCM originally used the Tern [73] engine for JavaScript but due to
  1469. Tern [73] not being maintained anymore by its main author and the TSServer [15]
  1470. engine offering more features, YCM is moving to TSServer [15]. This won't
  1471. affect you if you were already using Tern [73] but you are encouraged to do the
  1472. switch by deleting the 'third_party/ycmd/third_party/tern_runtime/node_modules'
  1473. directory in YCM folder. If you are a new user but still want to use Tern [73],
  1474. you should pass the '--js-completer' option to the 'install.py' script during
  1475. installation. Further instructions on how to setup YCM with Tern [73] are
  1476. available on the wiki [74].
  1477. All JavaScript and TypeScript features are provided by the TSServer [15]
  1478. engine, which is included in the TypeScript SDK. To enable these features,
  1479. install Node.js and npm [32] and call the 'install.py' script with the
  1480. '--ts-completer' flag.
  1481. TSServer [15] relies on the 'jsconfig.json' file [75] for JavaScript and the
  1482. 'tsconfig.json' file [76] for TypeScript to analyze your project. Ensure the
  1483. file exists at the root of your project.
  1484. To get diagnostics in JavaScript, set the 'checkJs' option to 'true' in your
  1485. 'jsconfig.json' file:
  1486. >
  1487. {
  1488. "compilerOptions": {
  1489. "checkJs": true
  1490. }
  1491. }
  1492. <
  1493. -------------------------------------------------------------------------------
  1494. *youcompleteme-semantic-completion-for-other-languages*
  1495. Semantic Completion for Other Languages ~
  1496. C-family, C#, Go, Java, Python, Rust, and JavaScript/TypeScript languages are
  1497. supported natively by YouCompleteMe using the Clang [77], OmniSharp-Roslyn
  1498. [13], Gopls [14], jdt.ls [17], Jedi [12], rust-analyzer [16], and TSServer [15]
  1499. engines, respectively. Check the installation section for instructions to
  1500. enable these features if desired.
  1501. -------------------------------------------------------------------------------
  1502. *youcompleteme-plugging-an-arbitrary-lsp-server*
  1503. Plugging an arbitrary LSP server ~
  1504. Similar to other LSP clients, YCM can use an arbitrary LSP server with the help
  1505. of |g:ycm_language_server| option. An example of a value of this option would
  1506. be:
  1507. >
  1508. let g:ycm_language_server =
  1509. \ [
  1510. \ {
  1511. \ 'name': 'yaml',
  1512. \ 'cmdline': [ '/path/to/yaml/server/yaml-language-server', '--stdio' ],
  1513. \ 'filetypes': [ 'yaml' ]
  1514. \ },
  1515. \ {
  1516. \ 'name': 'rust',
  1517. \ 'cmdline': [ 'ra_lsp_server' ],
  1518. \ 'filetypes': [ 'rust' ],
  1519. \ 'project_root_files': [ 'Cargo.toml' ]
  1520. \ },
  1521. \ {
  1522. \ 'name': 'godot',
  1523. \ 'filetypes': [ 'gdscript' ],
  1524. \ 'port': 6008,
  1525. \ 'project_root_files': [ 'project.godot' ]
  1526. \ }
  1527. \ ]
  1528. <
  1529. Each dictionary contains the following keys:
  1530. - 'name' (string, mandatory): When configuring a LSP server the value of the
  1531. 'name' key will be used as the "kwargs[ 'language' ]". Can be anything you
  1532. like.
  1533. - 'filetypes' (list of string, mandatory): List of Vim filetypes this server
  1534. should be used for.
  1535. - 'project_root_files' (list of string, optional): List of filenames to
  1536. search for when trying to determine the project root.
  1537. - 'cmdline' (list of string, optional): If supplied, the server is started
  1538. with this command line (each list element is a command line word).
  1539. Typically, the server should be started with STDIO communication. If not
  1540. supplied, 'port' must be supplied.
  1541. - 'port' (number, optional): If supplied, ycmd will connect to the server at
  1542. 'localhost:<port>' using TCP (remote servers are not supported).
  1543. - 'capabilities' (dict, optional): If supplied, this is a dictionary that is
  1544. merged with the LSP client capabilities reported to the language server.
  1545. This can be used to enable or disable certain features, such as the support
  1546. for configuration sections ('workspace/configuration').
  1547. See the LSP Examples [78] project for more examples of configuring the likes of
  1548. PHP, Ruby, Kotlin, and D.
  1549. -------------------------------------------------------------------------------
  1550. *youcompleteme-lsp-configuration*
  1551. LSP Configuration ~
  1552. Many LSP servers allow some level of user configuration. YCM enables this with
  1553. the help of '.ycm_extra_conf.py' files. Here's an example of jdt.ls user
  1554. examples of configuring the likes of PHP, Ruby, Kotlin, D, and many, many more.
  1555. >
  1556. def Settings( **kwargs ):
  1557. if kwargs[ 'language' ] == 'java':
  1558. return {
  1559. 'ls': {
  1560. 'java.format.onType.enabled': True
  1561. }
  1562. }
  1563. <
  1564. The 'ls' key tells YCM that the dictionary should be passed to the LSP server.
  1565. For each of the LSP server's configuration you should look up the respective
  1566. server's documentation.
  1567. Some servers request settings from arbitrary 'sections' of configuration. There
  1568. is no concept of configuration sections in Vim, so you can specify an
  1569. additional 'config_sections' dictionary which maps section to a dictionary of
  1570. config required by the server. For example:
  1571. >
  1572. def Settings( **kwargs ):
  1573. if kwargs[ 'language' ] == 'java':
  1574. return {
  1575. 'ls': {
  1576. 'java.format.onType.enabled': True
  1577. },
  1578. 'config_sections': {
  1579. 'some section': {
  1580. 'some option': 'some value'
  1581. }
  1582. }
  1583. <
  1584. The sections and options/values are complete server-specific and rarely well
  1585. documented.
  1586. -------------------------------------------------------------------------------
  1587. *youcompleteme-using-omnifunc-for-semantic-completion*
  1588. Using 'omnifunc' for semantic completion ~
  1589. YCM will use your 'omnifunc' (see ':h omnifunc' in Vim) as a source for
  1590. semantic completions if it does not have a native semantic completion engine
  1591. for your file's filetype. Vim comes with rudimentary omnifuncs for various
  1592. languages like Ruby, PHP, etc. It depends on the language.
  1593. You can get a stellar omnifunc for Ruby with Eclim [79]. Just make sure you
  1594. have the _latest_ Eclim installed and configured (this means Eclim '>= 2.2.*'
  1595. and Eclipse '>= 4.2.*').
  1596. After installing Eclim remember to create a new Eclipse project within your
  1597. application by typing ':ProjectCreate <path-to-your-project> -n ruby' inside
  1598. Vim and don't forget to have "let g:EclimCompletionMethod = 'omnifunc'" in your
  1599. vimrc. This will make YCM and Eclim play nice; YCM will use Eclim's omnifuncs
  1600. as the data source for semantic completions and provide the auto-triggering and
  1601. subsequence-based matching (and other YCM features) on top of it.
  1602. -------------------------------------------------------------------------------
  1603. *youcompleteme-writing-new-semantic-completers*
  1604. Writing New Semantic Completers ~
  1605. You have two options here: writing an 'omnifunc' for Vim's omnicomplete system
  1606. that YCM will then use through its omni-completer, or a custom completer for
  1607. YCM using the Completer API [80].
  1608. Here are the differences between the two approaches:
  1609. - You have to use VimScript to write the omnifunc, but get to use Python to
  1610. write for the Completer API; this by itself should make you want to use the
  1611. API.
  1612. - The Completer API is a _much_ more powerful way to integrate with YCM and
  1613. it provides a wider set of features. For instance, you can make your
  1614. Completer query your semantic back-end in an asynchronous fashion, thus not
  1615. blocking Vim's GUI thread while your completion system is processing stuff.
  1616. This is impossible with VimScript. All of YCM's completers use the
  1617. Completer API.
  1618. - Performance with the Completer API is better since Python executes faster
  1619. than VimScript.
  1620. If you want to use the 'omnifunc' system, see the relevant Vim docs with ':h
  1621. complete-functions'. For the Completer API, see the API docs [80].
  1622. If you want to upstream your completer into YCM's source, you should use the
  1623. Completer API.
  1624. -------------------------------------------------------------------------------
  1625. *youcompleteme-diagnostic-display*
  1626. Diagnostic Display ~
  1627. YCM will display diagnostic notifications for the C-family, C#, Go, Java,
  1628. JavaScript, Rust and TypeScript languages. Since YCM continuously recompiles
  1629. your file as you type, you'll get notified of errors and warnings in your file
  1630. as fast as possible.
  1631. Here are the various pieces of the diagnostic UI:
  1632. - Icons show up in the Vim gutter on lines that have a diagnostic.
  1633. - Regions of text related to diagnostics are highlighted (by default, a red
  1634. wavy underline in 'gvim' and a red background in 'vim').
  1635. - Moving the cursor to a line with a diagnostic echoes the diagnostic text.
  1636. - Vim's location list is automatically populated with diagnostic data (off by
  1637. default, see options).
  1638. The new diagnostics (if any) will be displayed the next time you press any key
  1639. on the keyboard. So if you stop typing and just wait for the new diagnostics to
  1640. come in, that _will not work_. You need to press some key for the GUI to
  1641. update.
  1642. Having to press a key to get the updates is unfortunate, but cannot be changed
  1643. due to the way Vim internals operate; there is no way that a background task
  1644. can update Vim's GUI after it has finished running. You _have to_ press a key.
  1645. This will make YCM check for any pending diagnostics updates.
  1646. You _can_ force a full, blocking compilation cycle with the
  1647. |:YcmForceCompileAndDiagnostics| command (you may want to map that command to a
  1648. key; try putting 'nnoremap <F5> :YcmForceCompileAndDiagnostics<CR>' in your
  1649. vimrc). Calling this command will force YCM to immediately recompile your file
  1650. and display any new diagnostics it encounters. Do note that recompilation with
  1651. this command may take a while and during this time the Vim GUI _will_ be
  1652. blocked.
  1653. YCM will display a short diagnostic message when you move your cursor to the
  1654. line with the error. You can get a detailed diagnostic message with the
  1655. '<leader>d' key mapping (can be changed in the options) YCM provides when your
  1656. cursor is on the line with the diagnostic.
  1657. You can also see the full diagnostic message for all the diagnostics in the
  1658. current file in Vim's 'locationlist', which can be opened with the ':lopen' and
  1659. ':lclose' commands (make sure you have set 'let
  1660. g:ycm_always_populate_location_list = 1' in your vimrc). A good way to toggle
  1661. the display of the 'locationlist' with a single key mapping is provided by
  1662. another (very small) Vim plugin called ListToggle [81] (which also makes it
  1663. possible to change the height of the 'locationlist' window), also written by
  1664. yours truly.
  1665. -------------------------------------------------------------------------------
  1666. *youcompleteme-diagnostic-highlighting-groups*
  1667. Diagnostic Highlighting Groups ~
  1668. You can change the styling for the highlighting groups YCM uses. For the signs
  1669. in the Vim gutter, the relevant groups are:
  1670. - 'YcmErrorSign', which falls back to group 'SyntasticErrorSign' and then
  1671. 'error' if they exist
  1672. - 'YcmWarningSign', which falls back to group 'SyntasticWarningSign' and then
  1673. 'todo' if they exist
  1674. You can also style the line that has the warning/error with these groups:
  1675. - 'YcmErrorLine', which falls back to group 'SyntasticErrorLine' if it exists
  1676. - 'YcmWarningLine', which falls back to group 'SyntasticWarningLine' if it
  1677. exists
  1678. Finally, you can also style the popup for the detailed diagnostics (it is shown
  1679. if |g:ycm_show_detailed_diag_in_popup| is set) using the group 'YcmErrorPopup',
  1680. which falls back to 'ErrorMsg'.
  1681. Note that the line highlighting groups only work when the
  1682. |g:ycm_enable_diagnostic_signs| option is set. If you want highlighted lines
  1683. but no signs in the Vim gutter, set the 'signcolumn' option to 'no' in your
  1684. vimrc:
  1685. >
  1686. set signcolumn=no
  1687. <
  1688. The syntax groups used to highlight regions of text with errors/warnings: -
  1689. 'YcmErrorSection', which falls back to group 'SyntasticError' if it exists and
  1690. then 'SpellBad' - 'YcmWarningSection', which falls back to group
  1691. 'SyntasticWarning' if it exists and then 'SpellCap'
  1692. Here's how you'd change the style for a group:
  1693. >
  1694. highlight YcmErrorLine guibg=#3f0000
  1695. <
  1696. -------------------------------------------------------------------------------
  1697. *youcompleteme-symbol-search*
  1698. Symbol Search ~
  1699. **_This feature requires Vim and is not supported in Neovim_**
  1700. YCM provides a way to search for and jump to a symbol in the current project or
  1701. document when using supported languages.
  1702. You can search for symbols in the current workspace when the 'GoToSymbol'
  1703. request is supported and the current document when |GoToDocumentOutline| is
  1704. supported.
  1705. Here's a quick demo:
  1706. Image: asciicast [82]
  1707. As you can see, you can type and YCM filters down the list as you type. The
  1708. current set of matches are displayed in a popup window in the centre of the
  1709. screen and you can select an entry with the keyboard, to jump to that position.
  1710. Any matches are then added to the quickfix list.
  1711. To enable:
  1712. - 'nmap <something> <Plug>(YCMFindSymbolInWorkspace)'
  1713. - 'nmap <something> <Plug>(YCMFindSymbolInDocument)'
  1714. e.g.
  1715. - 'nmap <leader>yfw <Plug>(YCMFindSymbolInWorkspace)'
  1716. - 'nmap <leader>yfd <Plug>(YCMFindSymbolInDocument)'
  1717. When searching, YCM opens a prompt buffer at the top of the screen for the
  1718. input, and puts you in insert mode. This means that you can hit '<Esc>' to go
  1719. into normal mode and use any other input commands that are supported in prompt
  1720. buffers. As you type characters, the search is updated.
  1721. Intially, results are queried from all open filetypes. You can hit '<C-f>' to
  1722. switch to just the current filetype while the popup is open.
  1723. While the popup is open, the following keys are intercepted:
  1724. - '<C-j>', '<Down>', '<C-n>', '<Tab>' - select the next item
  1725. - '<C-k>', '<Up>', '<C-p>', '<S-Tab>' - select the previous item
  1726. - '<PageUp>', '<kPageUp>' - jump up one screenful of items
  1727. - '<PageDown>', '<kPageDown>' - jump down one screenful of items
  1728. - '<Home>', '<kHome>' - jump to first item
  1729. - '<End>', '<kEnd>' - jump to last item
  1730. - '<CR>' - jump to the selected item
  1731. - '<C-c>' cancel/dismiss the popup
  1732. - '<C-f>' - toggle results from all file types or just the current filetype
  1733. The search is also cancelled if you leave the prompt buffer window at any time,
  1734. so you can use window commands '<C-w>...' for example.
  1735. -------------------------------------------------------------------------------
  1736. *youcompleteme-closing-popup*
  1737. Closing the popup ~
  1738. **_NOTE_**: Pressing '<Esc>' does not close the popup - you must use 'Ctrl-c'
  1739. for that, or use a window command (e.g. '<Ctrl-w>j') or the mouse to leave the
  1740. prompt buffer window.
  1741. -------------------------------------------------------------------------------
  1742. *youcompleteme-commands*
  1743. Commands ~
  1744. -------------------------------------------------------------------------------
  1745. The *:YcmRestartServer* command
  1746. If the ycmd completion server [44] suddenly stops for some reason, you can
  1747. restart it with this command.
  1748. -------------------------------------------------------------------------------
  1749. The *:YcmForceCompileAndDiagnostics* command
  1750. Calling this command will force YCM to immediately recompile your file and
  1751. display any new diagnostics it encounters. Do note that recompilation with this
  1752. command may take a while and during this time the Vim GUI _will_ be blocked.
  1753. You may want to map this command to a key; try putting 'nnoremap <F5>
  1754. :YcmForceCompileAndDiagnostics<CR>' in your vimrc.
  1755. -------------------------------------------------------------------------------
  1756. The *:YcmDiags* command
  1757. Calling this command will fill Vim's 'locationlist' with errors or warnings if
  1758. any were detected in your file and then open it. If a given error or warning
  1759. can be fixed by a call to ':YcmCompleter FixIt', then '(FixIt available)' is
  1760. appended to the error or warning text. See the |FixIt| completer subcommand for
  1761. more information.
  1762. **NOTE:** The absence of '(FixIt available)' does not strictly imply a fix-it
  1763. is not available as not all completers are able to provide this indication. For
  1764. example, the c-sharp completer provides many fix-its but does not add this
  1765. additional indication.
  1766. The |g:ycm_open_loclist_on_ycm_diags| option can be used to prevent the
  1767. location list from opening, but still have it filled with new diagnostic data.
  1768. See the _Options_ section for details.
  1769. -------------------------------------------------------------------------------
  1770. The *:YcmShowDetailedDiagnostic* command
  1771. This command shows the full diagnostic text when the user's cursor is on the
  1772. line with the diagnostic.
  1773. An options argument can be passed. If the argument is 'popup' the diagnostic
  1774. text will be displayed in a popup at cursor position.
  1775. If you prefer the detailed diagnostic to always be shown in a popup, then 'let
  1776. g:ycm_show_detailed_diag_in_popup=1'.
  1777. -------------------------------------------------------------------------------
  1778. The *:YcmDebugInfo* command
  1779. This will print out various debug information for the current file. Useful to
  1780. see what compile commands will be used for the file if you're using the
  1781. semantic completion engine.
  1782. -------------------------------------------------------------------------------
  1783. The *:YcmToggleLogs* command
  1784. This command presents the list of logfiles created by YCM, the ycmd server
  1785. [44], and the semantic engine server for the current filetype, if any. One of
  1786. these logfiles can be opened in the editor (or closed if already open) by
  1787. entering the corresponding number or by clicking on it with the mouse.
  1788. Additionally, this command can take the logfile names as arguments. Use the
  1789. '<TAB>' key (or any other key defined by the 'wildchar' option) to complete the
  1790. arguments or to cycle through them (depending on the value of the 'wildmode'
  1791. option). Each logfile given as an argument is directly opened (or closed if
  1792. already open) in the editor. Only for debugging purposes.
  1793. -------------------------------------------------------------------------------
  1794. The *:YcmCompleter* command
  1795. This command gives access to a number of additional IDE-like features in YCM,
  1796. for things like semantic GoTo, type information, FixIt and refactoring.
  1797. This command accepts a range that can either be specified through a selection
  1798. in one of Vim's visual modes (see ':h visual-use') or on the command line. For
  1799. instance, ':2,5YcmCompleter' will apply the command from line 2 to line 5. This
  1800. is useful for the |Format| subcommand.
  1801. Call 'YcmCompleter' without further arguments for a list of the commands you
  1802. can call for the current completer.
  1803. See the file type feature summary for an overview of the features available for
  1804. each file type. See the _YcmCompleter subcommands_ section for more information
  1805. on the available subcommands and their usage.
  1806. Some commands, like |Format| accept a range, like ':%YcmCompleter Format'.
  1807. Some commands like |GetDoc| and the various |GoTo| commands respect modifiers,
  1808. like ':rightbelow YcmCompleter GetDoc', ':vertical YcmCompleter GoTo'.
  1809. -------------------------------------------------------------------------------
  1810. *youcompleteme-ycmcompleter-subcommands*
  1811. YcmCompleter Subcommands ~
  1812. **NOTE:** See the docs for the 'YcmCompleter' command before tackling this
  1813. section.
  1814. The invoked subcommand is automatically routed to the currently active semantic
  1815. completer, so ':YcmCompleter GoToDefinition' will invoke the |GoToDefinition|
  1816. subcommand on the Python semantic completer if the currently active file is a
  1817. Python one and on the Clang completer if the currently active file is a
  1818. C-family language one.
  1819. You may also want to map the subcommands to something less verbose; for
  1820. instance, 'nnoremap <leader>jd :YcmCompleter GoTo<CR>' maps the '<leader>jd'
  1821. sequence to the longer subcommand invocation.
  1822. -------------------------------------------------------------------------------
  1823. *youcompleteme-goto-commands*
  1824. GoTo Commands ~
  1825. These commands are useful for jumping around and exploring code. When moving
  1826. the cursor, the subcommands add entries to Vim's 'jumplist' so you can use
  1827. 'CTRL-O' to jump back to where you were before invoking the command (and
  1828. 'CTRL-I' to jump forward; see ':h jumplist' for details). If there is more than
  1829. one destination, the quickfix list (see ':h quickfix') is populated with the
  1830. available locations and opened to full width at the bottom of the screen. You
  1831. can change this behavior by using the |YcmQuickFixOpened| autocommand.
  1832. -------------------------------------------------------------------------------
  1833. The *GoToInclude* subcommand
  1834. Looks up the current line for a header and jumps to it.
  1835. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1836. -------------------------------------------------------------------------------
  1837. The *GoToAlternateFile* subcommand
  1838. Jump to the associated file, as defined by the language server. Typically this
  1839. will jump you to the associated header file for a c or c++ translation unit.
  1840. Supported in filetypes: 'c, cpp, objc, objcpp, cuda' (clangd only)
  1841. -------------------------------------------------------------------------------
  1842. The *GoToDeclaration* subcommand
  1843. Looks up the symbol under the cursor and jumps to its declaration.
  1844. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  1845. python, rust, typescript'
  1846. -------------------------------------------------------------------------------
  1847. The *GoToDefinition* subcommand
  1848. Looks up the symbol under the cursor and jumps to its definition.
  1849. **NOTE:** For C-family languages **this only works in certain situations**,
  1850. namely when the definition of the symbol is in the current translation unit. A
  1851. translation unit consists of the file you are editing and all the files you are
  1852. including with '#include' directives (directly or indirectly) in that file.
  1853. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  1854. python, rust, typescript'
  1855. -------------------------------------------------------------------------------
  1856. The *GoTo* subcommand
  1857. This command tries to perform the "most sensible" GoTo operation it can.
  1858. Currently, this means that it tries to look up the symbol under the cursor and
  1859. jumps to its definition if possible; if the definition is not accessible from
  1860. the current translation unit, jumps to the symbol's declaration. For C-family
  1861. languages, it first tries to look up the current line for a header and jump to
  1862. it. For C#, implementations are also considered and preferred.
  1863. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  1864. python, rust, typescript'
  1865. -------------------------------------------------------------------------------
  1866. The *GoToImprecise* subcommand
  1867. WARNING: This command trades correctness for speed!
  1868. Same as the |GoTo| command except that it doesn't recompile the file with
  1869. libclang before looking up nodes in the AST. This can be very useful when
  1870. you're editing files that take long to compile but you know that you haven't
  1871. made any changes since the last parse that would lead to incorrect jumps. When
  1872. you're just browsing around your codebase, this command can spare you quite a
  1873. bit of latency.
  1874. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1875. -------------------------------------------------------------------------------
  1876. *GoToSymbol-symbol-query*
  1877. The 'GoToSymbol <symbol query>' subcommand ~
  1878. Finds the definition of all symbols matching a specified string. Note that this
  1879. does not use any sort of smart/fuzzy matching. However, an interactive symbol
  1880. search is also available.
  1881. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, java, javascript,
  1882. python, typescript'
  1883. -------------------------------------------------------------------------------
  1884. The *GoToReferences* subcommand
  1885. This command attempts to find all of the references within the project to the
  1886. identifier under the cursor and populates the quickfix list with those
  1887. locations.
  1888. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, java, javascript, python,
  1889. typescript, rust'
  1890. -------------------------------------------------------------------------------
  1891. The *GoToImplementation* subcommand
  1892. Looks up the symbol under the cursor and jumps to its implementation (i.e.
  1893. non-interface). If there are multiple implementations, instead provides a list
  1894. of implementations to choose from.
  1895. Supported in filetypes: 'cs, go, java, rust, typescript, javascript'
  1896. -------------------------------------------------------------------------------
  1897. The *GoToImplementationElseDeclaration* subcommand
  1898. Looks up the symbol under the cursor and jumps to its implementation if one,
  1899. else jump to its declaration. If there are multiple implementations, instead
  1900. provides a list of implementations to choose from.
  1901. Supported in filetypes: 'cs'
  1902. -------------------------------------------------------------------------------
  1903. The *GoToType* subcommand
  1904. Looks up the symbol under the cursor and jumps to the definition of its type
  1905. e.g. if the symbol is an object, go to the definition of its class.
  1906. Supported in filetypes: 'go, java, javascript, typescript'
  1907. -------------------------------------------------------------------------------
  1908. The *GoToDocumentOutline* subcommand
  1909. Provides a list of symbols in current document, in the quickfix list. See also
  1910. interactive symbol search.
  1911. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, go, java, rust'
  1912. -------------------------------------------------------------------------------
  1913. The *GoToCallers* and 'GoToCallees' subcommands
  1914. Populate the quickfix list with the callers, or callees respectively, of the
  1915. function associated with the current cursor position. The semantics of this
  1916. differ depending on the filetype and language server.
  1917. Only supported for LSP servers which provide the 'callHierarchyProvider'
  1918. capability.
  1919. -------------------------------------------------------------------------------
  1920. *youcompleteme-semantic-information-commands*
  1921. Semantic Information Commands ~
  1922. These commands are useful for finding static information about the code, such
  1923. as the types of variables, viewing declarations and documentation strings.
  1924. -------------------------------------------------------------------------------
  1925. The *GetType* subcommand
  1926. Echos the type of the variable or method under the cursor, and where it
  1927. differs, the derived type.
  1928. For example:
  1929. >
  1930. std::string s;
  1931. <
  1932. Invoking this command on 's' returns 'std::string => std::basic_string<char>'
  1933. **NOTE:** Causes re-parsing of the current translation unit.
  1934. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, java, javascript, go,
  1935. python, typescript, rust'
  1936. -------------------------------------------------------------------------------
  1937. The *GetTypeImprecise* subcommand
  1938. WARNING: This command trades correctness for speed!
  1939. Same as the |GetType| command except that it doesn't recompile the file with
  1940. libclang before looking up nodes in the AST. This can be very useful when
  1941. you're editing files that take long to compile but you know that you haven't
  1942. made any changes since the last parse that would lead to incorrect type. When
  1943. you're just browsing around your codebase, this command can spare you quite a
  1944. bit of latency.
  1945. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1946. -------------------------------------------------------------------------------
  1947. The *GetParent* subcommand
  1948. Echos the semantic parent of the point under the cursor.
  1949. The semantic parent is the item that semantically contains the given position.
  1950. For example:
  1951. >
  1952. class C {
  1953. void f();
  1954. };
  1955. void C::f() {
  1956. }
  1957. <
  1958. In the out-of-line definition of 'C::f', the semantic parent is the class 'C',
  1959. of which this function is a member.
  1960. In the example above, both declarations of 'C::f' have 'C' as their semantic
  1961. context, while the lexical context of the first 'C::f' is 'C' and the lexical
  1962. context of the second 'C::f' is the translation unit.
  1963. For global declarations, the semantic parent is the translation unit.
  1964. **NOTE:** Causes re-parsing of the current translation unit.
  1965. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  1966. -------------------------------------------------------------------------------
  1967. The *GetDoc* subcommand
  1968. Displays the preview window populated with quick info about the identifier
  1969. under the cursor. Depending on the file type, this includes things like:
  1970. - The type or declaration of identifier,
  1971. - Doxygen/javadoc comments,
  1972. - Python docstrings,
  1973. - etc.
  1974. The documentation is opened in the preview window, and options like
  1975. 'previewheight' are respected. If you would like to customise the height and
  1976. position of this window, we suggest a custom command that:
  1977. - Sets 'previewheight' temporarily
  1978. - Runs the |GetDoc| command with supplied modifiers
  1979. - Restores 'previewheight'.
  1980. For example:
  1981. >
  1982. command -count ShowDocWithSize
  1983. \ let g:ph=&previewheight
  1984. \ <bar> set previewheight=<count>
  1985. \ <bar> <mods> YcmCompleter GetDoc
  1986. \ <bar> let &previewheight=g:ph
  1987. <
  1988. You can then use something like ':botright vertical 80ShowDocWithSize'. Here's
  1989. an example of that: https://asciinema.org/a/hE6Pi1gU6omBShwFna8iwGEe9
  1990. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  1991. python, typescript, rust'
  1992. -------------------------------------------------------------------------------
  1993. The *GetDocImprecise* subcommand
  1994. WARNING: This command trades correctness for speed!
  1995. Same as the |GetDoc| command except that it doesn't recompile the file with
  1996. libclang before looking up nodes in the AST. This can be very useful when
  1997. you're editing files that take long to compile but you know that you haven't
  1998. made any changes since the last parse that would lead to incorrect docs. When
  1999. you're just browsing around your codebase, this command can spare you quite a
  2000. bit of latency.
  2001. Supported in filetypes: 'c, cpp, objc, objcpp, cuda'
  2002. -------------------------------------------------------------------------------
  2003. *youcompleteme-refactoring-commands*
  2004. Refactoring Commands ~
  2005. These commands make changes to your source code in order to perform refactoring
  2006. or code correction. YouCompleteMe does not perform any action which cannot be
  2007. undone, and never saves or writes files to the disk.
  2008. -------------------------------------------------------------------------------
  2009. The *FixIt* subcommand
  2010. Where available, attempts to make changes to the buffer to correct diagnostics,
  2011. or perform refactoring, on the current line or selection. Where multiple
  2012. suggestions are available (such as when there are multiple ways to resolve a
  2013. given warning, or where multiple diagnostics are reported for the current line,
  2014. or multiple refactoring tweaks are available), the options are presented and
  2015. one can be selected.
  2016. Completers which provide diagnostics may also provide trivial modifications to
  2017. the source in order to correct the diagnostic. Examples include syntax errors
  2018. such as missing trailing semi-colons, spurious characters, or other errors
  2019. which the semantic engine can deterministically suggest corrections. A small
  2020. demo presenting how diagnostics can be fixed with clangd:
  2021. Image: YcmCompleter-FixIt-OnDiagnostic (see reference [84])
  2022. Completers (LSPs) may also provide refactoring tweaks, which may be available
  2023. even when no diagnostic is presented for the current line. These include
  2024. function extraction, variable extraction, 'switch' population, constructor
  2025. generation, ... The tweaks work for a selection as well. Consult your LSP for
  2026. available refactorings. A demonstration of refactoring capabilities with
  2027. clangd:
  2028. Image: YouCompleter-FixIt-Refactoring (see reference [85])
  2029. If no fix-it is available for the current line, or there is no diagnostic on
  2030. the current line, this command has no effect on the current buffer. If any
  2031. modifications are made, the number of changes made to the buffer is echo'd and
  2032. the user may use the editor's undo command to revert.
  2033. When a diagnostic is available, and |g:ycm_echo_current_diagnostic| is enabled,
  2034. then the text '(FixIt)' is appended to the echo'd diagnostic when the completer
  2035. is able to add this indication. The text '(FixIt available)' is also appended
  2036. to the diagnostic text in the output of the |:YcmDiags| command for any
  2037. diagnostics with available fix-its (where the completer can provide this
  2038. indication).
  2039. **NOTE:** Causes re-parsing of the current translation unit.
  2040. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  2041. rust, typescript'
  2042. -------------------------------------------------------------------------------
  2043. *RefactorRename-new-name*
  2044. The 'RefactorRename <new name>' subcommand ~
  2045. In supported file types, this command attempts to perform a semantic rename of
  2046. the identifier under the cursor. This includes renaming declarations,
  2047. definitions and usages of the identifier, or any other language-appropriate
  2048. action. The specific behavior is defined by the semantic engine in use.
  2049. Similar to |FixIt|, this command applies automatic modifications to your source
  2050. files. Rename operations may involve changes to multiple files, which may or
  2051. may not be open in Vim buffers at the time. YouCompleteMe handles all of this
  2052. for you. The behavior is described in the following section.
  2053. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, java, javascript, python,
  2054. typescript, rust, cs'
  2055. -------------------------------------------------------------------------------
  2056. *youcompleteme-python-refactorings*
  2057. Python refactorings ~
  2058. The following additional commands are supported for python:
  2059. - 'RefactorInline'
  2060. - 'RefactorExtractVariable'
  2061. - 'RefactorExtractFunction'
  2062. See the jedi docs [86] for what they do.
  2063. Supported in filetypes: 'python'
  2064. -------------------------------------------------------------------------------
  2065. *youcompleteme-multi-file-refactor*
  2066. Multi-file Refactor ~
  2067. When a Refactor or FixIt command touches multiple files, YouCompleteMe attempts
  2068. to apply those modifications to any existing open, visible buffer in the
  2069. current tab. If no such buffer can be found, YouCompleteMe opens the file in a
  2070. new small horizontal split at the top of the current window, applies the
  2071. change, and then _hides_ the window. **NOTE:** The buffer remains open, and
  2072. must be manually saved. A confirmation dialog is opened prior to doing this to
  2073. remind you that this is about to happen.
  2074. Once the modifications have been made, the quickfix list (see ':help quickfix')
  2075. is populated with the locations of all modifications. This can be used to
  2076. review all automatic changes made by using ':copen'. Typically, use the 'CTRL-W
  2077. <enter>' combination to open the selected file in a new split. It is possible
  2078. to customize how the quickfix window is opened by using the |YcmQuickFixOpened|
  2079. autocommand.
  2080. The buffers are _not_ saved automatically. That is, you must save the modified
  2081. buffers manually after reviewing the changes from the quickfix list. Changes
  2082. can be undone using Vim's powerful undo features (see ':help undo'). Note that
  2083. Vim's undo is per-buffer, so to undo all changes, the undo commands must be
  2084. applied in each modified buffer separately.
  2085. **NOTE:** While applying modifications, Vim may find files which are already
  2086. open and have a swap file. The command is aborted if you select Abort or Quit
  2087. in any such prompts. This leaves the Refactor operation partially complete and
  2088. must be manually corrected using Vim's undo features. The quickfix list is
  2089. _not_ populated in this case. Inspect ':buffers' or equivalent (see ':help
  2090. buffers') to see the buffers that were opened by the command.
  2091. -------------------------------------------------------------------------------
  2092. The *Format* subcommand
  2093. This command formats the whole buffer or some part of it according to the value
  2094. of the Vim options 'shiftwidth' and 'expandtab' (see ":h 'sw'" and ':h et'
  2095. respectively). To format a specific part of your document, you can either
  2096. select it in one of Vim's visual modes (see ':h visual-use') and run the
  2097. command or directly enter the range on the command line, e.g. ':2,5YcmCompleter
  2098. Format' to format it from line 2 to line 5.
  2099. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, java, javascript, go,
  2100. typescript, rust, cs'
  2101. -------------------------------------------------------------------------------
  2102. The *OrganizeImports* subcommand
  2103. This command removes unused imports and sorts imports in the current file. It
  2104. can also group imports from the same module in TypeScript and resolves imports
  2105. in Java.
  2106. Supported in filetypes: 'java, javascript, typescript'
  2107. -------------------------------------------------------------------------------
  2108. *youcompleteme-miscellaneous-commands*
  2109. Miscellaneous Commands ~
  2110. These commands are for general administration, rather than IDE-like features.
  2111. They cover things like the semantic engine server instance and compilation
  2112. flags.
  2113. -------------------------------------------------------------------------------
  2114. *ExecuteCommand-args*
  2115. The 'ExecuteCommand <args>' subcommand ~
  2116. Some LSP completers (currently only Java completers) support executing server
  2117. specific commands. Consult the jdt.ls [17] documentation to find out what
  2118. commands are supported and which arguments are expected.
  2119. The support for 'ExecuteCommand' was implemented to support plugins like
  2120. Vimspector [87] to debug java, but isn't limited to that specific use case.
  2121. -------------------------------------------------------------------------------
  2122. The *RestartServer* subcommand
  2123. Restarts the downstream semantic engine server for those semantic engines that
  2124. work as separate servers that YCM talks to.
  2125. Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
  2126. rust, typescript'
  2127. -------------------------------------------------------------------------------
  2128. The *ReloadSolution* subcommand
  2129. Instruct the Omnisharp-Roslyn server to clear its cache and reload all files
  2130. from disk. This is useful when files are added, removed, or renamed in the
  2131. solution, files are changed outside of Vim, or whenever Omnisharp-Roslyn cache
  2132. is out-of-sync.
  2133. Supported in filetypes: 'cs'
  2134. -------------------------------------------------------------------------------
  2135. *youcompleteme-functions*
  2136. Functions ~
  2137. -------------------------------------------------------------------------------
  2138. The *youcompleteme#GetErrorCount* function
  2139. Get the number of YCM Diagnostic errors. If no errors are present, this
  2140. function returns 0.
  2141. For example:
  2142. >
  2143. call youcompleteme#GetErrorCount()
  2144. <
  2145. Both this function and |youcompleteme#GetWarningCount| can be useful when
  2146. integrating YCM with other Vim plugins. For example, a lightline [88] user
  2147. could add a diagnostics section to their statusline which would display the
  2148. number of errors and warnings.
  2149. -------------------------------------------------------------------------------
  2150. The *youcompleteme#GetWarningCount* function
  2151. Get the number of YCM Diagnostic warnings. If no warnings are present, this
  2152. function returns 0.
  2153. For example:
  2154. >
  2155. call youcompleteme#GetWarningCount()
  2156. <
  2157. -------------------------------------------------------------------------------
  2158. *youcompleteme#GetCommandResponse()*
  2159. The 'youcompleteme#GetCommandResponse( ... )' function ~
  2160. Run a completer subcommand and return the result as a string. This can be
  2161. useful for example to display the 'GetGoc' output in a popup window, e.g.:
  2162. >
  2163. let s:ycm_hover_popup = -1
  2164. function s:Hover()
  2165. let response = youcompleteme#GetCommandResponse( 'GetDoc' )
  2166. if response == ''
  2167. return
  2168. endif
  2169. call popup_hide( s:ycm_hover_popup )
  2170. let s:ycm_hover_popup = popup_atcursor( balloon_split( response ), {} )
  2171. endfunction
  2172. " CursorHold triggers in normal mode after a delay
  2173. autocmd CursorHold * call s:Hover()
  2174. " Or, if you prefer, a mapping:
  2175. nnoremap <silent> <leader>D :call <SID>Hover()<CR>
  2176. <
  2177. **NOTE**: This is only an example, for real hover support, see
  2178. |g:ycm_auto_hover|.
  2179. If the completer subcommand result is not a string (for example, it's a FixIt
  2180. or a Location), or if the completer subcommand raises an error, an empty string
  2181. is returned, so that calling code does not have to check for complex error
  2182. conditions.
  2183. The arguments to the function are the same as the arguments to the
  2184. |:YcmCompleter| ex command, e.g. the name of the subcommand, followed by any
  2185. additional subcommand arguments. As with the 'YcmCompleter' command, if the
  2186. first argument is 'ft=<filetype>' the request is targeted at the specified
  2187. filetype completer. This is an advanced usage and not necessary in most cases.
  2188. NOTE: The request is run synchronously and blocks Vim until the response is
  2189. received, so we do not recommend running this as part of an autocommand that
  2190. triggers frequently.
  2191. -------------------------------------------------------------------------------
  2192. *youcompleteme#GetCommandResponseAsync()*
  2193. The 'youcompleteme#GetCommandResponseAsync( callback, ... )' function ~
  2194. This works exactly like 'youcompleteme#GetCommandResponse', except that instead
  2195. of returning the result, you supply a 'callback' argument. This argument must
  2196. be a 'FuncRef' to a function taking a single argument 'response'. This callback
  2197. will be called with the command response at some point later, or immediately.
  2198. As with |youcompleteme#GetCommandResponse()|, this function will call the
  2199. callback with "''" (an empty string) if the request is not sent, or if there
  2200. was some sort of error.
  2201. Here's an example that's similar to the one above:
  2202. >
  2203. let s:ycm_hover_popup = -1
  2204. function! s:ShowDataPopup( response ) abort
  2205. if response == ''
  2206. return
  2207. endif
  2208. call popup_hide( s:ycm_hover_popup )
  2209. let s:ycm_hover_popup = popup_atcursor( balloon_split( response ), {} )
  2210. endfunction
  2211. function! s:GetData() abort
  2212. call youcompleteme#GetCommandResponseAsync(
  2213. \ function( 's:ShowDataPopup' ),
  2214. \ 'GetDoc' )
  2215. endfunction
  2216. autocommand CursorHold * call s:GetData()
  2217. <
  2218. Again, see |g:ycm_auto_hover| for proper hover support.
  2219. **NOTE**: The callback may be called immediately, in the stack frame that
  2220. called this function.
  2221. **NOTE**: Only one command request can be outstanding at once. Attempting to
  2222. request a second responses while the first is outstanding will result in the
  2223. second callback being immediately called with "''".
  2224. -------------------------------------------------------------------------------
  2225. *youcompleteme-autocommands*
  2226. Autocommands ~
  2227. -------------------------------------------------------------------------------
  2228. The *YcmLocationOpened* autocommand
  2229. This 'User' autocommand is fired when YCM opens the location list window in
  2230. response to the 'YcmDiags' command. By default, the location list window is
  2231. opened to the bottom of the current window and its height is set to fit all
  2232. entries. This behavior can be overridden by using the |YcmLocationOpened|
  2233. autocommand which is triggered while the cursor is in the location list window.
  2234. For instance:
  2235. >
  2236. function! s:CustomizeYcmLocationWindow()
  2237. " Move the window to the top of the screen.
  2238. wincmd K
  2239. " Set the window height to 5.
  2240. 5wincmd _
  2241. " Switch back to working window.
  2242. wincmd p
  2243. endfunction
  2244. autocmd User YcmLocationOpened call s:CustomizeYcmLocationWindow()
  2245. <
  2246. -------------------------------------------------------------------------------
  2247. The *YcmQuickFixOpened* autocommand
  2248. This 'User' autocommand is fired when YCM opens the quickfix window in response
  2249. to the 'GoTo*' and 'RefactorRename' subcommands. By default, the quickfix
  2250. window is opened to full width at the bottom of the screen and its height is
  2251. set to fit all entries. This behavior can be overridden by using the
  2252. |YcmQuickFixOpened| autocommand which is triggered while the cursor is in the
  2253. quickfix window. For instance:
  2254. >
  2255. function! s:CustomizeYcmQuickFixWindow()
  2256. " Move the window to the top of the screen.
  2257. wincmd K
  2258. " Set the window height to 5.
  2259. 5wincmd _
  2260. endfunction
  2261. autocmd User YcmQuickFixOpened call s:CustomizeYcmQuickFixWindow()
  2262. <
  2263. -------------------------------------------------------------------------------
  2264. Options ~
  2265. All options have reasonable defaults so if the plug-in works after installation
  2266. you don't need to change any options. These options can be configured in your
  2267. vimrc script [37] by including a line like this:
  2268. >
  2269. let g:ycm_min_num_of_chars_for_completion = 1
  2270. <
  2271. Note that after changing an option in your vimrc script [37] you have to
  2272. restart ycmd [44] with the |:YcmRestartServer| command for the changes to take
  2273. effect.
  2274. -------------------------------------------------------------------------------
  2275. The *g:ycm_min_num_of_chars_for_completion* option
  2276. This option controls the number of characters the user needs to type before
  2277. identifier-based completion suggestions are triggered. For example, if the
  2278. option is set to '2', then when the user types a second alphanumeric character
  2279. after a whitespace character, completion suggestions will be triggered. This
  2280. option is NOT used for semantic completion.
  2281. Setting this option to a high number like '99' effectively turns off the
  2282. identifier completion engine and just leaves the semantic engine.
  2283. Default: '2'
  2284. >
  2285. let g:ycm_min_num_of_chars_for_completion = 2
  2286. <
  2287. -------------------------------------------------------------------------------
  2288. The *g:ycm_min_num_identifier_candidate_chars* option
  2289. This option controls the minimum number of characters that a completion
  2290. candidate coming from the identifier completer must have to be shown in the
  2291. popup menu.
  2292. A special value of '0' means there is no limit.
  2293. **NOTE:** This option only applies to the identifier completer; it has no
  2294. effect on the various semantic completers.
  2295. Default: '0'
  2296. >
  2297. let g:ycm_min_num_identifier_candidate_chars = 0
  2298. <
  2299. -------------------------------------------------------------------------------
  2300. The *g:ycm_max_num_candidates* option
  2301. This option controls the maximum number of semantic completion suggestions
  2302. shown in the completion menu. This only applies to suggestions from semantic
  2303. completion engines; see the 'g:ycm_max_identifier_candidates' option to limit
  2304. the number of suggestions from the identifier-based engine.
  2305. A special value of '0' means there is no limit.
  2306. **NOTE:** Setting this option to '0' or to a value greater than '100' is not
  2307. recommended as it will slow down completion when there are a very large number
  2308. of suggestions.
  2309. Default: '50'
  2310. >
  2311. let g:ycm_max_num_candidates = 50
  2312. <
  2313. -------------------------------------------------------------------------------
  2314. The *g:ycm_max_num_candidates_to_detail* option
  2315. Some completion engines require completion candidates to be 'resolved' in order
  2316. to get detailed info such as inline documentation, method signatures etc. This
  2317. information is displayed by YCM in the preview window, or if 'completeopt'
  2318. contains 'popup', in the info popup next to the completion menu.
  2319. By default, if the info popup is in use, and there are more than 10 candidates,
  2320. YCM will defer resolving candidates until they are selected in the completion
  2321. menu. Otherwise, YCM must resolve the details upfront, which can be costly.
  2322. If neither 'popup' nor 'preview' are in 'completeopt', YCM disables resolving
  2323. altogether as the information would not be displayed.
  2324. This setting can be used to override these defaults and controls the number of
  2325. completion candidates that should be resolved upfront. Typically users do not
  2326. need to change this, as YCM will work out an appropriate value based on your
  2327. 'completeopt' and |g:ycm_add_preview_to_completeopt| settings. However, you may
  2328. override this calculation by setting this value to a number:
  2329. - '-1' - Resolve all candidates up front
  2330. - '0' - Never resolve any candidates up front.
  2331. - '> 0' - Resolve up to this many candidates up front. If the number of
  2332. candidates is greater than this value, no candidates are resolved.
  2333. In the later two cases, if 'completeopt' contains 'popup', then candidates are
  2334. resolved on demand asynchronously.
  2335. Default:
  2336. - '0' if neither 'popup' nor 'preview' are in 'completeopt'.
  2337. - '10' if 'popup' is in completeopt.
  2338. - '-1' if 'preview' is in completeopt.
  2339. Example:
  2340. >
  2341. let g:ycm_max_num_candidates_to_detail = 0
  2342. <
  2343. -------------------------------------------------------------------------------
  2344. The *g:ycm_max_num_identifier_candidates* option
  2345. This option controls the maximum number of completion suggestions from the
  2346. identifier-based engine shown in the completion menu.
  2347. A special value of '0' means there is no limit.
  2348. **NOTE:** Setting this option to '0' or to a value greater than '100' is not
  2349. recommended as it will slow down completion when there are a very large number
  2350. of suggestions.
  2351. Default: '10'
  2352. >
  2353. let g:ycm_max_num_identifier_candidates = 10
  2354. <
  2355. -------------------------------------------------------------------------------
  2356. The *g:ycm_auto_trigger* option
  2357. When set to '0', this option turns off YCM's identifier completer (the
  2358. as-you-type popup) _and_ the semantic triggers (the popup you'd get after
  2359. typing '.' or '->' in say C++). You can still force semantic completion with
  2360. the '<C-Space>' shortcut.
  2361. If you want to just turn off the identifier completer but keep the semantic
  2362. triggers, you should set |g:ycm_min_num_of_chars_for_completion| to a high
  2363. number like '99'.
  2364. When |g:ycm_auto_trigger| is '0', YCM sets the 'completefunc', so that you can
  2365. manually trigger normal completion using 'C-x C-u'.
  2366. If you want to map something else to trigger completion, such as 'C-d``, then
  2367. you can map it to'(YCMComplete)`. For example:
  2368. >
  2369. let g:ycm_auto_trigger = 0
  2370. imap <c-d> <plug>(YCMComplete)
  2371. <
  2372. NOTE: It's not possible to map one of the keys in
  2373. |g:ycm_key_list_select_completion| (or similar) to '<plug>(YCMComplete)'. In
  2374. practice that means that you can't use '<Tab>' for this.
  2375. Default: '1'
  2376. >
  2377. let g:ycm_auto_trigger = 1
  2378. <
  2379. -------------------------------------------------------------------------------
  2380. The *g:ycm_filetype_whitelist* option
  2381. This option controls for which Vim filetypes (see ':h filetype') should YCM be
  2382. turned on. The option value should be a Vim dictionary with keys being filetype
  2383. strings (like 'python', 'cpp', etc.) and values being unimportant (the
  2384. dictionary is used like a hash set, meaning that only the keys matter).
  2385. The '*' key is special and matches all filetypes. By default, the whitelist
  2386. contains only this '*' key.
  2387. YCM also has a |g:ycm_filetype_blacklist| option that lists filetypes for which
  2388. YCM shouldn't be turned on. YCM will work only in filetypes that both the
  2389. whitelist and the blacklist allow (the blacklist "allows" a filetype by _not_
  2390. having it as a key).
  2391. For example, let's assume you want YCM to work in files with the 'cpp'
  2392. filetype. The filetype should then be present in the whitelist either directly
  2393. ('cpp' key in the whitelist) or indirectly through the special '*' key. It
  2394. should _not_ be present in the blacklist.
  2395. Filetypes that are blocked by the either of the lists will be completely
  2396. ignored by YCM, meaning that neither the identifier-based completion engine nor
  2397. the semantic engine will operate in them.
  2398. You can get the filetype of the current file in Vim with ':set ft?'.
  2399. Default: "{'*': 1}"
  2400. >
  2401. let g:ycm_filetype_whitelist = {'*': 1}
  2402. <
  2403. **Completion in buffers with no filetype**
  2404. There is one exception to the above rule. YCM supports completion in buffers
  2405. with no filetype set, but this must be _explicitly_ whitelisted. To identify
  2406. buffers with no filetype, we use the 'ycm_nofiletype' pseudo-filetype. To
  2407. enable completion in buffers with no filetype, set:
  2408. >
  2409. let g:ycm_filetype_whitelist = {
  2410. \ '*': 1,
  2411. \ 'ycm_nofiletype': 1
  2412. \ }
  2413. <
  2414. -------------------------------------------------------------------------------
  2415. The *g:ycm_filetype_blacklist* option
  2416. This option controls for which Vim filetypes (see ':h filetype') should YCM be
  2417. turned off. The option value should be a Vim dictionary with keys being
  2418. filetype strings (like 'python', 'cpp', etc.) and values being unimportant (the
  2419. dictionary is used like a hash set, meaning that only the keys matter).
  2420. See the |g:ycm_filetype_whitelist| option for more details on how this works.
  2421. Default: '[see next line]'
  2422. >
  2423. let g:ycm_filetype_blacklist = {
  2424. \ 'tagbar': 1,
  2425. \ 'notes': 1,
  2426. \ 'markdown': 1,
  2427. \ 'netrw': 1,
  2428. \ 'unite': 1,
  2429. \ 'text': 1,
  2430. \ 'vimwiki': 1,
  2431. \ 'pandoc': 1,
  2432. \ 'infolog': 1,
  2433. \ 'leaderf': 1,
  2434. \ 'mail': 1
  2435. \}
  2436. <
  2437. In addition, 'ycm_nofiletype' (representing buffers with no filetype set) is
  2438. blacklisted if 'ycm_nofiletype' is not _explicitly_ whitelisted (using
  2439. |g:ycm_filetype_whitelist|).
  2440. -------------------------------------------------------------------------------
  2441. The *g:ycm_filetype_specific_completion_to_disable* option
  2442. This option controls for which Vim filetypes (see ':h filetype') should the YCM
  2443. semantic completion engine be turned off. The option value should be a Vim
  2444. dictionary with keys being filetype strings (like 'python', 'cpp', etc.) and
  2445. values being unimportant (the dictionary is used like a hash set, meaning that
  2446. only the keys matter). The listed filetypes will be ignored by the YCM semantic
  2447. completion engine, but the identifier-based completion engine will still
  2448. trigger in files of those filetypes.
  2449. Note that even if semantic completion is not turned off for a specific
  2450. filetype, you will not get semantic completion if the semantic engine does not
  2451. support that filetype.
  2452. You can get the filetype of the current file in Vim with ':set ft?'.
  2453. Default: '[see next line]'
  2454. >
  2455. let g:ycm_filetype_specific_completion_to_disable = {
  2456. \ 'gitcommit': 1
  2457. \}
  2458. <
  2459. -------------------------------------------------------------------------------
  2460. The *g:ycm_filepath_blacklist* option
  2461. This option controls for which Vim filetypes (see ':h filetype') should
  2462. filepath completion be disabled. The option value should be a Vim dictionary
  2463. with keys being filetype strings (like 'python', 'cpp', etc.) and values being
  2464. unimportant (the dictionary is used like a hash set, meaning that only the keys
  2465. matter).
  2466. The '*' key is special and matches all filetypes. Use this key if you want to
  2467. completely disable filepath completion:
  2468. >
  2469. let g:ycm_filepath_blacklist = {'*': 1}
  2470. <
  2471. You can get the filetype of the current file in Vim with ':set ft?'.
  2472. Default: '[see next line]'
  2473. >
  2474. let g:ycm_filepath_blacklist = {
  2475. \ 'html': 1,
  2476. \ 'jsx': 1,
  2477. \ 'xml': 1,
  2478. \}
  2479. <
  2480. -------------------------------------------------------------------------------
  2481. The *g:ycm_show_diagnostics_ui* option
  2482. When set, this option turns on YCM's diagnostic display features. See the
  2483. _Diagnostic display_ section in the _User Manual_ for more details.
  2484. Specific parts of the diagnostics UI (like the gutter signs, text highlighting,
  2485. diagnostic echo and auto location list population) can be individually turned
  2486. on or off. See the other options below for details.
  2487. Note that YCM's diagnostics UI is only supported for C-family languages.
  2488. When set, this option also makes YCM remove all Syntastic checkers set for the
  2489. 'c', 'cpp', 'objc', 'objcpp', and 'cuda' filetypes since this would conflict
  2490. with YCM's own diagnostics UI.
  2491. If you're using YCM's identifier completer in C-family languages but cannot use
  2492. the clang-based semantic completer for those languages _and_ want to use the
  2493. GCC Syntastic checkers, unset this option.
  2494. Default: '1'
  2495. >
  2496. let g:ycm_show_diagnostics_ui = 1
  2497. <
  2498. -------------------------------------------------------------------------------
  2499. The *g:ycm_error_symbol* option
  2500. YCM will use the value of this option as the symbol for errors in the Vim
  2501. gutter.
  2502. This option is part of the Syntastic compatibility layer; if the option is not
  2503. set, YCM will fall back to the value of the 'g:syntastic_error_symbol' option
  2504. before using this option's default.
  2505. Default: '>>'
  2506. >
  2507. let g:ycm_error_symbol = '>>'
  2508. <
  2509. -------------------------------------------------------------------------------
  2510. The *g:ycm_warning_symbol* option
  2511. YCM will use the value of this option as the symbol for warnings in the Vim
  2512. gutter.
  2513. This option is part of the Syntastic compatibility layer; if the option is not
  2514. set, YCM will fall back to the value of the 'g:syntastic_warning_symbol' option
  2515. before using this option's default.
  2516. Default: '>>'
  2517. >
  2518. let g:ycm_warning_symbol = '>>'
  2519. <
  2520. -------------------------------------------------------------------------------
  2521. The *g:ycm_enable_diagnostic_signs* option
  2522. When this option is set, YCM will put icons in Vim's gutter on lines that have
  2523. a diagnostic set. Turning this off will also turn off the 'YcmErrorLine' and
  2524. 'YcmWarningLine' highlighting.
  2525. This option is part of the Syntastic compatibility layer; if the option is not
  2526. set, YCM will fall back to the value of the 'g:syntastic_enable_signs' option
  2527. before using this option's default.
  2528. Default: '1'
  2529. >
  2530. let g:ycm_enable_diagnostic_signs = 1
  2531. <
  2532. -------------------------------------------------------------------------------
  2533. The *g:ycm_enable_diagnostic_highlighting* option
  2534. When this option is set, YCM will highlight regions of text that are related to
  2535. the diagnostic that is present on a line, if any.
  2536. This option is part of the Syntastic compatibility layer; if the option is not
  2537. set, YCM will fall back to the value of the 'g:syntastic_enable_highlighting'
  2538. option before using this option's default.
  2539. Default: '1'
  2540. >
  2541. let g:ycm_enable_diagnostic_highlighting = 1
  2542. <
  2543. -------------------------------------------------------------------------------
  2544. The *g:ycm_echo_current_diagnostic* option
  2545. When this option is set to 1, YCM will echo the text of the diagnostic present
  2546. on the current line when you move your cursor to that line. If a |FixIt| is
  2547. available for the current diagnostic, then '(FixIt)' is appended.
  2548. If you have a Vim that supports virtual text, you can set this option to the
  2549. string 'virtual-text', and the diagnostic will be displayed inline with the
  2550. text, right aligned in the window and wrapping to the next line if there is not
  2551. enough space, for example:
  2552. Image: Virtual text diagnostic demo (see reference [89])
  2553. Image: Virtual text diagnostic demo (see reference [90])
  2554. **NOTE**: It's _strongly_ recommended to also set
  2555. |g:ycm_update_diagnostics_in_insert_mode| to '0' when using 'virtual-text' for
  2556. diagnostics. This is due to the increased amount distraction provided by
  2557. drawing diagnostics next to your input position.
  2558. This option is part of the Syntastic compatibility layer; if the option is not
  2559. set, YCM will fall back to the value of the 'g:syntastic_echo_current_error'
  2560. option before using this option's default.
  2561. Default: '1'
  2562. Valid values:
  2563. - '0' - disabled
  2564. - '1' - echo diagnostic to the command area
  2565. - "'virtual-text'" - display the dignostic to the right of the line in the
  2566. window using virtual text
  2567. >
  2568. let g:ycm_echo_current_diagnostic = 1
  2569. " Or, when you have Vim supporting virtual text
  2570. let g:ycm_echo_current_diagnostic = 'virtual-text'
  2571. <
  2572. -------------------------------------------------------------------------------
  2573. The *g:ycm_auto_hover* option
  2574. This option controls whether or not YCM shows documentation in a popup at the
  2575. cursor location after a short delay. Only supported in Vim.
  2576. When this option is set to "'CursorHold'", the popup is displayed on the
  2577. 'CursorHold' autocommand. See ':help CursorHold' for the details, but this
  2578. means that it is displayed after 'updatetime' milliseconds. When set to an
  2579. empty string, the popup is not automatically displayed.
  2580. In addition to this setting, there is the '<plug>(YCMHover)' mapping, which can
  2581. be used to manually trigger or hide the popup (it works like a toggle). For
  2582. example:
  2583. >
  2584. nmap <leader>D <plug>(YCMHover)
  2585. <
  2586. After dismissing the popup with this mapping, it will not be automatically
  2587. triggered again until the cursor is moved (i.e. 'CursorMoved' autocommand).
  2588. The displayed documentation depends on what the completer for the current
  2589. language supports. It's selected heuristically in this order of preference:
  2590. 1. 'GetHover' with 'markdown' syntax
  2591. 2. |GetDoc| with no syntax
  2592. 3. |GetType| with the syntax of the current file.
  2593. You can customise this by manually setting up 'b:ycm_hover' to your liking.
  2594. This buffer-local variable can be set to a dictionary with the following keys:
  2595. - 'command': The YCM completer subcommand which should be run on hover
  2596. - 'syntax': The syntax to use (as in 'set syntax=') in the popup window for
  2597. highlighting.
  2598. - 'popup_params': The params passed to a popup window which gets opened.
  2599. For example, to use C/C++ syntax highlighting in the popup for C-family
  2600. languages, add something like this to your vimrc:
  2601. >
  2602. augroup MyYCMCustom
  2603. autocmd!
  2604. autocmd FileType c,cpp let b:ycm_hover = {
  2605. \ 'command': 'GetDoc',
  2606. \ 'syntax': &filetype
  2607. \ }
  2608. augroup END
  2609. <
  2610. You can also modify the opened popup with 'popup_params' key. For example, you
  2611. can limit the popup's maximum width and add a border to it:
  2612. >
  2613. augroup MyYCMCustom
  2614. autocmd!
  2615. autocmd FileType c,cpp let b:ycm_hover = {
  2616. \ 'command': 'GetDoc',
  2617. \ 'syntax': &filetype
  2618. \ 'popup_params': {
  2619. \ 'maxwidth': 80,
  2620. \ 'border': [],
  2621. \ 'borderchars': ['─', '│', '─', '│', '┌', '┐', '┘', '└'],
  2622. \ },
  2623. \ }
  2624. augroup END
  2625. <
  2626. See ':help popup_create-arguments' for the list of available popup window
  2627. options.
  2628. Default: "'CursorHold'"
  2629. -------------------------------------------------------------------------------
  2630. The *g:ycm_filter_diagnostics* option
  2631. This option controls which diagnostics will be rendered by YCM. This option
  2632. holds a dictionary of key-values, where the keys are Vim's filetype strings
  2633. delimited by commas and values are dictionaries describing the filter.
  2634. A filter is a dictionary of key-values, where the keys are the type of filter,
  2635. and the value is a list of arguments to that filter. In the case of just a
  2636. single item in the list, you may omit the brackets and just provide the
  2637. argument directly. If any filter matches a diagnostic, it will be dropped and
  2638. YCM will not render it.
  2639. The following filter types are supported:
  2640. - "regex": Accepts a string regular expression [91]. This type matches when
  2641. the regex (treated as case-insensitive) is found anywhere in the diagnostic
  2642. text ('re.search', not 're.match')
  2643. - "level": Accepts a string level, either "warning" or "error." This type
  2644. matches when the diagnostic has the same level, that is, specifying 'level:
  2645. "error"' will remove **all** errors from the diagnostics.
  2646. **NOTE:** The regex syntax is **NOT** Vim's, it's Python's [91].
  2647. Default: '{}'
  2648. The following example will do, for java filetype only: - Remove **all** error
  2649. level diagnostics, and, - Also remove anything that contains 'ta<something>co'
  2650. >
  2651. let g:ycm_filter_diagnostics = {
  2652. \ "java": {
  2653. \ "regex": [ "ta.+co", ... ],
  2654. \ "level": "error",
  2655. \ ...
  2656. \ }
  2657. \ }
  2658. <
  2659. -------------------------------------------------------------------------------
  2660. The *g:ycm_always_populate_location_list* option
  2661. When this option is set, YCM will populate the location list automatically
  2662. every time it gets new diagnostic data. This option is off by default so as not
  2663. to interfere with other data you might have placed in the location list.
  2664. See ':help location-list' in Vim to learn more about the location list.
  2665. This option is part of the Syntastic compatibility layer; if the option is not
  2666. set, YCM will fall back to the value of the
  2667. 'g:syntastic_always_populate_loc_list' option before using this option's
  2668. default.
  2669. Note: if YCM's errors aren't visible, it might be that YCM is updating an older
  2670. location list. See ':help :lhistory' and ':lolder'.
  2671. Default: '0'
  2672. >
  2673. let g:ycm_always_populate_location_list = 0
  2674. <
  2675. -------------------------------------------------------------------------------
  2676. The *g:ycm_open_loclist_on_ycm_diags* option
  2677. When this option is set, |:YcmDiags| will automatically open the location list
  2678. after forcing a compilation and filling the list with diagnostic data.
  2679. See ':help location-list' in Vim to learn more about the location list.
  2680. Default: '1'
  2681. >
  2682. let g:ycm_open_loclist_on_ycm_diags = 1
  2683. <
  2684. -------------------------------------------------------------------------------
  2685. The *g:ycm_complete_in_comments* option
  2686. When this option is set to '1', YCM will show the completion menu even when
  2687. typing inside comments.
  2688. Default: '0'
  2689. >
  2690. let g:ycm_complete_in_comments = 0
  2691. <
  2692. -------------------------------------------------------------------------------
  2693. The *g:ycm_complete_in_strings* option
  2694. When this option is set to '1', YCM will show the completion menu even when
  2695. typing inside strings.
  2696. Note that this is turned on by default so that you can use the filename
  2697. completion inside strings. This is very useful for instance in C-family files
  2698. where typing '#include "' will trigger the start of filename completion. If you
  2699. turn off this option, you will turn off filename completion in such situations
  2700. as well.
  2701. Default: '1'
  2702. >
  2703. let g:ycm_complete_in_strings = 1
  2704. <
  2705. -------------------------------------------------------------------------------
  2706. The *g:ycm_collect_identifiers_from_comments_and_strings* option
  2707. When this option is set to '1', YCM's identifier completer will also collect
  2708. identifiers from strings and comments. Otherwise, the text in comments and
  2709. strings will be ignored.
  2710. Default: '0'
  2711. >
  2712. let g:ycm_collect_identifiers_from_comments_and_strings = 0
  2713. <
  2714. -------------------------------------------------------------------------------
  2715. The *g:ycm_collect_identifiers_from_tags_files* option
  2716. When this option is set to '1', YCM's identifier completer will also collect
  2717. identifiers from tags files. The list of tags files to examine is retrieved
  2718. from the 'tagfiles()' Vim function which examines the 'tags' Vim option. See
  2719. ":h 'tags'" for details.
  2720. YCM will re-index your tags files if it detects that they have been modified.
  2721. The only supported tag format is the Exuberant Ctags format [92]. The format
  2722. from "plain" ctags is NOT supported. Ctags needs to be called with the
  2723. '--fields=+l' option (that's a lowercase 'L', not a one) because YCM needs the
  2724. 'language:<lang>' field in the tags output.
  2725. See the _FAQ_ for pointers if YCM does not appear to read your tag files.
  2726. This option is off by default because it makes Vim slower if your tags are on a
  2727. network directory.
  2728. Default: '0'
  2729. >
  2730. let g:ycm_collect_identifiers_from_tags_files = 0
  2731. <
  2732. -------------------------------------------------------------------------------
  2733. The *g:ycm_seed_identifiers_with_syntax* option
  2734. When this option is set to '1', YCM's identifier completer will seed its
  2735. identifier database with the keywords of the programming language you're
  2736. writing.
  2737. Since the keywords are extracted from the Vim syntax file for the filetype, all
  2738. keywords may not be collected, depending on how the syntax file was written.
  2739. Usually at least 95% of the keywords are successfully extracted.
  2740. Default: '0'
  2741. >
  2742. let g:ycm_seed_identifiers_with_syntax = 0
  2743. <
  2744. -------------------------------------------------------------------------------
  2745. The *g:ycm_extra_conf_vim_data* option
  2746. If you're using semantic completion for C-family files, this option might come
  2747. handy; it's a way of sending data from Vim to your 'Settings' function in your
  2748. '.ycm_extra_conf.py' file.
  2749. This option is supposed to be a list of VimScript expression strings that are
  2750. evaluated for every request to the ycmd server [44] and then passed to your
  2751. 'Settings' function as a 'client_data' keyword argument.
  2752. For instance, if you set this option to "['v:version']", your 'Settings'
  2753. function will be called like this:
  2754. >
  2755. # The '801' value is of course contingent on Vim 8.1; in 8.0 it would be '800'
  2756. Settings( ..., client_data = { 'v:version': 801 } )
  2757. <
  2758. So the 'client_data' parameter is a dictionary mapping Vim expression strings
  2759. to their values at the time of the request.
  2760. The correct way to define parameters for your 'Settings' function:
  2761. >
  2762. def Settings( **kwargs ):
  2763. <
  2764. You can then get to 'client_data' with "kwargs['client_data']".
  2765. Default: '[]'
  2766. >
  2767. let g:ycm_extra_conf_vim_data = []
  2768. <
  2769. -------------------------------------------------------------------------------
  2770. The *g:ycm_server_python_interpreter* option
  2771. YCM will by default search for an appropriate Python interpreter on your
  2772. system. You can use this option to override that behavior and force the use of
  2773. a specific interpreter of your choosing.
  2774. **NOTE:** This interpreter is only used for the ycmd server [44]. The YCM
  2775. client running inside Vim always uses the Python interpreter that's embedded
  2776. inside Vim.
  2777. Default: "''"
  2778. >
  2779. let g:ycm_server_python_interpreter = ''
  2780. <
  2781. -------------------------------------------------------------------------------
  2782. The *g:ycm_keep_logfiles* option
  2783. When this option is set to '1', YCM and the ycmd completion server [44] will
  2784. keep the logfiles around after shutting down (they are deleted on shutdown by
  2785. default).
  2786. To see where the logfiles are, call |:YcmDebugInfo|.
  2787. Default: '0'
  2788. >
  2789. let g:ycm_keep_logfiles = 0
  2790. <
  2791. -------------------------------------------------------------------------------
  2792. The *g:ycm_log_level* option
  2793. The logging level that YCM and the ycmd completion server [44] use. Valid
  2794. values are the following, from most verbose to least verbose: - 'debug' -
  2795. 'info' - 'warning' - 'error' - 'critical'
  2796. Note that 'debug' is _very_ verbose.
  2797. Default: 'info'
  2798. >
  2799. let g:ycm_log_level = 'info'
  2800. <
  2801. -------------------------------------------------------------------------------
  2802. The *g:ycm_auto_start_csharp_server* option
  2803. When set to '1', the OmniSharp-Roslyn server will be automatically started
  2804. (once per Vim session) when you open a C# file.
  2805. Default: '1'
  2806. >
  2807. let g:ycm_auto_start_csharp_server = 1
  2808. <
  2809. -------------------------------------------------------------------------------
  2810. The *g:ycm_auto_stop_csharp_server* option
  2811. When set to '1', the OmniSharp-Roslyn server will be automatically stopped upon
  2812. closing Vim.
  2813. Default: '1'
  2814. >
  2815. let g:ycm_auto_stop_csharp_server = 1
  2816. <
  2817. -------------------------------------------------------------------------------
  2818. The *g:ycm_csharp_server_port* option
  2819. When g:ycm_auto_start_csharp_server is set to '1', specifies the port for the
  2820. OmniSharp-Roslyn server to listen on. When set to '0' uses an unused port
  2821. provided by the OS.
  2822. Default: '0'
  2823. >
  2824. let g:ycm_csharp_server_port = 0
  2825. <
  2826. -------------------------------------------------------------------------------
  2827. The *g:ycm_csharp_insert_namespace_expr* option
  2828. By default, when YCM inserts a namespace, it will insert the 'using' statement
  2829. under the nearest 'using' statement. You may prefer that the 'using' statement
  2830. is inserted somewhere, for example, to preserve sorting. If so, you can set
  2831. this option to override this behavior.
  2832. When this option is set, instead of inserting the 'using' statement itself, YCM
  2833. will set the global variable 'g:ycm_namespace_to_insert' to the namespace to
  2834. insert, and then evaluate this option's value as an expression. The option's
  2835. expression is responsible for inserting the namespace - the default insertion
  2836. will not occur.
  2837. Default: ''
  2838. >
  2839. let g:ycm_csharp_insert_namespace_expr = ''
  2840. <
  2841. -------------------------------------------------------------------------------
  2842. The *g:ycm_add_preview_to_completeopt* option
  2843. When this option is set to '1', YCM will add the 'preview' string to Vim's
  2844. 'completeopt' option (see ':h completeopt'). If your 'completeopt' option
  2845. already has 'preview' set, there will be no effect. Alternatively, when set to
  2846. 'popup' and your version of Vim supports popup windows (see ':help popup'), the
  2847. 'popup' string will be used instead. You can see the current state of your
  2848. 'completeopt' setting with ':set completeopt?' (yes, the question mark is
  2849. important).
  2850. When 'preview' is present in 'completeopt', YCM will use the 'preview' window
  2851. at the top of the file to store detailed information about the current
  2852. completion candidate (but only if the candidate came from the semantic engine).
  2853. For instance, it would show the full function prototype and all the function
  2854. overloads in the window if the current completion is a function name.
  2855. When 'popup' is present in 'completeopt', YCM will instead use a 'popup' window
  2856. to the side of the completion popup for storing detailed information about the
  2857. current completion candidate. In addition, YCM may truncate the detailed
  2858. completion information in order to give the popup sufficient room to display
  2859. that detailed information.
  2860. Default: '0'
  2861. >
  2862. let g:ycm_add_preview_to_completeopt = 0
  2863. <
  2864. -------------------------------------------------------------------------------
  2865. The *g:ycm_autoclose_preview_window_after_completion* option
  2866. When this option is set to '1', YCM will auto-close the 'preview' window after
  2867. the user accepts the offered completion string. If there is no 'preview' window
  2868. triggered because there is no 'preview' string in 'completeopt', this option is
  2869. irrelevant. See the |g:ycm_add_preview_to_completeopt| option for more details.
  2870. Default: '0'
  2871. >
  2872. let g:ycm_autoclose_preview_window_after_completion = 0
  2873. <
  2874. -------------------------------------------------------------------------------
  2875. The *g:ycm_autoclose_preview_window_after_insertion* option
  2876. When this option is set to '1', YCM will auto-close the 'preview' window after
  2877. the user leaves insert mode. This option is irrelevant if
  2878. |g:ycm_autoclose_preview_window_after_completion| is set or if no 'preview'
  2879. window is triggered. See the |g:ycm_add_preview_to_completeopt| option for more
  2880. details.
  2881. Default: '0'
  2882. >
  2883. let g:ycm_autoclose_preview_window_after_insertion = 0
  2884. <
  2885. -------------------------------------------------------------------------------
  2886. The *g:ycm_max_diagnostics_to_display* option
  2887. This option controls the maximum number of diagnostics shown to the user when
  2888. errors or warnings are detected in the file. This option is only relevant for
  2889. the C-family, C#, Java, JavaScript, and TypeScript languages.
  2890. A special value of '0' means there is no limit.
  2891. Default: '30'
  2892. >
  2893. let g:ycm_max_diagnostics_to_display = 30
  2894. <
  2895. -------------------------------------------------------------------------------
  2896. The *g:ycm_key_list_select_completion* option
  2897. This option controls the key mappings used to select the first completion
  2898. string. Invoking any of them repeatedly cycles forward through the completion
  2899. list.
  2900. Some users like adding '<Enter>' to this list.
  2901. Default: "['<TAB>', '<Down>']"
  2902. >
  2903. let g:ycm_key_list_select_completion = ['<TAB>', '<Down>']
  2904. <
  2905. -------------------------------------------------------------------------------
  2906. The *g:ycm_key_list_previous_completion* option
  2907. This option controls the key mappings used to select the previous completion
  2908. string. Invoking any of them repeatedly cycles backwards through the completion
  2909. list.
  2910. Note that one of the defaults is '<S-TAB>' which means Shift-TAB. That mapping
  2911. will probably only work in GUI Vim (Gvim or MacVim) and not in plain console
  2912. Vim because the terminal usually does not forward modifier key combinations to
  2913. Vim.
  2914. Default: "['<S-TAB>', '<Up>']"
  2915. >
  2916. let g:ycm_key_list_previous_completion = ['<S-TAB>', '<Up>']
  2917. <
  2918. -------------------------------------------------------------------------------
  2919. The *g:ycm_key_list_stop_completion* option
  2920. This option controls the key mappings used to close the completion menu. This
  2921. is useful when the menu is blocking the view, when you need to insert the
  2922. '<TAB>' character, or when you want to expand a snippet from UltiSnips [25] and
  2923. navigate through it.
  2924. Default: "['<C-y>']"
  2925. >
  2926. let g:ycm_key_list_stop_completion = ['<C-y>']
  2927. <
  2928. -------------------------------------------------------------------------------
  2929. The *g:ycm_key_invoke_completion* option
  2930. This option controls the key mapping used to invoke the completion menu for
  2931. semantic completion. By default, semantic completion is triggered automatically
  2932. after typing characters appropriate for the language, such as '.', '->', '::',
  2933. etc. in insert mode (if semantic completion support has been compiled in). This
  2934. key mapping can be used to trigger semantic completion anywhere. Useful for
  2935. searching for top-level functions and classes.
  2936. Console Vim (not Gvim or MacVim) passes '<Nul>' to Vim when the user types
  2937. '<C-Space>' so YCM will make sure that '<Nul>' is used in the map command when
  2938. you're editing in console Vim, and '<C-Space>' in GUI Vim. This means that you
  2939. can just press '<C-Space>' in both console and GUI Vim and YCM will do the
  2940. right thing.
  2941. Setting this option to an empty string will make sure no mapping is created.
  2942. Default: '<C-Space>'
  2943. >
  2944. let g:ycm_key_invoke_completion = '<C-Space>'
  2945. <
  2946. -------------------------------------------------------------------------------
  2947. The *g:ycm_key_detailed_diagnostics* option
  2948. This option controls the key mapping used to show the full diagnostic text when
  2949. the user's cursor is on the line with the diagnostic. It basically calls
  2950. |:YcmShowDetailedDiagnostic|.
  2951. Setting this option to an empty string will make sure no mapping is created.
  2952. If you prefer the detailed diagnostic to be shown in a popup, then 'let
  2953. g:ycm_show_detailed_diag_in_popup=1'.
  2954. Default: '<leader>d'
  2955. >
  2956. let g:ycm_key_detailed_diagnostics = '<leader>d'
  2957. <
  2958. -------------------------------------------------------------------------------
  2959. The *g:ycm_show_detailed_diag_in_popup* option
  2960. Makes |:YcmShowDetailedDiagnostic| always show in a popup rather than echoing
  2961. to the command line.
  2962. Default: 0
  2963. >
  2964. let g:ycm_show_detailed_diag_in_popup = 0
  2965. <
  2966. -------------------------------------------------------------------------------
  2967. The *g:ycm_global_ycm_extra_conf* option
  2968. Normally, YCM searches for a '.ycm_extra_conf.py' file for compilation flags
  2969. (see the User Guide for more details on how this works). This option specifies
  2970. a fallback path to a config file which is used if no '.ycm_extra_conf.py' is
  2971. found.
  2972. You can place such a global file anywhere in your filesystem.
  2973. Default: "''"
  2974. >
  2975. let g:ycm_global_ycm_extra_conf = ''
  2976. <
  2977. -------------------------------------------------------------------------------
  2978. The *g:ycm_confirm_extra_conf* option
  2979. When this option is set to '1' YCM will ask once per '.ycm_extra_conf.py' file
  2980. if it is safe to be loaded. This is to prevent execution of malicious code from
  2981. a '.ycm_extra_conf.py' file you didn't write.
  2982. To selectively get YCM to ask/not ask about loading certain
  2983. '.ycm_extra_conf.py' files, see the |g:ycm_extra_conf_globlist| option.
  2984. Default: '1'
  2985. >
  2986. let g:ycm_confirm_extra_conf = 1
  2987. <
  2988. -------------------------------------------------------------------------------
  2989. The *g:ycm_extra_conf_globlist* option
  2990. This option is a list that may contain several globbing patterns. If a pattern
  2991. starts with a '!' all '.ycm_extra_conf.py' files matching that pattern will be
  2992. blacklisted, that is they won't be loaded and no confirmation dialog will be
  2993. shown. If a pattern does not start with a '!' all files matching that pattern
  2994. will be whitelisted. Note that this option is not used when confirmation is
  2995. disabled using |g:ycm_confirm_extra_conf| and that items earlier in the list
  2996. will take precedence over the later ones.
  2997. Rules:
  2998. - '*' matches everything
  2999. - '?' matches any single character
  3000. - '[seq]' matches any character in seq
  3001. - '[!seq]' matches any char not in seq
  3002. Example:
  3003. >
  3004. let g:ycm_extra_conf_globlist = ['~/dev/*','!~/*']
  3005. <
  3006. - The first rule will match everything contained in the '~/dev' directory so
  3007. '.ycm_extra_conf.py' files from there will be loaded.
  3008. - The second rule will match everything in the home directory so a
  3009. '.ycm_extra_conf.py' file from there won't be loaded.
  3010. - As the first rule takes precedence everything in the home directory
  3011. excluding the '~/dev' directory will be blacklisted.
  3012. **NOTE:** The glob pattern is first expanded with Python's
  3013. 'os.path.expanduser()' and then resolved with 'os.path.abspath()' before being
  3014. matched against the filename.
  3015. Default: '[]'
  3016. >
  3017. let g:ycm_extra_conf_globlist = []
  3018. <
  3019. -------------------------------------------------------------------------------
  3020. The *g:ycm_filepath_completion_use_working_dir* option
  3021. By default, YCM's filepath completion will interpret relative paths like '../'
  3022. as being relative to the folder of the file of the currently active buffer.
  3023. Setting this option will force YCM to always interpret relative paths as being
  3024. relative to Vim's current working directory.
  3025. Default: '0'
  3026. >
  3027. let g:ycm_filepath_completion_use_working_dir = 0
  3028. <
  3029. -------------------------------------------------------------------------------
  3030. The *g:ycm_semantic_triggers* option
  3031. This option controls the character-based triggers for the various semantic
  3032. completion engines. The option holds a dictionary of key-values, where the keys
  3033. are Vim's filetype strings delimited by commas and values are lists of strings,
  3034. where the strings are the triggers.
  3035. Setting key-value pairs on the dictionary _adds_ semantic triggers to the
  3036. internal default set (listed below). You cannot remove the default triggers,
  3037. only add new ones.
  3038. A "trigger" is a sequence of one or more characters that trigger semantic
  3039. completion when typed. For instance, C++ ('cpp' filetype) has '.' listed as a
  3040. trigger. So when the user types 'foo.', the semantic engine will trigger and
  3041. serve 'foo''s list of member functions and variables. Since C++ also has '->'
  3042. listed as a trigger, the same thing would happen when the user typed 'foo->'.
  3043. It's also possible to use a regular expression as a trigger. You have to prefix
  3044. your trigger with 're!' to signify it's a regex trigger. For instance,
  3045. 're!\w+\.' would only trigger after the '\w+\.' regex matches.
  3046. **NOTE:** The regex syntax is **NOT** Vim's, it's Python's [91].
  3047. Default: '[see next line]'
  3048. >
  3049. let g:ycm_semantic_triggers = {
  3050. \ 'c': ['->', '.'],
  3051. \ 'objc': ['->', '.', 're!\[[_a-zA-Z]+\w*\s', 're!^\s*[^\W\d]\w*\s',
  3052. \ 're!\[.*\]\s'],
  3053. \ 'ocaml': ['.', '#'],
  3054. \ 'cpp,cuda,objcpp': ['->', '.', '::'],
  3055. \ 'perl': ['->'],
  3056. \ 'php': ['->', '::'],
  3057. \ 'cs,d,elixir,go,groovy,java,javascript,julia,perl6,python,scala,typescript,vb': ['.'],
  3058. \ 'ruby,rust': ['.', '::'],
  3059. \ 'lua': ['.', ':'],
  3060. \ 'erlang': [':'],
  3061. \ }
  3062. <
  3063. -------------------------------------------------------------------------------
  3064. The *g:ycm_cache_omnifunc* option
  3065. Some omnicompletion engines do not work well with the YCM cache—in particular,
  3066. they might not produce all possible results for a given prefix. By unsetting
  3067. this option you can ensure that the omnicompletion engine is re-queried on
  3068. every keypress. That will ensure all completions will be presented, but might
  3069. cause stuttering and lagginess if the omnifunc is slow.
  3070. Default: '1'
  3071. >
  3072. let g:ycm_cache_omnifunc = 1
  3073. <
  3074. -------------------------------------------------------------------------------
  3075. The *g:ycm_use_ultisnips_completer* option
  3076. By default, YCM will query the UltiSnips plugin for possible completions of
  3077. snippet triggers. This option can turn that behavior off.
  3078. Default: '1'
  3079. >
  3080. let g:ycm_use_ultisnips_completer = 1
  3081. <
  3082. -------------------------------------------------------------------------------
  3083. The *g:ycm_goto_buffer_command* option
  3084. Defines where 'GoTo*' commands result should be opened. Can take one of the
  3085. following values: "'same-buffer'", "'split'", or "'split-or-existing-window'".
  3086. If this option is set to the "'same-buffer'" but current buffer can not be
  3087. switched (when buffer is modified and 'nohidden' option is set), then result
  3088. will be opened in a split. When the option is set to
  3089. "'split-or-existing-window'", if the result is already open in a window of the
  3090. current tab page (or any tab pages with the ':tab' modifier; see below), it
  3091. will jump to that window. Otherwise, the result will be opened in a split as if
  3092. the option was set to "'split'".
  3093. To customize the way a new window is split, prefix the 'GoTo*' command with one
  3094. of the following modifiers: ':aboveleft', ':belowright', ':botright',
  3095. ':leftabove', ':rightbelow', ':topleft', and ':vertical'. For instance, to
  3096. split vertically to the right of the current window, run the command:
  3097. >
  3098. :rightbelow vertical YcmCompleter GoTo
  3099. <
  3100. To open in a new tab page, use the ':tab' modifier with the "'split'" or
  3101. "'split-or-existing-window'" options e.g.:
  3102. >
  3103. :tab YcmCompleter GoTo
  3104. <
  3105. Default: "'same-buffer'"
  3106. >
  3107. let g:ycm_goto_buffer_command = 'same-buffer'
  3108. <
  3109. -------------------------------------------------------------------------------
  3110. The *g:ycm_disable_for_files_larger_than_kb* option
  3111. Defines the max size (in Kb) for a file to be considered for completion. If
  3112. this option is set to 0 then no check is made on the size of the file you're
  3113. opening.
  3114. Default: 1000
  3115. >
  3116. let g:ycm_disable_for_files_larger_than_kb = 1000
  3117. <
  3118. -------------------------------------------------------------------------------
  3119. The *g:ycm_use_clangd* option
  3120. This option controls whether **clangd** should be used as completion engine for
  3121. C-family languages. Can take one of the following values: '1', '0', with
  3122. meanings:
  3123. - '1': YCM will use clangd if clangd binary exists in third party or it was
  3124. provided with 'ycm_clangd_binary_path' option.
  3125. - '0': YCM will never use clangd completer.
  3126. Default: '1'
  3127. >
  3128. let g:ycm_use_clangd = 1
  3129. <
  3130. -------------------------------------------------------------------------------
  3131. The *g:ycm_clangd_binary_path* option
  3132. When 'ycm_use_clangd' option is set to '1', this option sets the path to
  3133. **clangd** binary.
  3134. Default: "''"
  3135. >
  3136. let g:ycm_clangd_binary_path = ''
  3137. <
  3138. -------------------------------------------------------------------------------
  3139. The *g:ycm_clangd_args* option
  3140. This option controls the command line arguments passed to the clangd binary. It
  3141. appends new options and overrides the existing ones.
  3142. Default: '[]'
  3143. >
  3144. let g:ycm_clangd_args = []
  3145. <
  3146. -------------------------------------------------------------------------------
  3147. The *g:ycm_clangd_uses_ycmd_caching* option
  3148. This option controls which ranking and filtering algorithm to use for
  3149. completion items. It can take values:
  3150. - '1': Uses ycmd's caching and filtering logic.
  3151. - '0': Uses clangd's caching and filtering logic.
  3152. Default: '1'
  3153. >
  3154. let g:ycm_clangd_uses_ycmd_caching = 1
  3155. <
  3156. -------------------------------------------------------------------------------
  3157. The *g:ycm_language_server* option
  3158. This option lets YCM use an arbitrary Language Server Protocol (LSP) server,
  3159. not unlike many other completion systems. The officially supported completers
  3160. are favoured over custom LSP ones, so overriding an existing completer means
  3161. first making sure YCM won't choose that existing completer in the first place.
  3162. A simple working example of this option can be found in the section called
  3163. "Semantic Completion for Other Languages".
  3164. Many working examples can be found in the YCM lsp-examples [78] repo.
  3165. Default: '[]'
  3166. >
  3167. let g:ycm_language_server = []
  3168. <
  3169. -------------------------------------------------------------------------------
  3170. The *g:ycm_disable_signature_help* option
  3171. This option allows you to disable all signature help for all completion
  3172. engines. There is no way to disable it per-completer. This option is
  3173. _reserved_, meaning that while signature help support remains experimental, its
  3174. values and meaning may change and it may be removed in a future version.
  3175. Default: '0'
  3176. >
  3177. " Disable signature help
  3178. let g:ycm_disable_signature_help = 1
  3179. <
  3180. -------------------------------------------------------------------------------
  3181. The *g:ycm_signature_help_disable_syntax* option
  3182. Set this to 1 to disable syntax highlighting in the signature help popup. Thiis
  3183. can help if your colourscheme doesn't work well with the default highliting and
  3184. inverse video.
  3185. Default: '0'
  3186. >
  3187. " Disable signature help syntax highliting
  3188. let g:ycm_signature_help_disable_syntax = 1
  3189. <
  3190. -------------------------------------------------------------------------------
  3191. The *g:ycm_gopls_binary_path* option
  3192. In case the system-wide 'gopls' binary is newer than the bundled one, setting
  3193. this option to the path of the system-wide 'gopls' would make YCM use that one
  3194. instead.
  3195. If the path is just 'gopls', YCM will search in '$PATH'.
  3196. -------------------------------------------------------------------------------
  3197. The *g:ycm_gopls_args* option
  3198. Similar to the |g:ycm_clangd_args|, this option allows passing additional flags
  3199. to the 'gopls' command line.
  3200. Default: '[]'
  3201. >
  3202. let g:ycm_gopls_args = []
  3203. <
  3204. -------------------------------------------------------------------------------
  3205. The *g:ycm_rls_binary_path* and 'g:ycm_rustc_binary_path' options
  3206. YCM no longer uses RLS for rust, and these options are therefore no longer
  3207. supported.
  3208. To use a custom rust-analyzer, see |g:ycm_rust_toolchain_root|.
  3209. -------------------------------------------------------------------------------
  3210. The *g:ycm_rust_toolchain_root* option
  3211. Optionally specify the path to a custom rust toolchain including at least a
  3212. supported version of 'rust-analyzer'.
  3213. -------------------------------------------------------------------------------
  3214. The *g:ycm_tsserver_binary_path* option
  3215. Similar to the 'gopls' path, this option tells YCM where is the TSServer
  3216. executable located.
  3217. -------------------------------------------------------------------------------
  3218. The *g:ycm_roslyn_binary_path* option
  3219. Similar to the 'gopls' path, this option tells YCM where is the
  3220. Omnisharp-Roslyn executable located.
  3221. -------------------------------------------------------------------------------
  3222. The *g:ycm_update_diagnostics_in_insert_mode* option
  3223. With async diagnostics, LSP servers might send new diagnostics mid-typing. If
  3224. seeing these new diagnostics while typing is not desired, this option can be
  3225. set to 0.
  3226. When this option is set to '0', diagnostic signs, virtual text and highlights
  3227. are cleared when entering insert mode and replaced when leaving insert mode.
  3228. This reduces visual noise while editing.
  3229. In addition, this option is recommended when |g:ycm_echo_current_diagnostic| is
  3230. set to 'virtual-text' as it prevents updating the virtual text while you are
  3231. typing.
  3232. Default: '1'
  3233. >
  3234. let g:ycm_update_diagnostics_in_insert_mode = 1
  3235. <
  3236. -------------------------------------------------------------------------------
  3237. *youcompleteme-faq*
  3238. FAQ ~
  3239. The FAQ section has been moved to the wiki [8].
  3240. -------------------------------------------------------------------------------
  3241. *youcompleteme-contributor-code-of-conduct*
  3242. Contributor Code of Conduct ~
  3243. Please note that this project is released with a Contributor Code of Conduct
  3244. [93]. By participating in this project you agree to abide by its terms.
  3245. -------------------------------------------------------------------------------
  3246. *youcompleteme-contact*
  3247. Contact ~
  3248. If you have questions about the plugin or need help, please join the Gitter
  3249. room [1] or use the ycm-users [94] mailing list.
  3250. If you have bug reports or feature suggestions, please use the issue tracker
  3251. [95]. Before you do, please carefully read CONTRIBUTING.md [96] as this asks
  3252. for important diagnostics which the team will use to help get you going.
  3253. The latest version of the plugin is available at
  3254. https://ycm-core.github.io/YouCompleteMe/.
  3255. The author's homepage is https://val.markovic.io.
  3256. Please do **NOT** go to #vim, reddit, or stack overflow for support. Please
  3257. contact the YouCompleteMe maintainers directly using the contact details.
  3258. -------------------------------------------------------------------------------
  3259. *youcompleteme-license*
  3260. License ~
  3261. This software is licensed under the GPL v3 license [97]. © 2015-2018
  3262. YouCompleteMe contributors
  3263. -------------------------------------------------------------------------------
  3264. *youcompleteme-sponsorship*
  3265. Sponsorship ~
  3266. If you like YCM so much that you're wiling to part with your hard-earned cash,
  3267. please consider donating to one of the following charities, which are
  3268. meaningful to the current maintainers (in no particular order):
  3269. - Hector's Greyhound Rescue [98]
  3270. - Be Humane [99]
  3271. - Cancer Research UK [100]
  3272. - ICCF Holland [101]
  3273. - Any charity of your choosing.
  3274. Please note: The YCM maintainers do not specifically endorse nor necessarily
  3275. have any relationship with the above charities. Disclosure: It is noted that
  3276. one key maintainer is family with Trustees of Greyhound Rescue Wales.
  3277. ===============================================================================
  3278. *youcompleteme-references*
  3279. References ~
  3280. [1] https://gitter.im/Valloric/YouCompleteMe
  3281. [2] https://img.shields.io/gitter/room/Valloric/YouCompleteMe.svg
  3282. [3] https://dev.azure.com/YouCompleteMe/YCM/_build?definitionId=3&branchName=master
  3283. [4] https://dev.azure.com/YouCompleteMe/YCM/_apis/build/status/ycm-core.YouCompleteMe?branchName=master
  3284. [5] https://codecov.io/gh/ycm-core/YouCompleteMe
  3285. [6] https://img.shields.io/codecov/c/github/ycm-core/YouCompleteMe/master.svg
  3286. [7] https://github.com/ycm-core/YouCompleteMe/wiki/Troubleshooting-steps-for-ycmd-server-SHUT-DOWN
  3287. [8] https://github.com/ycm-core/YouCompleteMe/wiki/FAQ
  3288. [9] https://github.com/ycm-core/YouCompleteMe/issues/4134#issuecomment-1446235584
  3289. [10] https://www.vim.org/
  3290. [11] https://clang.llvm.org/extra/clangd.html
  3291. [12] https://github.com/davidhalter/jedi
  3292. [13] https://github.com/OmniSharp/omnisharp-roslyn
  3293. [14] https://github.com/golang/go/wiki/gopls
  3294. [15] https://github.com/Microsoft/TypeScript/tree/master/src/server
  3295. [16] https://rust-analyzer.github.io
  3296. [17] https://github.com/eclipse/eclipse.jdt.ls
  3297. [18] https://i.imgur.com/0OP4ood.gif
  3298. [19] https://en.wikipedia.org/wiki/Subsequence
  3299. [20] https://github.com/scrooloose/syntastic
  3300. [21] https://user-images.githubusercontent.com/10026824/34471853-af9cf32a-ef53-11e7-8229-de534058ddc4.gif
  3301. [22] https://user-images.githubusercontent.com/10584846/58738348-5060da80-83fd-11e9-9537-d07fdbf4554c.gif
  3302. [23] https://i.imgur.com/nmUUbdl.gif
  3303. [24] https://user-images.githubusercontent.com/10584846/80312146-91af6500-87db-11ea-996b-7396f3134d1f.gif
  3304. [25] https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt
  3305. [26] https://github.com/VundleVim/Vundle.vim#about
  3306. [27] mono-install-macos
  3307. [28] https://macvim-dev.github.io/macvim/
  3308. [29] https://brew.sh
  3309. [30] https://www.mono-project.com/download/stable/
  3310. [31] https://golang.org/doc/install
  3311. [32] https://docs.npmjs.com/getting-started/installing-node#1-install-nodejs--npm
  3312. [33] https://adoptium.net/en-GB/temurin/releases
  3313. [34] https://github.com/ycm-core/YouCompleteMe/wiki/Building-Vim-from-source
  3314. [35] https://www.mono-project.com/download/stable/#download-lin
  3315. [36] https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
  3316. [37] https://vimhelp.appspot.com/starting.txt.html#vimrc
  3317. [38] https://github.com/vim/vim-win32-installer/releases
  3318. [39] https://www.python.org/downloads/windows/
  3319. [40] https://cmake.org/download/
  3320. [41] https://stackoverflow.com/questions/6319274/how-do-i-run-msbuild-from-the-command-line-using-windows-sdk-7-1
  3321. [42] https://github.com/ycm-core/YouCompleteMe/wiki/Full-Installation-Guide
  3322. [43] https://www.unicode.org/glossary/#diacritic
  3323. [44] https://github.com/ycm-core/ycmd
  3324. [45] https://github.com/ycm-core/ycmd/pull/1255
  3325. [46] https://user-images.githubusercontent.com/10584846/173137003-a265e8b0-84db-4993-98f0-03ee81b9de94.png
  3326. [47] https://user-images.githubusercontent.com/10584846/173137012-7547de0b-145f-45fa-ace3-18943acd2141.png
  3327. [48] https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_semanticTokens
  3328. [49] https://user-images.githubusercontent.com/10584846/185708054-68074fc0-e50c-4a65-887c-da6f372b8982.png
  3329. [50] https://user-images.githubusercontent.com/10584846/185708156-b52970ce-005f-4f0b-97e7-bdf8feeefedc.png
  3330. [51] https://user-images.githubusercontent.com/10584846/185708242-e42dab6f-1847-46f1-8585-2d9f2c8a76dc.png
  3331. [52] https://github.com/ycm-core/YouCompleteMe/wiki/C-family-Semantic-Completion-through-libclang
  3332. [53] https://clang.llvm.org/docs/JSONCompilationDatabase.html
  3333. [54] https://ninja-build.org/manual.html
  3334. [55] https://pypi.org/project/compiledb/
  3335. [56] https://github.com/rizsotto/Bear
  3336. [57] https://raw.githubusercontent.com/ycm-core/ycmd/66030cd94299114ae316796f3cad181cac8a007c/.ycm_extra_conf.py
  3337. [58] https://github.com/rdnetto/YCM-Generator
  3338. [59] https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/Preferences.java
  3339. [60] https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fproject_description_file.html
  3340. [61] https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
  3341. [62] https://docs.gradle.org/current/userguide/tutorial_java_projects.html
  3342. [63] https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FIClasspathEntry.html
  3343. [64] https://github.com/ycm-core/ycmd/tree/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_eclipse_project
  3344. [65] https://github.com/ycm-core/ycmd/blob/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_maven_project/pom.xml
  3345. [66] https://github.com/ycm-core/ycmd/tree/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_gradle_project
  3346. [67] https://github.com/ycm-core/lsp-examples#kotlin
  3347. [68] https://github.com/ycm-core/YouCompleteMe/blob/master/.ycm_extra_conf.py
  3348. [69] https://github.com/rust-lang/rls
  3349. [70] https://www.rust-lang.org/downloads.html
  3350. [71] https://rust-analyzer.github.io/manual.html#configuration]
  3351. [72] https://github.com/golang/tools/blob/master/gopls/doc/settings.md
  3352. [73] https://ternjs.net
  3353. [74] https://github.com/ycm-core/YouCompleteMe/wiki/JavaScript-Semantic-Completion-through-Tern
  3354. [75] https://code.visualstudio.com/docs/languages/jsconfig
  3355. [76] https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
  3356. [77] https://clang.llvm.org/
  3357. [78] https://github.com/ycm-core/lsp-examples
  3358. [79] http://eclim.org/
  3359. [80] https://github.com/ycm-core/ycmd/blob/master/ycmd/completers/completer.py
  3360. [81] https://github.com/Valloric/ListToggle
  3361. [82] https://asciinema.org/a/4JmYLAaz5hOHbZDD0hbsQpY8C
  3362. [83] https://asciinema.org/a/4JmYLAaz5hOHbZDD0hbsQpY8C.svg
  3363. [84] https://user-images.githubusercontent.com/17928698/206855014-9131a49b-87e8-4ed4-8d91-f2fe7808a0b9.gif
  3364. [85] https://user-images.githubusercontent.com/17928698/206855713-3588c8de-d0f5-4725-b65e-bc51110252cc.gif
  3365. [86] https://jedi.readthedocs.io/en/latest/docs/api.html#jedi.Script.extract_variable
  3366. [87] https://github.com/puremourning/vimspector
  3367. [88] https://github.com/itchyny/lightline.vim
  3368. [89] https://user-images.githubusercontent.com/10584846/185707973-39703699-0263-47d3-82ac-639d52259bea.png
  3369. [90] https://user-images.githubusercontent.com/10584846/185707993-14ff5fd7-c082-4e5a-b825-f1364e619b6a.png
  3370. [91] https://docs.python.org/2/library/re.html#regular-expression-syntax
  3371. [92] http://ctags.sourceforge.net/FORMAT
  3372. [93] https://github.com/ycm-core/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md
  3373. [94] https://groups.google.com/forum/?hl=en#!forum/ycm-users
  3374. [95] https://github.com/ycm-core/YouCompleteMe/issues?state=open
  3375. [96] https://github.com/ycm-core/YouCompleteMe/blob/master/CONTRIBUTING.md
  3376. [97] https://www.gnu.org/copyleft/gpl.html
  3377. [98] https://www.hectorsgreyhoundrescue.org
  3378. [99] https://www.budihuman.rs/en
  3379. [100] https://www.cancerresearchuk.org
  3380. [101] https://iccf.nl
  3381. vim: ft=help