youcompleteme.txt 151 KB

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