1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594 |
- <!DOCTYPE html>
- <html><head>
- <meta charset="utf-8"/>
- <meta content="chrome=1" http-equiv="X-UA-Compatible"/>
- <title>YouCompleteMe by Valloric</title>
- <link href="stylesheets/styles.css" rel="stylesheet"/>
- <link href="stylesheets/pygment_trac.css" rel="stylesheet"/>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
- <script src="javascripts/respond.js"></script>
- <!--[if lt IE 9]>
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
- <!--[if lt IE 8]>
- <link rel="stylesheet" href="stylesheets/ie.css">
- <![endif]-->
- <meta content="width=device-width, initial-scale=1, user-scalable=no" name="viewport"/>
- </head>
- <body>
- <div class="wrapper">
- <section>
- <div id="title">
- <h1>YouCompleteMe</h1>
- <p>A code-completion engine for Vim</p>
- <hr/>
- <span class="credits left">Project maintained by <a href="https://github.com/Valloric">Valloric</a></span>
- <span class="credits right">Hosted on GitHub Pages — Theme by <a href="http://twitter.com/#!/michigangraham">mattgraham</a></span>
- </div>
- <div id="markdown-output"><p><a href="https://gitter.im/Valloric/YouCompleteMe"><img alt="Gitter room" src="https://img.shields.io/gitter/room/Valloric/YouCompleteMe.svg"/></a>
- <a href="https://dev.azure.com/YouCompleteMe/YCM/_build?definitionId=3&branchName=master"><img alt="Build status" src="https://dev.azure.com/YouCompleteMe/YCM/_apis/build/status/ycm-core.YouCompleteMe?branchName=master"/></a>
- <a href="https://codecov.io/gh/ycm-core/YouCompleteMe"><img alt="Coverage status" src="https://img.shields.io/codecov/c/github/ycm-core/YouCompleteMe/master.svg"/></a></p><h2 id="warning-support-for-python-35-has-ended">Warning: Support for Python 3.5 has ended</h2><p>In mid 2020, YCM dropped support for Python 3.5 runtime.</p><p>Why?</p><p>On 13th September 2020, Python 3.5 will be officially end of life. And therefore, so
- will its relationship with YouCompleteMe and ycmd.</p><p>Looking for Python 2 support? Check the <a href="https://github.com/ycm-core/YouCompleteMe/wiki/Python-2">Wiki</a>.</p><h2 id="help-advice-support">Help, Advice, Support</h2><p>Looking for help, advice or support? Having problems getting YCM to work?</p><p>First carefully read the <a href="#installation">installation instructions</a> for your OS.
- We recommend you use the supplied <code>install.py</code>.</p><p>Next check the <a href="#user-guide">User Guide</a> section on the semantic completer that
- you are using. For C/C++/Objective-C/Objective-C++/CUDA, you <em>must</em> read <a href="#c-family-semantic-completion">this
- section</a>.</p><p>Finally, check the <a href="https://github.com/ycm-core/YouCompleteMe/wiki/FAQ">FAQ</a>.</p><p>If, after reading the installation and user guides, and checking the FAQ, you're
- still having trouble, check the <a href="#contact">contacts</a> section below for how to
- get in touch.</p><p>Please do <strong>NOT</strong> go to #vim on freenode for support. Please contact the
- YouCompleteMe maintainers directly using the <a href="#contact">contact details</a> below.</p><h2 id="contents">Contents</h2><ul>
- <li><a href="#intro">Intro</a></li>
- <li><a href="#installation">Installation</a><ul>
- <li><a href="#macos">macOS</a></li>
- <li><a href="#linux-64-bit">Linux 64-bit</a></li>
- <li><a href="#windows">Windows</a></li>
- <li><a href="#freebsdopenbsd">FreeBSD/OpenBSD</a></li>
- <li><a href="#full-installation-guide">Full Installation Guide</a></li>
- </ul>
- </li>
- <li><a href="#quick-feature-summary">Quick Feature Summary</a></li>
- <li><a href="#user-guide">User Guide</a><ul>
- <li><a href="#general-usage">General Usage</a></li>
- <li><a href="#client-server-architecture">Client-Server Architecture</a></li>
- <li><a href="#completion-string-ranking">Completion String Ranking</a></li>
- <li><a href="#general-semantic-completion">General Semantic Completion</a></li>
- <li><a href="#c-family-semantic-completion">C-family Semantic Completion</a></li>
- <li><a href="#java-semantic-completion">Java Semantic Completion</a></li>
- <li><a href="#c-semantic-completion">C# Semantic Completion</a></li>
- <li><a href="#python-semantic-completion">Python Semantic Completion</a></li>
- <li><a href="#rust-semantic-completion">Rust Semantic Completion</a></li>
- <li><a href="#go-semantic-completion">Go Semantic Completion</a></li>
- <li><a href="#javascript-and-typescript-semantic-completion">JavaScript and TypeScript Semantic Completion</a></li>
- <li><a href="#semantic-completion-for-other-languages">Semantic Completion for Other Languages</a></li>
- <li><a href="#lsp-configuration">LSP Configuration</a></li>
- <li><a href="#writing-new-semantic-completers">Writing New Semantic Completers</a></li>
- <li><a href="#diagnostic-display">Diagnostic Display</a><ul>
- <li><a href="#diagnostic-highlighting-groups">Diagnostic Highlighting Groups</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li><a href="#commands">Commands</a><ul>
- <li><a href="#ycmcompleter-subcommands">YcmCompleter subcommands</a><ul>
- <li><a href="#goto-commands">GoTo Commands</a></li>
- <li><a href="#semantic-information-commands">Semantic Information Commands</a></li>
- <li><a href="#refactoring-commands">Refactoring Commands</a></li>
- <li><a href="#miscellaneous-commands">Miscellaneous Commands</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li><a href="#functions">Functions</a></li>
- <li><a href="#autocommands">Autocommands</a></li>
- <li><a href="#options">Options</a></li>
- <li><a href="#faq">FAQ</a></li>
- <li><a href="#contributor-code-of-conduct">Contributor Code of Conduct</a></li>
- <li><a href="#contact">Contact</a></li>
- <li><a href="#license">License</a></li>
- </ul><h2 id="intro">Intro</h2><p>YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for
- <a href="https://www.vim.org/">Vim</a>. It has several completion engines:</p><ul>
- <li>an identifier-based engine that works with every programming language,</li>
- <li>a powerful <a href="https://clang.llvm.org/extra/clangd.html">clangd</a>-based engine that provides native semantic code
- completion for C/C++/Objective-C/Objective-C++/CUDA (from now on referred to
- as "the C-family languages"),</li>
- <li>a <a href="https://github.com/davidhalter/jedi">Jedi</a>-based completion engine for Python 2 and 3,</li>
- <li>an <a href="https://github.com/OmniSharp/omnisharp-roslyn">OmniSharp-Roslyn</a>-based completion engine for C#,</li>
- <li>a <a href="https://github.com/golang/go/wiki/gopls">Gopls</a>-based completion engine for Go,</li>
- <li>a <a href="https://github.com/Microsoft/TypeScript/tree/master/src/server">TSServer</a>-based completion engine for JavaScript and TypeScript,</li>
- <li>a <a href="https://github.com/rust-lang/rls">rls</a>-based completion engine for Rust,</li>
- <li>a <a href="https://github.com/eclipse/eclipse.jdt.ls">jdt.ls</a>-based completion engine for Java.</li>
- <li>a <a href="#plugging-an-arbitrary-lsp-server">generic Language Server Protocol implementation for any language</a></li>
- <li>and an omnifunc-based completer that uses data from Vim's omnicomplete system
- to provide semantic completions for many other languages (Ruby, PHP etc.).</li>
- </ul><p><img alt="YouCompleteMe GIF completion demo" src="https://i.imgur.com/0OP4ood.gif"/></p><p>Here's an explanation of what happens in the last GIF demo above.</p><p>First, realize that <strong>no keyboard shortcuts had to be pressed</strong> to get the list
- of completion candidates at any point in the demo. The user just types and the
- suggestions pop up by themselves. If the user doesn't find the completion
- suggestions relevant and/or just wants to type, they can do so; the completion
- engine will not interfere.</p><p>When the user sees a useful completion string being offered, they press the TAB
- key to accept it. This inserts the completion string. Repeated presses of the
- TAB key cycle through the offered completions.</p><p>If the offered completions are not relevant enough, the user can continue typing
- to further filter out unwanted completions.</p><p>A critical thing to notice is that the completion <strong>filtering is NOT based on
- the input being a string prefix of the completion</strong> (but that works too). The
- input needs to be a <em><a href="https://en.wikipedia.org/wiki/Subsequence">subsequence</a> match</em> of a completion. This is a fancy way
- of saying that any input characters need to be present in a completion string in
- the order in which they appear in the input. So <code>abc</code> is a subsequence of
- <code>xaybgc</code>, but not of <code>xbyxaxxc</code>. After the filter, a complicated sorting system
- ranks the completion strings so that the most relevant ones rise to the top of
- the menu (so you usually need to press TAB just once).</p><p><strong>All of the above works with any programming language</strong> because of the
- identifier-based completion engine. It collects all of the identifiers in the
- current file and other files you visit (and your tags files) and searches them
- when you type (identifiers are put into per-filetype groups).</p><p>The demo also shows the semantic engine in use. When the user presses <code>.</code>, <code>-></code>
- or <code>::</code> while typing in insert mode (for C++; different triggers are used for
- other languages), the semantic engine is triggered (it can also be triggered
- with a keyboard shortcut; see the rest of the docs).</p><p>The last thing that you can see in the demo is YCM's diagnostic display features
- (the little red X that shows up in the left gutter; inspired by <a href="https://github.com/scrooloose/syntastic">Syntastic</a>)
- if you are editing a C-family file. As the completer engine compiles your file
- and detects warnings or errors, they will be presented in various ways. You
- don't need to save your file or press any keyboard shortcut to trigger this, it
- "just happens" in the background.</p><p>In essence, YCM obsoletes the following Vim plugins because it has all of their
- features plus extra:</p><ul>
- <li>clang_complete</li>
- <li>AutoComplPop</li>
- <li>Supertab</li>
- <li>neocomplcache</li>
- </ul><p><strong>And that's not all...</strong></p><p>YCM might be the only vim completion engine with the correct Unicode support.
- Though we do assume UTF-8 everywhere.</p><p><img alt="YouCompleteMe GIF unicode demo" src="https://user-images.githubusercontent.com/10026824/34471853-af9cf32a-ef53-11e7-8229-de534058ddc4.gif"/></p><p>YCM also provides <a href="#quick-feature-summary">semantic IDE-like features</a> in a
- number of languages, including:</p><ul>
- <li>displaying signature help (argument hints) when entering the arguments to a
- function call (Vim only)</li>
- <li><a href="#goto-commands">finding declarations, definitions, usages</a>, etc.
- of identifiers,</li>
- <li><a href="#the-gettype-subcommand">displaying type information</a> for classes,
- variables, functions etc.,</li>
- <li>displaying documentation for methods, members, etc. in the <a href="#the-getdoc-subcommand">preview
- window</a>, or in a
- <a href="#the-gycm_auto_hover-option">popup next to the cursor</a> (Vim only)</li>
- <li><a href="#the-fixit-subcommand">fixing common coding errors</a>, like missing
- semi-colons, typos, etc.,</li>
- <li><a href="#the-refactorrename-subcommand">semantic renaming</a> of variables across files,</li>
- <li>formatting code,</li>
- <li>removing unused imports, sorting imports, etc.</li>
- </ul><p>For example, here's a demo of signature help:</p><p><img alt="Signature Help Early Demo" src="https://user-images.githubusercontent.com/10584846/58738348-5060da80-83fd-11e9-9537-d07fdbf4554c.gif"/></p><p>Below we can see YCM being able to do a few things:</p><ul>
- <li>Retrieve references across files</li>
- <li>Go to declaration/definition</li>
- <li>Expand <code>auto</code> in C++</li>
- <li>Fix some common errors with <code>FixIt</code></li>
- <li>Not shown in the gif is <code>GoToImplementation</code> and <code>GoToType</code>
- for servers that support it.</li>
- </ul><p><img alt="YouCompleteMe GIF subcommands demo" src="https://i.imgur.com/nmUUbdl.gif"/></p><p>And here's some documentation being shown in a hover popup, automatically and
- manually:</p><p><img alt="hover demo" src="https://user-images.githubusercontent.com/10584846/80312146-91af6500-87db-11ea-996b-7396f3134d1f.gif"/></p><p>Features vary by file type, so make sure to check out the <a href="#quick-feature-summary">file type feature
- summary</a> and the
- <a href="#ycmcompleter-subcommands">full list of completer subcommands</a> to
- find out what's available for your favourite languages.</p><p>You'll also find that YCM has filepath completers (try typing <code>./</code> in a file)
- and a completer that integrates with <a href="https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt">UltiSnips</a>.</p><h2 id="installation">Installation</h2><h3 id="macos">macOS</h3><h4 id="quick-start-installing-all-completers">Quick start, installing all completers</h4><ul>
- <li>Install YCM plugin via <a href="https://github.com/VundleVim/Vundle.vim#about">Vundle</a></li>
- <li>Install cmake, macvim and python; Note that the <em>system</em> vim is not supported.</li>
- </ul><p> </p><pre><code>brew install cmake macvim python
- </code></pre><ul>
- <li>Install mono, go, node and npm</li>
- </ul><p> </p><pre><code>brew install mono go nodejs
- </code></pre><ul>
- <li>Compile YCM</li>
- </ul><p> </p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- python3 install.py --all
- </code></pre><ul>
- <li>For plugging an arbitrary LSP server, check <a href="#plugging-an-arbitrary-lsp-server">the relevant section</a></li>
- </ul><h4 id="explanation-for-the-quick-start">Explanation for the quick start</h4><p>These instructions (using <code>install.py</code>) are the quickest way to install
- YouCompleteMe, however they may not work for everyone. If the following
- instructions don't work for you, check out the <a href="#full-installation-guide">full installation
- guide</a>.</p><p><a href="https://macvim-dev.github.io/macvim/">MacVim</a> is required. YCM won't work with the pre-installed Vim from Apple as
- its Python support is broken. If you don't already use <a href="https://macvim-dev.github.io/macvim/">MacVim</a>, install it
- with <a href="https://brew.sh">Homebrew</a>. Install CMake as well:</p><pre><code>brew install cmake macvim
- </code></pre><p>Install YouCompleteMe with <a href="https://github.com/VundleVim/Vundle.vim#about">Vundle</a>.</p><p><strong>Remember:</strong> YCM is a plugin with a compiled component. If you <strong>update</strong> YCM
- using Vundle and the <code>ycm_core</code> library APIs have changed (happens
- rarely), YCM will notify you to recompile it. You should then rerun the install
- process.</p><p><strong>NOTE:</strong> If you want C-family completion, you MUST have the latest Xcode
- installed along with the latest Command Line Tools (they are installed
- automatically when you run <code>clang</code> for the first time, or manually by running
- <code>xcode-select --install</code>)</p><p>Compiling YCM <strong>with</strong> semantic support for C-family languages through
- <strong>clangd</strong>:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- ./install.py --clangd-completer
- </code></pre><p>Compiling YCM <strong>without</strong> semantic support for C-family languages:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- ./install.py
- </code></pre><p>The following additional language support options are available:</p><ul>
- <li>C# support: install Mono with <a href="https://brew.sh">Homebrew</a> or by downloading the <a href="https://www.mono-project.com/docs/getting-started/install/mac/">Mono
- macOS package</a> and add <code>--cs-completer</code> when calling
- <code>install.py</code>.</li>
- <li>Go support: install <a href="https://golang.org/doc/install">Go</a> and add <code>--go-completer</code> when calling
- <code>install.py</code>.</li>
- <li>JavaScript and TypeScript support: install <a href="https://docs.npmjs.com/getting-started/installing-node#1-install-nodejs--npm">Node.js and npm</a> and
- add <code>--ts-completer</code> when calling <code>install.py</code>.</li>
- <li>Rust support: add <code>--rust-completer</code> when calling <code>install.py</code>.</li>
- <li>Java support: install <a href="https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">JDK8 (version 8 required)</a> and add
- <code>--java-completer</code> when calling <code>install.py</code>.</li>
- </ul><p>To simply compile with everything enabled, there's a <code>--all</code> flag. You need to
- specify it manually by adding <code>--clangd-completer</code>. So, to install with all
- language features, ensure <code>xbuild</code>, <code>go</code>, <code>node</code> and <code>npm</code> tools
- are installed and in your <code>PATH</code>, then simply run:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- ./install.py --all
- </code></pre><p>That's it. You're done. Refer to the <em>User Guide</em> section on how to use YCM.
- Don't forget that if you want the C-family semantic completion engine to work,
- you will need to provide the compilation flags for your project to YCM. It's all
- in the User Guide.</p><p>YCM comes with sane defaults for its options, but you still may want to take a
- look at what's available for configuration. There are a few interesting options
- that are conservatively turned off by default that you may want to turn on.</p><h3 id="linux-64-bit">Linux 64-bit</h3><h4 id="quick-start-installing-all-completers">Quick start, installing all completers</h4><ul>
- <li>Install YCM plugin via <a href="https://github.com/VundleVim/Vundle.vim#about">Vundle</a></li>
- <li>Install cmake, vim and python</li>
- </ul><p> </p><pre><code>apt install build-essential cmake vim python3-dev
- </code></pre><ul>
- <li>Install mono-complete, go, node and npm</li>
- <li>Compile YCM</li>
- </ul><p> </p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- python3 install.py --all
- </code></pre><ul>
- <li>For plugging an arbitrary LSP server, check <a href="#plugging-an-arbitrary-lsp-server">the relevant section</a></li>
- </ul><h4 id="explanation-for-the-quick-start">Explanation for the quick start</h4><p>These instructions (using <code>install.py</code>) are the quickest way to install
- YouCompleteMe, however they may not work for everyone. If the following
- instructions don't work for you, check out the <a href="#full-installation-guide">full installation
- guide</a>.</p><p>Make sure you have Vim 7.4.1578 with Python 3 support. The Vim
- package on Fedora 27 and later and the pre-installed Vim on Ubuntu 16.04 and
- later are recent enough. You can see the version of Vim installed by running
- <code>vim --version</code>. If the version is too old, you may need to <a href="https://github.com/ycm-core/YouCompleteMe/wiki/Building-Vim-from-source">compile Vim from
- source</a> (don't worry, it's easy).</p><p><strong>NOTE</strong>: For all features, such as signature help, use Vim 8.1.1875 or later.</p><p>Install YouCompleteMe with <a href="https://github.com/VundleVim/Vundle.vim#about">Vundle</a>.</p><p><strong>Remember:</strong> YCM is a plugin with a compiled component. If you <strong>update</strong> YCM
- using Vundle and the <code>ycm_core</code> library APIs have changed (happens rarely), YCM
- will notify you to recompile it. You should then rerun the install process.</p><p>Install development tools, CMake, and Python headers:</p><ul>
- <li>Fedora 27 and later:</li>
- </ul><p> </p><pre><code> sudo dnf install cmake gcc-c++ make python3-devel
- </code></pre><ul>
- <li>Ubuntu 14.04:</li>
- </ul><p> </p><pre><code> sudo apt install build-essential cmake3 python3-dev
- </code></pre><ul>
- <li>Ubuntu 16.04 and later:</li>
- </ul><p> </p><pre><code> sudo apt install build-essential cmake python3-dev
- </code></pre><p>Compiling YCM <strong>with</strong> semantic support for C-family languages through
- <strong>clangd</strong>:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- python3 install.py --clangd-completer
- </code></pre><p>Compiling YCM <strong>without</strong> semantic support for C-family languages:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- python3 install.py
- </code></pre><p>The following additional language support options are available:</p><ul>
- <li>C# support: install <a href="https://www.mono-project.com/download/stable/#download-lin">Mono</a> and add <code>--cs-completer</code>
- when calling <code>install.py</code>.</li>
- <li>Go support: install <a href="https://golang.org/doc/install">Go</a> and add <code>--go-completer</code> when calling
- <code>install.py</code>.</li>
- <li>JavaScript and TypeScript support: install <a href="https://docs.npmjs.com/getting-started/installing-node#1-install-nodejs--npm">Node.js and npm</a> and
- add <code>--ts-completer</code> when calling <code>install.py</code>.</li>
- <li>Rust support: add <code>--rust-completer</code> when calling <code>install.py</code>.</li>
- <li>Java support: install <a href="https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">JDK8 (version 8 required)</a> and add
- <code>--java-completer</code> when calling <code>install.py</code>.</li>
- </ul><p>To simply compile with everything enabled, there's a <code>--all</code> flag. You need to
- specify it manually by adding <code>--clangd-completer</code>. So, to install with all
- language features, ensure <code>xbuild</code>, <code>go</code>, <code>node</code>, <code>npm</code> and tools
- are installed and in your <code>PATH</code>, then simply run:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- python3 install.py --all
- </code></pre><p>That's it. You're done. Refer to the <em>User Guide</em> section on how to use YCM.
- Don't forget that if you want the C-family semantic completion engine to work,
- you will need to provide the compilation flags for your project to YCM. It's all
- in the User Guide.</p><p>YCM comes with sane defaults for its options, but you still may want to take a
- look at what's available for configuration. There are a few interesting options
- that are conservatively turned off by default that you may want to turn on.</p><h3 id="windows">Windows</h3><h4 id="quick-start-installing-all-completers">Quick start, installing all completers</h4><ul>
- <li>Install YCM plugin via <a href="https://github.com/VundleVim/Vundle.vim#about">Vundle</a></li>
- <li>Install <a href="https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15">Visual Studio Build Tools 2017</a></li>
- <li>Install cmake, vim and python</li>
- <li>Install go, node and npm</li>
- <li>Compile YCM</li>
- </ul><p> </p><pre><code>cd YouCompleteMe
- python3 install.py --all
- </code></pre><ul>
- <li>Add <code>set encoding=utf-8</code> to your <a href="https://vimhelp.appspot.com/starting.txt.html#vimrc">vimrc</a></li>
- <li>For plugging an arbitrary LSP server, check <a href="#plugging-an-arbitrary-lsp-server">the relevant section</a></li>
- </ul><h4 id="explanation-for-the-quick-start">Explanation for the quick start</h4><p>These instructions (using <code>install.py</code>) are the quickest way to install
- YouCompleteMe, however they may not work for everyone. If the following
- instructions don't work for you, check out the <a href="#full-installation-guide">full installation
- guide</a>.</p><p><strong>Important:</strong> we assume that you are using the <code>cmd.exe</code> command prompt and
- that you know how to add an executable to the PATH environment variable.</p><p>Make sure you have at least Vim 7.4.1578 with Python 3 support. You
- can check the version and which Python is supported by typing <code>:version</code> inside
- Vim. Look at the features included: <code>+python3/dyn</code> for Python 3.
- Take note of the Vim architecture, i.e. 32 or
- 64-bit. It will be important when choosing the Python installer. We recommend
- using a 64-bit client. <a href="https://github.com/vim/vim-win32-installer/releases">Daily updated installers of 32-bit and 64-bit Vim with
- Python 3 support</a> are available.</p><p><strong>NOTE</strong>: For all features, such as signature help, use Vim 8.1.1875 or later.</p><p>Add the line:</p><pre><code>set encoding=utf-8
- </code></pre><p>to your <a href="https://vimhelp.appspot.com/starting.txt.html#vimrc">vimrc</a> if not already present. This option is required by YCM. Note
- that it does not prevent you from editing a file in another encoding than UTF-8.
- You can do that by specifying <a href="http://vimdoc.sourceforge.net/htmldoc/editing.html#++enc">the <code>++enc</code> argument</a> to the <code>:e</code> command.</p><p>Install YouCompleteMe with <a href="https://github.com/VundleVim/Vundle.vim#about">Vundle</a>.</p><p><strong>Remember:</strong> YCM is a plugin with a compiled component. If you <strong>update</strong> YCM
- using Vundle and the <code>ycm_core</code> library APIs have changed (happens
- rarely), YCM will notify you to recompile it. You should then rerun the install
- process.</p><p>Download and install the following software:</p><ul>
- <li><a href="https://www.python.org/downloads/windows/">Python 3</a>. Be sure to pick the version
- corresponding to your Vim architecture. It is <em>Windows x86</em> for a 32-bit Vim
- and <em>Windows x86-64</em> for a 64-bit Vim. We recommend installing Python 3.
- Additionally, the version of Python you install must match up exactly with
- the version of Python that Vim is looking for. Type <code>:version</code> and look at the
- bottom of the page at the list of compiler flags. Look for flags that look
- similar to <code>-DDYNAMIC_PYTHON3_DLL=\"python36.dll\"</code>. This indicates
- that Vim is looking for Python 3.6. You'll need one or the other installed,
- matching the version number exactly.</li>
- <li><a href="https://cmake.org/download/">CMake</a>. Add CMake executable to the PATH environment
- variable.</li>
- <li><a href="https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15">Visual Studio Build Tools 2017</a>. During setup,
- select <em>Visual C++ build tools</em> in <em>Workloads</em>.</li>
- </ul><p>Compiling YCM <strong>with</strong> semantic support for C-family languages through
- <strong>clangd</strong>:</p><pre><code>cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
- python install.py --clangd-completer
- </code></pre><p>Compiling YCM <strong>without</strong> semantic support for C-family languages:</p><pre><code>cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
- python install.py
- </code></pre><p>The following additional language support options are available:</p><ul>
- <li>C# support: add <code>--cs-completer</code> when calling <code>install.py</code>.
- Be sure that <a href="https://stackoverflow.com/questions/6319274/how-do-i-run-msbuild-from-the-command-line-using-windows-sdk-7-1">the build utility <code>msbuild</code> is in your PATH</a>.</li>
- <li>Go support: install <a href="https://golang.org/doc/install">Go</a> and add <code>--go-completer</code> when calling
- <code>install.py</code>.</li>
- <li>JavaScript and TypeScript support: install <a href="https://docs.npmjs.com/getting-started/installing-node#1-install-nodejs--npm">Node.js and npm</a> and
- add <code>--ts-completer</code> when calling <code>install.py</code>.</li>
- <li>Rust support: add <code>--rust-completer</code> when calling <code>install.py</code>.</li>
- <li>Java support: install <a href="https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">JDK8 (version 8 required)</a> and add
- <code>--java-completer</code> when calling <code>install.py</code>.</li>
- </ul><p>To simply compile with everything enabled, there's a <code>--all</code> flag. You need to
- specify it manually by adding <code>--clangd-completer</code>. So, to install with all
- language features, ensure <code>msbuild</code>, <code>go</code>, <code>node</code> and <code>npm</code> tools
- are installed and in your <code>PATH</code>, then simply run:</p><pre><code>cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
- python install.py --all
- </code></pre><p>You can specify the Microsoft Visual C++ (MSVC) version using the <code>--msvc</code>
- option. YCM officially supports MSVC 14 (Visual Studio 2015), 15 (2017) and
- MSVC 16 (Visual Studio 2019).</p><p>That's it. You're done. Refer to the <em>User Guide</em> section on how to use YCM.
- Don't forget that if you want the C-family semantic completion engine to work,
- you will need to provide the compilation flags for your project to YCM. It's all
- in the User Guide.</p><p>YCM comes with sane defaults for its options, but you still may want to take a
- look at what's available for configuration. There are a few interesting options
- that are conservatively turned off by default that you may want to turn on.</p><h3 id="freebsdopenbsd">FreeBSD/OpenBSD</h3><h4 id="quick-start-installing-all-completers">Quick start, installing all completers</h4><ul>
- <li>Install YCM plugin via <a href="https://github.com/VundleVim/Vundle.vim#about">Vundle</a></li>
- <li>Install cmake</li>
- </ul><p> </p><pre><code>pkg install cmake
- </code></pre><ul>
- <li>Install xbuild, go, node and npm</li>
- <li>Compile YCM</li>
- </ul><p> </p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- python3 install.py --all
- </code></pre><ul>
- <li>For plugging an arbitrary LSP server, check <a href="#plugging-an-arbitrary-lsp-server">the relevant section</a></li>
- </ul><h4 id="explanation-for-the-quick-start">Explanation for the quick start</h4><p>These instructions (using <code>install.py</code>) are the quickest way to install
- YouCompleteMe, however they may not work for everyone. If the following
- instructions don't work for you, check out the <a href="#full-installation-guide">full installation
- guide</a>.</p><p><strong>NOTE:</strong> OpenBSD / FreeBSD are not officially supported platforms by YCM.</p><p>Make sure you have Vim 7.4.1578 with Python 3 support.</p><p><strong>NOTE</strong>: For all features, such as signature help, use Vim 8.1.1875 or later.</p><p>OpenBSD 5.5 and later have a Vim that's recent enough. You can see the version of
- Vim installed by running <code>vim --version</code>.</p><p>For FreeBSD 11.x, the requirement is cmake:</p><pre><code>pkg install cmake
- </code></pre><p>Install YouCompleteMe with <a href="https://github.com/VundleVim/Vundle.vim#about">Vundle</a>.</p><p><strong>Remember:</strong> YCM is a plugin with a compiled component. If you <strong>update</strong> YCM
- using Vundle and the <code>ycm_core</code> library APIs have changed (happens
- rarely), YCM will notify you to recompile it. You should then rerun the install
- process.</p><p>Compiling YCM <strong>with</strong> semantic support for C-family languages through
- <strong>clangd</strong>:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- ./install.py --clangd-completer
- </code></pre><p>Compiling YCM <strong>without</strong> semantic support for C-family languages:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- ./install.py
- </code></pre><p>If the <code>python</code> executable is not present, or the default <code>python</code> is not the
- one that should be compiled against, specify the python interpreter explicitly:</p><pre><code>python3 install.py --clangd-completer
- </code></pre><p>The following additional language support options are available:</p><ul>
- <li>C# support: install Mono and add <code>--cs-completer</code> when calling
- <code>./install.py</code>.</li>
- <li>Go support: install <a href="https://golang.org/doc/install">Go</a> and add <code>--go-completer</code> when calling
- <code>./install.py</code>.</li>
- <li>JavaScript and TypeScript support: install <a href="https://docs.npmjs.com/getting-started/installing-node#1-install-nodejs--npm">Node.js and npm</a> and
- add <code>--ts-completer</code> when calling <code>install.py</code>.</li>
- <li>Rust support: add <code>--rust-completer</code> when calling <code>./install.py</code>.</li>
- <li>Java support: install <a href="https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">JDK8 (version 8 required)</a> and add
- <code>--java-completer</code> when calling <code>./install.py</code>.</li>
- </ul><p>To simply compile with everything enabled, there's a <code>--all</code> flag. You need to
- specify it manually by adding <code>--clangd-completer</code>. So, to install with all
- language features, ensure <code>xbuild</code>, <code>go</code>, <code>node</code>, <code>npm</code> and tools
- are installed and in your <code>PATH</code>, then simply run:</p><pre><code>cd ~/.vim/bundle/YouCompleteMe
- ./install.py --all
- </code></pre><p>That's it. You're done. Refer to the <em>User Guide</em> section on how to use YCM.
- Don't forget that if you want the C-family semantic completion engine to work,
- you will need to provide the compilation flags for your project to YCM. It's all
- in the User Guide.</p><p>YCM comes with sane defaults for its options, but you still may want to take a
- look at what's available for configuration. There are a few interesting options
- that are conservatively turned off by default that you may want to turn on.</p><h3 id="full-installation-guide">Full Installation Guide</h3><p>The <a href="https://github.com/ycm-core/YouCompleteMe/wiki/Full-Installation-Guide">full installation guide</a> has been moved to the wiki.</p><h2 id="quick-feature-summary">Quick Feature Summary</h2><h3 id="general-all-languages">General (all languages)</h3><ul>
- <li>Super-fast identifier completer including tags files and syntax elements</li>
- <li>Intelligent suggestion ranking and filtering</li>
- <li>File and path suggestions</li>
- <li>Suggestions from Vim's OmniFunc</li>
- <li>UltiSnips snippet suggestions</li>
- </ul><h3 id="c-family-languages-c-c-objective-c-objective-c-cuda">C-family languages (C, C++, Objective C, Objective C++, CUDA)</h3><ul>
- <li>Semantic auto-completion with automatic fixes</li>
- <li>Signature help</li>
- <li>Real-time diagnostic display</li>
- <li>Go to include/declaration/definition (<code>GoTo</code>, etc.)</li>
- <li>Find Symbol (<code>GoToSymbol</code>)</li>
- <li>View documentation comments for identifiers (<code>GetDoc</code>)</li>
- <li>Type information for identifiers (<code>GetType</code>)</li>
- <li>Automatically fix certain errors (<code>FixIt</code>)</li>
- <li>Reference finding (<code>GoToReferences</code>)</li>
- <li>Renaming symbols (<code>RefactorRename <new name></code>)</li>
- <li>Code formatting (<code>Format</code>)</li>
- </ul><h3 id="c">C♯</h3><ul>
- <li>Semantic auto-completion</li>
- <li>Signature help</li>
- <li>Real-time diagnostic display</li>
- <li>Go to declaration/definition (<code>GoTo</code>, etc.)</li>
- <li>Go to implementation (<code>GoToImplementation</code>)</li>
- <li>Find Symbol (<code>GoToSymbol</code>)</li>
- <li>View documentation comments for identifiers (<code>GetDoc</code>)</li>
- <li>Type information for identifiers (<code>GetType</code>)</li>
- <li>Automatically fix certain errors (<code>FixIt</code>)</li>
- <li>Management of OmniSharp-Roslyn server instance</li>
- <li>Renaming symbols (<code>RefactorRename <new name></code>)</li>
- <li>Code formatting (<code>Format</code>)</li>
- </ul><h3 id="python">Python</h3><ul>
- <li>Semantic auto-completion</li>
- <li>Signature help</li>
- <li>Go to definition (<code>GoTo</code>)</li>
- <li>Find Symbol (<code>GoToSymbol</code>)</li>
- <li>Reference finding (<code>GoToReferences</code>)</li>
- <li>View documentation comments for identifiers (<code>GetDoc</code>)</li>
- <li>Type information for identifiers (<code>GetType</code>)</li>
- </ul><h3 id="go">Go</h3><ul>
- <li>Semantic auto-completion</li>
- <li>Signature help</li>
- <li>Real-time diagnostic display</li>
- <li>Go to declaration/definition (<code>GoTo</code>, etc.)</li>
- <li>Go to type definition (<code>GoToType</code>)</li>
- <li>Go to implementation (<code>GoToImplementation</code>)</li>
- <li>Automatically fix certain errors (<code>FixIt</code>)</li>
- <li>View documentation comments for identifiers (<code>GetDoc</code>)</li>
- <li>Type information for identifiers (<code>GetType</code>)</li>
- <li>Code formatting (<code>Format</code>)</li>
- <li>Management of <code>gopls</code> server instance</li>
- </ul><h3 id="javascript-and-typescript">JavaScript and TypeScript</h3><ul>
- <li>Semantic auto-completion with automatic import insertion</li>
- <li>Signature help</li>
- <li>Real-time diagnostic display</li>
- <li>Go to definition (<code>GoTo</code>, <code>GoToDefinition</code>, and <code>GoToDeclaration</code> are
- identical)</li>
- <li>Go to type definition (<code>GoToType</code>)</li>
- <li>Go to implementation (<code>GoToImplementation</code>)</li>
- <li>Find Symbol (<code>GoToSymbol</code>)</li>
- <li>Reference finding (<code>GoToReferences</code>)</li>
- <li>View documentation comments for identifiers (<code>GetDoc</code>)</li>
- <li>Type information for identifiers (<code>GetType</code>)</li>
- <li>Automatically fix certain errors (<code>FixIt</code>)</li>
- <li>Renaming symbols (<code>RefactorRename <new name></code>)</li>
- <li>Code formatting (<code>Format</code>)</li>
- <li>Organize imports (<code>OrganizeImports</code>)</li>
- <li>Management of <code>TSServer</code> server instance</li>
- </ul><h3 id="rust">Rust</h3><ul>
- <li>Semantic auto-completion</li>
- <li>Real-time diagnostic display</li>
- <li>Go to declaration/definition (<code>GoTo</code>, etc.)</li>
- <li>Go to implementation (<code>GoToImplementation</code>)</li>
- <li>Reference finding (<code>GoToReferences</code>)</li>
- <li>View documentation comments for identifiers (<code>GetDoc</code>)</li>
- <li>Automatically fix certain errors (<code>FixIt</code>)</li>
- <li>Type information for identifiers (<code>GetType</code>)</li>
- <li>Renaming symbols (<code>RefactorRename <new name></code>)</li>
- <li>Code formatting (<code>Format</code>)</li>
- <li>Execute custom server command (<code>ExecuteCommand <args></code>)</li>
- <li>Management of <code>rls</code> server instance</li>
- </ul><h3 id="java">Java</h3><ul>
- <li>Semantic auto-completion with automatic import insertion</li>
- <li>Signature help</li>
- <li>Real-time diagnostic display</li>
- <li>Go to definition (<code>GoTo</code>, <code>GoToDefinition</code>, and <code>GoToDeclaration</code> are
- identical)</li>
- <li>Go to type definition (<code>GoToType</code>)</li>
- <li>Go to implementation (<code>GoToImplementation</code>)</li>
- <li>Find Symbol (<code>GoToSymbol</code>)</li>
- <li>Reference finding (<code>GoToReferences</code>)</li>
- <li>View documentation comments for identifiers (<code>GetDoc</code>)</li>
- <li>Type information for identifiers (<code>GetType</code>)</li>
- <li>Automatically fix certain errors including code generation (<code>FixIt</code>)</li>
- <li>Renaming symbols (<code>RefactorRename <new name></code>)</li>
- <li>Code formatting (<code>Format</code>)</li>
- <li>Organize imports (<code>OrganizeImports</code>)</li>
- <li>Detection of java projects</li>
- <li>Execute custom server command (<code>ExecuteCommand <args></code>)</li>
- <li>Management of <code>jdt.ls</code> server instance</li>
- </ul><h2 id="user-guide">User Guide</h2><h3 id="general-usage">General Usage</h3><p>If the offered completions are too broad, keep typing characters; YCM will
- continue refining the offered completions based on your input.</p><p>Filtering is "smart-case" and "smart-<a href="https://www.unicode.org/glossary/#diacritic">diacritic</a>" sensitive; if you are
- typing only lowercase letters, then it's case-insensitive. If your input
- contains uppercase letters, then the uppercase letters in your query must
- match uppercase letters in the completion strings (the lowercase letters still
- match both). On top of that, a letter with no diacritic marks will match that
- letter with or without marks:</p><table>
- <tbody>
- <tr>
- <th>matches</th>
- <th>foo</th>
- <th>fôo</th>
- <th>fOo</th>
- <th>fÔo</th>
- </tr>
- <tr>
- <th>foo</th>
- <td>✔️</td>
- <td>✔️</td>
- <td>✔️</td>
- <td>✔️</td>
- </tr>
- <tr>
- <th>fôo</th>
- <td>❌</td>
- <td>✔️</td>
- <td>❌</td>
- <td>✔️</td>
- </tr>
- <tr>
- <th>fOo</th>
- <td>❌</td>
- <td>❌</td>
- <td>✔️</td>
- <td>✔️</td>
- </tr>
- <tr>
- <th>fÔo</th>
- <td>❌</td>
- <td>❌</td>
- <td>❌</td>
- <td>✔️</td>
- </tr>
- </tbody>
- </table><p>Use the TAB key to accept a completion and continue pressing TAB to cycle
- through the completions. Use Shift-TAB to cycle backwards. Note that if you're
- using console Vim (that is, not Gvim or MacVim) then it's likely that the
- Shift-TAB binding will not work because the console will not pass it to Vim.
- You can remap the keys; see the <a href="#options">Options</a> section below.</p><p>Knowing a little bit about how YCM works internally will prevent confusion. YCM
- has several completion engines: an identifier-based completer that collects all
- of the identifiers in the current file and other files you visit (and your tags
- files) and searches them when you type (identifiers are put into per-filetype
- groups).</p><p>There are also several semantic engines in YCM. There are libclang-based and
- clangd-based completers that provide semantic completion for C-family languages.
- There's a Jedi-based completer for semantic completion for Python. There's also
- an omnifunc-based completer that uses data from Vim's omnicomplete system to
- provide semantic completions when no native completer exists for that language
- in YCM.</p><p>There are also other completion engines, like the UltiSnips completer and the
- filepath completer.</p><p>YCM automatically detects which completion engine would be the best in any
- situation. On occasion, it queries several of them at once, merges the
- outputs and presents the results to you.</p><h3 id="client-server-architecture">Client-Server Architecture</h3><p>YCM has a client-server architecture; the Vim part of YCM is only a thin client
- that talks to the <a href="https://github.com/ycm-core/ycmd">ycmd HTTP+JSON server</a> that has the vast majority of
- YCM logic and functionality. The server is started and stopped automatically as
- you start and stop Vim.</p><h3 id="completion-string-ranking">Completion String Ranking</h3><p>The subsequence filter removes any completions that do not match the input, but
- then the sorting system kicks in. It's actually very complicated and uses lots
- of factors, but suffice it to say that "word boundary" (WB) subsequence
- character matches are "worth" more than non-WB matches. In effect, this means
- given an input of "gua", the completion "getUserAccount" would be ranked higher
- in the list than the "Fooguxa" completion (both of which are subsequence
- matches). A word-boundary character are all capital characters, characters
- preceded by an underscore and the first letter character in the completion
- string.</p><h3 id="signature-help">Signature Help</h3><p>Signature help is an <strong>experimental</strong> feature for which we value your feedback.
- Valid signatures are displayed in a second popup menu and the current signature
- is highlighed along with the current arguemnt.</p><p>Signature help is triggered in insert mode automatically when
- <code>g:ycm_auto_trigger</code> is enabled and is not supported when it is not enabled.</p><p>The signatures popup is hidden when there are no matching signatures or when you
- leave insert mode. There is no key binding to clear the popup.</p><p>For more details on this feature and a few demos, check out the
- <a href="https://github.com/ycm-core/ycmd/pull/1255">PR that proposed it</a>.</p><h3 id="general-semantic-completion">General Semantic Completion</h3><p>You can use Ctrl+Space to trigger the completion suggestions anywhere, even
- without a string prefix. This is useful to see which top-level functions are
- available for use.</p><h3 id="c-family-semantic-completion">C-family Semantic Completion</h3><p><strong>NOTE:</strong> YCM originally used the <code>libclang</code> based engine for C-family, but
- users should migrate to clangd, as it provides more features and better
- performance. Users who rely on <code>override_filename</code> in their <code>.ycm_extra_conf.py</code>
- will need to stay on the old <code>libclang</code> engine. Instructions on how to stay on
- the old engine are available on <a href="https://github.com/ycm-core/YouCompleteMe/wiki/C-family-Semantic-Completion-through-libclang">the wiki</a>.</p><p>Advantages of clangd over libclang include:</p><ul>
- <li><strong>Project wide indexing</strong>: Clangd has both dynamic and static index support.
- The dynamic index stores up-to-date symbols coming from any files you are
- currently editing, whereas static index contains project-wide symbol
- information. This symbol information is used for code completion and code
- navigation. Whereas libclang is limited to the current translation unit(TU).</li>
- <li><strong>Code navigation</strong>: Clangd provides all the GoTo requests libclang provides and it
- improves those using the above mentioned index information to contain
- project-wide information rather than just the current TU.</li>
- <li><strong>Rename</strong>: Clangd can perform semantic rename operations on the current
- file, whereas libclang doesn’t support such functionality.</li>
- <li><strong>Code Completion</strong>: Clangd can perform code completions at a lower latency
- than libclang; also, it has information about all the symbols in your
- project so it can suggest items outside your current TU and also provides
- proper <code>#include</code> insertions for those items.</li>
- <li><strong>Signature help</strong>: Clangd provides signature help so that you can see the
- names and types of arguments when calling functions.</li>
- <li><strong>Format Code</strong>: Clangd provides code formatting either for the selected
- lines or the whole file, whereas libclang doesn’t have such functionality.</li>
- <li><strong>Performance</strong>: Clangd has faster reparse and code completion times
- compared to libclang.</li>
- </ul><p>In order to perform semantic analysis such as code completion, <code>GoTo</code> and
- diagnostics, YouCompleteMe uses <code>clangd</code>, which makes use of
- clang compiler, sometimes also referred to as llvm. Like any compiler,
- clang also requires a set of compile flags in order to parse your code. Simply
- put: If clang can't parse your code, YouCompleteMe can't provide semantic
- analysis.</p><p>There are 2 methods which can be used to provide compile flags to clang:</p><h4 id="option-1-use-a-compilation-database">Option 1: Use a <a href="https://clang.llvm.org/docs/JSONCompilationDatabase.html">compilation database</a></h4><p>The easiest way to get YCM to compile your code is to use a compilation
- database. A compilation database is usually generated by your build system
- (e.g. <code>CMake</code>) and contains the compiler invocation for each compilation unit in
- your project.</p><p>For information on how to generate a compilation database, see the <a href="https://clang.llvm.org/docs/JSONCompilationDatabase.html">clang
- documentation</a>. In short:</p><ul>
- <li>If using CMake, add <code>-DCMAKE_EXPORT_COMPILE_COMMANDS=ON</code> when configuring (or
- add <code>set( CMAKE_EXPORT_COMPILE_COMMANDS ON )</code> to <code>CMakeLists.txt</code>) and copy or
- symlink the generated database to the root of your project.</li>
- <li>If using Ninja, check out the <code>compdb</code> tool (<code>-t compdb</code>) in its
- <a href="https://ninja-build.org/manual.html">docs</a>.</li>
- <li>If using GNU make, check out <a href="https://pypi.org/project/compiledb/">compiledb</a> or <a href="https://github.com/rizsotto/Bear">Bear</a>.</li>
- <li>For other build systems, check out
- <a href="#option-2-provide-the-flags-manually"><code>.ycm_extra_conf.py</code></a> below.</li>
- </ul><p>If no <a href="#option-2-provide-the-flags-manually"><code>.ycm_extra_conf.py</code></a> is found,
- YouCompleteMe automatically tries to load a compilation database if there is
- one.</p><p>YCM looks for a file named <code>compile_commands.json</code> in the directory of the
- opened file or in any directory above it in the hierarchy (recursively); when
- the file is found before a local <code>.ycm_extra_conf.py</code>, YouCompleteMe stops
- searching the directories and lets clangd take over and handle the flags.</p><h4 id="option-2-provide-the-flags-manually">Option 2: Provide the flags manually</h4><p>If you don't have a compilation database, or aren't able to generate one,
- you have to tell YouCompleteMe how to compile your code some other way.</p><p>Every C-family project is different. It is not possible for YCM to guess what
- compiler flags to supply for your project. Fortunately, YCM provides a mechanism
- for you to generate the flags for a particular file with <em>arbitrary complexity</em>.
- This is achieved by requiring you to provide a Python module which implements a
- trivial function which, given the file name as argument, returns a list of
- compiler flags to use to compile that file.</p><p>YCM looks for a <code>.ycm_extra_conf.py</code> file in the directory of the opened file or
- in any directory above it in the hierarchy (recursively); when the file is
- found, it is loaded (only once!) as a Python module. YCM calls a <code>Settings</code>
- method in that module which should provide it with the information necessary to
- compile the current file. You can also provide a path to a global configuration
- file with the
- <a href="#the-gycm_global_ycm_extra_conf-option"><code>g:ycm_global_ycm_extra_conf</code></a> option,
- which will be used as a fallback. To prevent the execution of malicious code
- from a file you didn't write YCM will ask you once per <code>.ycm_extra_conf.py</code> if
- it is safe to load. This can be disabled and you can white-/blacklist files. See
- the <a href="#the-gycm_confirm_extra_conf-option"><code>g:ycm_confirm_extra_conf</code></a> and
- <a href="#the-gycm_extra_conf_globlist-option"><code>g:ycm_extra_conf_globlist</code></a> options
- respectively.</p><p>This system was designed this way so that the user can perform any arbitrary
- sequence of operations to produce a list of compilation flags YCM should hand
- to Clang.</p><p><strong>NOTE</strong>: It is highly recommended to include <code>-x <language></code> flag to libclang.
- This is so that the correct language is detected, particularly for header files.
- Common values are <code>-x c</code> for C, <code>-x c++</code> for C++, <code>-x objc</code> for Objective-C, and
- <code>-x cuda</code> for CUDA.</p><p>To give you an impression, if your C++ project is trivial, and your usual
- compilation command is: <code>g++ -Wall -Wextra -Werror -o FILE.o FILE.cc</code>, then the
- following <code>.ycm_extra_conf.py</code> is enough to get semantic analysis from
- YouCompleteMe:</p><pre><code class="python">def Settings( **kwargs ):
- return {
- 'flags': [ '-x', 'c++', '-Wall', '-Wextra', '-Werror' ],
- }
- </code></pre><p>As you can see from the trivial example, YCM calls the <code>Settings</code> method which
- returns a dictionary with a single element <code>'flags'</code>. This element is a <code>list</code>
- of compiler flags to pass to libclang for the current file. The absolute path of
- that file is accessible under the <code>filename</code> key of the <code>kwargs</code> dictionary.
- That's it! This is actually enough for most projects, but for complex projects
- it is not uncommon to integrate directly with an existing build system using the
- full power of the Python language.</p><p>For a more elaborate example,
- <a href="https://raw.githubusercontent.com/ycm-core/ycmd/66030cd94299114ae316796f3cad181cac8a007c/.ycm_extra_conf.py">see ycmd's own <code>.ycm_extra_conf.py</code></a>. You should be able to
- use it <em>as a starting point</em>. <strong>Don't</strong> just copy/paste that file somewhere and
- expect things to magically work; <strong>your project needs different flags</strong>. Hint:
- just replace the strings in the <code>flags</code> variable with compilation flags
- necessary for your project. That should be enough for 99% of projects.</p><p>You could also consider using <a href="https://github.com/rdnetto/YCM-Generator">YCM-Generator</a> to generate the
- <code>ycm_extra_conf.py</code> file.</p><h4 id="errors-during-compilation">Errors during compilation</h4><p>If Clang encounters errors when compiling the header files that your file
- includes, then it's probably going to take a long time to get completions. When
- the completion menu finally appears, it's going to have a large number of
- unrelated completion strings (type/function names that are not actually
- members). This is because Clang fails to build a precompiled preamble for your
- file if there are any errors in the included headers and that preamble is key to
- getting fast completions.</p><p>Call the <code>:YcmDiags</code> command to see if any errors or warnings were detected in
- your file.</p><h3 id="java-semantic-completion">Java Semantic Completion</h3><h4 id="java-quick-start">Java quick Start</h4><ol>
- <li>
- <p>Ensure that you have enabled the Java completer. See the
- <a href="#installation">installation guide</a> for details.</p>
- </li>
- <li>
- <p>Create a project file (gradle or maven) file in the root directory of your
- Java project, by following the instructions below.</p>
- </li>
- <li>
- <p>(Optional) <a href="#lsp-configuration">Configure the LSP server</a>. The <a href="https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/Preferences.java">jdt.ls
- configuration options</a> can be found in their codebase.</p>
- </li>
- <li>
- <p>If you previously used Eclim or Syntastic for Java, disable them for Java.</p>
- </li>
- <li>
- <p>Edit a Java file from your project.</p>
- </li>
- </ol><p>For the best experience, we highly recommend at least Vim 8.1.1875 when using
- Java support with YouCompleteMe.</p><h4 id="java-project-files">Java Project Files</h4><p>In order to provide semantic analysis, the Java completion engine requires
- knowledge of your project structure. In particular it needs to know the class
- path to use, when compiling your code. Fortunately <a href="https://github.com/eclipse/eclipse.jdt.ls">jdt.ls</a>
- supports <a href="https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fproject_description_file.html">eclipse project files</a>,
- <a href="https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html">maven projects</a> and <a href="https://docs.gradle.org/current/userguide/tutorial_java_projects.html">gradle projects</a>.</p><p><strong>NOTE:</strong> Our recommendation is to use either maven or gradle projects.</p><h4 id="diagnostic-display---syntastic">Diagnostic display - Syntastic</h4><p>The native support for Java includes YCM's native realtime diagnostics display.
- This can conflict with other diagnostics plugins like Syntastic, so when
- enabling Java support, please <strong>manually disable Syntastic Java diagnostics</strong>.</p><p>Add the following to your <code>vimrc</code>:</p><pre><code class="viml">let g:syntastic_java_checkers = []
- </code></pre><h4 id="diagnostic-display---eclim">Diagnostic display - Eclim</h4><p>The native support for Java includes YCM's native realtime diagnostics display.
- This can conflict with other diagnostics plugins like Eclim, so when enabling
- Java support, please <strong>manually disable Eclim Java diagnostics</strong>.</p><p>Add the following to your <code>vimrc</code>:</p><pre><code class="viml">let g:EclimFileTypeValidate = 0
- </code></pre><p><strong>NOTE</strong>: We recommend disabling Eclim entirely when editing Java with YCM's
- native Java support. This can be done temporarily with <code>:EclimDisable</code>.</p><h4 id="eclipse-projects">Eclipse Projects</h4><p>Eclipse style projects require two files: <a href="https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fproject_description_file.html">.project</a> and
- <a href="https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FIClasspathEntry.html">.classpath</a>.</p><p>If your project already has these files due to previously being set up within
- eclipse, then no setup is required. <a href="https://github.com/eclipse/eclipse.jdt.ls">jdt.ls</a> should load the project just
- fine (it's basically eclipse after all).</p><p>However, if not, it is possible (easy in fact) to craft them manually, though it
- is not recommended. You're better off using gradle or maven (see below).</p><p><a href="https://github.com/ycm-core/ycmd/tree/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_eclipse_project">A simple eclipse style project example</a> can be found in
- the ycmd test directory. Normally all that is required is to copy these files to
- the root of your project and to edit the <code>.classpath</code> to add additional
- libraries, such as:</p><pre><code class="xml"> <classpathentry kind="lib" path="/path/to/external/jar" />
- <classpathentry kind="lib" path="/path/to/external/java/source" />
- </code></pre><p>It may also be necessary to change the directory in which your source files are
- located (paths are relative to the .project file itself):</p><pre><code class="xml"> <classpathentry kind="src" output="target/classes" path="path/to/src/" />
- </code></pre><p><strong>NOTE</strong>: The eclipse project and classpath files are not a public interface
- and it is highly recommended to use Maven or Gradle project definitions if you
- don't already use eclipse to manage your projects.</p><h4 id="maven-projects">Maven Projects</h4><p>Maven needs a file named <a href="https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html">pom.xml</a> in the root of the project.
- Once again a simple <a href="https://github.com/ycm-core/ycmd/blob/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_maven_project/pom.xml">pom.xml</a> can be found in ycmd source.</p><p>The format of <a href="https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html">pom.xml</a> files is way beyond the scope of this
- document, but we do recommend using the various tools that can generate them for
- you, if you're not familiar with them already.</p><h4 id="gradle-projects">Gradle Projects</h4><p>Gradle projects require a <a href="https://docs.gradle.org/current/userguide/tutorial_java_projects.html">build.gradle</a>. Again, there is a
- <a href="https://github.com/ycm-core/ycmd/tree/3602f38ef7a762fc765afd75e562aec9a134711e/ycmd/tests/java/testdata/simple_gradle_project">trivial example in ycmd's tests</a>.</p><p>The format of <a href="https://docs.gradle.org/current/userguide/tutorial_java_projects.html">build.gradle</a> files is way beyond the scope of
- this document, but we do recommend using the various tools that can generate
- them for you, if you're not familiar with them already.</p><h4 id="troubleshooting">Troubleshooting</h4><p>If you're not getting completions or diagnostics, check the server health:</p><ul>
- <li>The Java completion engine takes a while to start up and parse your project.
- You should be able to see its progress in the command line, and
- <code>:YcmDebugInfo</code>. Ensure that the following lines are present:</li>
- </ul><pre><code>-- jdt.ls Java Language Server running
- -- jdt.ls Java Language Server Startup Status: Ready
- </code></pre><ul>
- <li>If the above lines don't appear after a few minutes, check the jdt.ls and ycmd
- log files using <a href="#the-ycmtogglelogs-command"><code>:YcmToggleLogs</code> </a>. The jdt.ls
- log file is called <code>.log</code> (for some reason).</li>
- </ul><p>If you get a message about "classpath is incomplete", then make sure you have
- correctly configured the <a href="#java-project-files">project files</a>.</p><p>If you get messages about unresolved imports, then make sure you have
- correctly configured the <a href="#java-project-files">project files</a>, in particular
- check that the classpath is set correctly.</p><h3 id="c-semantic-completion">C# Semantic Completion</h3><p>YCM relies on <a href="https://github.com/OmniSharp/omnisharp-roslyn">OmniSharp-Roslyn</a> to provide completion and code navigation.
- OmniSharp-Roslyn needs a solution file for a C# project and there are two ways
- of letting YCM know about your solution files.</p><h4 id="automaticly-discovered-solution-files">Automaticly discovered solution files</h4><p>YCM will scan all parent directories of the file currently being edited and look
- for file with <code>.sln</code> extension.</p><h4 id="manually-specified-solution-files">Manually specified solution files</h4><p>If YCM loads <code>.ycm_extra_conf.py</code> which contains <code>CSharpSolutionFile</code> function,
- YCM will try to use that to determine the solution file. This is useful when one
- wants to override the default behaviour and specify a solution file that is not
- in any of the parent directories of the currently edited file. Example:</p><pre><code class="python">def CSharpSolutionFile( filepath ):
- # `filepath` is the path of the file user is editing
- return '/path/to/solution/file' # Can be relative to the `.ycm_extra_conf.py`
- </code></pre><p>If the path returned by <code>CSharpSolutionFile</code> is not an actual file, YCM will
- fall back to the other way of finding the file.</p><h3 id="python-semantic-completion">Python Semantic Completion</h3><p>YCM relies on the <a href="https://github.com/davidhalter/jedi">Jedi</a> engine to provide completion and code navigation. By
- default, it will pick the version of Python running the <a href="https://github.com/ycm-core/ycmd">ycmd server</a> and
- use its <code>sys.path</code>. While this is fine for simple projects, this needs to be
- configurable when working with virtual environments or in a project with
- third-party packages. The next sections explain how to do that.</p><h4 id="working-with-virtual-environments">Working with virtual environments</h4><p>A common practice when working on a Python project is to install its
- dependencies in a virtual environment and develop the project inside that
- environment. To support this, YCM needs to know the interpreter path of the
- virtual environment. You can specify it by creating a <code>.ycm_extra_conf.py</code> file
- at the root of your project with the following contents:</p><pre><code class="python">def Settings( **kwargs ):
- return {
- 'interpreter_path': '/path/to/virtual/environment/python'
- }
- </code></pre><p>where <code>/path/to/virtual/environment/python</code> is the path to the Python used
- by the virtual environment you are working in. Typically, the executable can be
- found in the <code>Scripts</code> folder of the virtual environment directory on Windows
- and in the <code>bin</code> folder on other platforms.</p><p>If you don't like having to create a <code>.ycm_extra_conf.py</code> file at the root of
- your project and would prefer to specify the interpreter path with a Vim option,
- read the <a href="#configuring-through-vim-options">Configuring through Vim options</a>
- section.</p><h4 id="working-with-third-party-packages">Working with third-party packages</h4><p>Another common practice is to put the dependencies directly into the project and
- add their paths to <code>sys.path</code> at runtime in order to import them. YCM needs to
- be told about this path manipulation to support those dependencies. This can be
- done by creating a <code>.ycm_extra_conf.py</code> file at the root of the project. This
- file must define a <code>Settings( **kwargs )</code> function returning a dictionary with
- the list of paths to prepend to <code>sys.path</code> under the <code>sys_path</code> key. For
- instance, the following <code>.ycm_extra_conf.py</code></p><pre><code class="python">def Settings( **kwargs ):
- return {
- 'sys_path': [
- '/path/to/some/third_party/package',
- '/path/to/another/third_party/package'
- ]
- }
- </code></pre><p>adds the paths <code>/path/to/some/third_party/package</code> and
- <code>/path/to/another/third_party/package</code> at the start of <code>sys.path</code>.</p><p>If you would rather prepend paths to <code>sys.path</code> with a Vim option, read the
- <a href="#configuring-through-vim-options">Configuring through Vim options</a> section.</p><p>If you need further control on how to add paths to <code>sys.path</code>, you should define
- the <code>PythonSysPath( **kwargs )</code> function in the <code>.ycm_extra_conf.py</code> file. Its
- keyword arguments are <code>sys_path</code> which contains the default <code>sys.path</code>, and
- <code>interpreter_path</code> which is the path to the Python interpreter. Here's a trivial
- example that insert the <code>/path/to/third_party/package</code> path at the second
- position of <code>sys.path</code>:</p><pre><code class="python">def PythonSysPath( **kwargs ):
- sys_path = kwargs[ 'sys_path' ]
- sys_path.insert( 1, '/path/to/third_party/package' )
- return sys_path
- </code></pre><p>A more advanced example can be found in <a href="https://github.com/ycm-core/YouCompleteMe/blob/master/.ycm_extra_conf.py">YCM's own
- <code>.ycm_extra_conf.py</code></a>.</p><h4 id="configuring-through-vim-options">Configuring through Vim options</h4><p>You may find inconvenient to have to create a <code>.ycm_extra_conf.py</code> file at the
- root of each one of your projects in order to set the path to the Python
- interpreter and/or add paths to <code>sys.path</code> and would prefer to be able to
- configure those through Vim options. Don't worry, this is possible by using the
- <a href="#the-gycm_extra_conf_vim_data-option"><code>g:ycm_extra_conf_vim_data</code></a> option and
- creating a global extra configuration file. Let's take an example. Suppose that
- you want to set the interpreter path with the <code>g:ycm_python_interpreter_path</code>
- option and prepend paths to <code>sys.path</code> with the <code>g:ycm_python_sys_path</code> option.
- Suppose also that you want to name the global extra configuration file
- <code>global_extra_conf.py</code> and that you want to put it in your HOME folder. You
- should then add the following lines to your vimrc:</p><pre><code class="viml">let g:ycm_python_interpreter_path = ''
- let g:ycm_python_sys_path = []
- let g:ycm_extra_conf_vim_data = [
- \ 'g:ycm_python_interpreter_path',
- \ 'g:ycm_python_sys_path'
- \]
- let g:ycm_global_ycm_extra_conf = '~/global_extra_conf.py'
- </code></pre><p>and create the <code>~/global_extra_conf.py</code> file with the following contents:</p><pre><code class="python">def Settings( **kwargs ):
- client_data = kwargs[ 'client_data' ]
- return {
- 'interpreter_path': client_data[ 'g:ycm_python_interpreter_path' ],
- 'sys_path': client_data[ 'g:ycm_python_sys_path' ]
- }
- </code></pre><p>That's it. You are done. Note that you don't need to restart the server when
- setting one of the options. YCM will automatically pick the new values.</p><h3 id="rust-semantic-completion">Rust Semantic Completion</h3><p>Completions and GoTo commands within the current crate and its dependencies
- should work out of the box with no additional configuration (provided that you
- built YCM with the <code>--rust-completer</code> flag; see the <a href="#installation"><em>Installation</em>
- section</a> for details). The install script takes care of
- installing <a href="https://www.rust-lang.org/downloads.html">the Rust source code</a>, so no configuration is necessary.</p><p>To <a href="#lsp-configuration">configure RLS</a> look up [rls configuration options][
- rls-preferences]. The value of the <code>ls</code> key must be structured as in the
- following example:</p><pre><code class="python">def Settings( **kwargs ):
- if kwargs[ 'language' ] == 'rust':
- return {
- 'ls': {
- 'rust': {
- 'features': ['http2','spnego'],
- 'all_targets': False,
- 'wait_to_build': 1500,
- }
- }
- }
- </code></pre><p>That is to say, <code>ls</code> should be paired with a dictionary containing a key <code>rust</code>,
- which should be paired with another dictionary in which the keys are RLS
- options.</p><p>Also, for the time being, if you make changes to your <code>Cargo.toml</code> that RLS
- doesn't seem to recognize, you may need to restart it manually with
- <code>:YcmCompleter RestartServer</code>.</p><h3 id="go-semantic-completion">Go Semantic Completion</h3><p>Completions and GoTo commands should work out of the box (provided that you
- built YCM with the <code>--go-completer</code> flag; see the <a href="#installation"><em>Installation</em>
- section</a> for details). The server only works for projects with
- the "canonical" layout.</p><p>While YCM can configure <a href="#lsp-configuration">a LSP server</a>, currently <code>gopls</code>
- doesn't implement <a href="https://github.com/golang/tools/blob/master/internal/lsp/server.go#L120">the required notification</a>.</p><h3 id="javascript-and-typescript-semantic-completion">JavaScript and TypeScript Semantic Completion</h3><p><strong>NOTE:</strong> YCM originally used the <a href="https://ternjs.net">Tern</a> engine for JavaScript but due to
- <a href="https://ternjs.net">Tern</a> not being maintained anymore by its main author and the <a href="https://github.com/Microsoft/TypeScript/tree/master/src/server">TSServer</a>
- engine offering more features, YCM is moving to <a href="https://github.com/Microsoft/TypeScript/tree/master/src/server">TSServer</a>. This won't affect
- you if you were already using <a href="https://ternjs.net">Tern</a> but you are encouraged to do the switch
- by deleting the <code>third_party/ycmd/third_party/tern_runtime/node_modules</code>
- directory in YCM folder. If you are a new user but still want to use <a href="https://ternjs.net">Tern</a>,
- you should pass the <code>--js-completer</code> option to the <code>install.py</code> script during
- installation. Further instructions on how to setup YCM with <a href="https://ternjs.net">Tern</a> are
- available on <a href="https://github.com/ycm-core/YouCompleteMe/wiki/JavaScript-Semantic-Completion-through-Tern">the wiki</a>.</p><p>All JavaScript and TypeScript features are provided by the <a href="https://github.com/Microsoft/TypeScript/tree/master/src/server">TSServer</a> engine,
- which is included in the TypeScript SDK. To enable these features, install
- <a href="https://docs.npmjs.com/getting-started/installing-node#1-install-nodejs--npm">Node.js and npm</a> and call the <code>install.py</code> script with the
- <code>--ts-completer</code> flag.</p><p><a href="https://github.com/Microsoft/TypeScript/tree/master/src/server">TSServer</a> relies on <a href="https://code.visualstudio.com/docs/languages/jsconfig">the <code>jsconfig.json</code> file</a> for JavaScript
- and <a href="https://www.typescriptlang.org/docs/handbook/tsconfig-json.html">the <code>tsconfig.json</code> file</a> for TypeScript to analyze your
- project. Ensure the file exists at the root of your project.</p><p>To get diagnostics in JavaScript, set the <code>checkJs</code> option to <code>true</code> in your
- <code>jsconfig.json</code> file:</p><pre><code class="json">{
- "compilerOptions": {
- "checkJs": true
- }
- }
- </code></pre><h3 id="semantic-completion-for-other-languages">Semantic Completion for Other Languages</h3><p>C-family, C#, Go, Java, Python, Rust, and JavaScript/TypeScript languages are
- supported natively by YouCompleteMe using the <a href="https://clang.llvm.org/">Clang</a>, <a href="https://github.com/OmniSharp/omnisharp-roslyn">OmniSharp-Roslyn</a>,
- <a href="https://github.com/golang/go/wiki/gopls">Gopls</a>, <a href="https://github.com/eclipse/eclipse.jdt.ls">jdt.ls</a>, <a href="https://github.com/davidhalter/jedi">Jedi</a>, <a href="https://github.com/rust-lang/rls">rls</a>, and <a href="https://github.com/Microsoft/TypeScript/tree/master/src/server">TSServer</a> engines,
- respectively. Check the <a href="#installation">installation</a> section for instructions
- to enable these features if desired.</p><h4 id="plugging-an-arbitrary-lsp-server">Plugging an arbitrary LSP server</h4><p>Similar to other LSP clients, YCM can use an arbitrary LSP server with the help
- of <a href="#the-gycm_language_server-option"><code>g:ycm_language_server</code></a> option. An
- example of a value of this option would be:</p><pre><code class="viml">let g:ycm_language_server =
- \ [
- \ {
- \ 'name': 'yaml',
- \ 'cmdline': [ '/path/to/yaml/server/yaml-language-server', '--stdio' ],
- \ 'filetypes': [ 'yaml' ]
- \ },
- \ {
- \ 'name': 'rust',
- \ 'cmdline': [ 'ra_lsp_server' ],
- \ 'filetypes': [ 'rust' ],
- \ 'project_root_files': [ 'Cargo.toml' ]
- \ }
- \ ]
- </code></pre><p><code>project_root_files</code> is an optional key, since not all servers need it.</p><p>When <a href="#lsp-configuration">configuring a LSP server</a> the value of the <code>name</code> key
- will be used as the <code>kwargs[ 'language' ]</code>.</p><p>See <a href="https://github.com/ycm-core/lsp-examples">the LSP Examples</a> project for more
- examples of configuring the likes of PHP, Ruby, Kotlin, and D.</p><h4 id="lsp-configuration">LSP Configuration</h4><p>Many LSP servers allow some level of user configuration. YCM enables this with
- the help of <code>.ycm_extra_conf.py</code> files. Here's an example of jdt.ls user
- configuration.</p><pre><code class="python">def Settings( **kwargs ):
- if kwargs[ 'language' ] == 'java':
- return { 'ls': { 'java.format.onType.enabled': True } }
- </code></pre><p>The <code>ls</code> key tells YCM that the dictionary should be passed to thet LSP server.
- For each of the LSP server's configuration you should look up the respective
- server's documentation.</p><h4 id="using-omnifunc-for-semantic-completion">Using <code>omnifunc</code> for semantic completion</h4><p>YCM will use your <code>omnifunc</code> (see <code>:h omnifunc</code> in Vim) as a source for semantic
- completions if it does not have a native semantic completion engine for your
- file's filetype. Vim comes with okayish omnifuncs for various languages like
- Ruby, PHP, etc. It depends on the language.</p><p>You can get a stellar omnifunc for Ruby with <a href="http://eclim.org/">Eclim</a>. Just make sure you have
- the <em>latest</em> Eclim installed and configured (this means Eclim <code>>= 2.2.*</code> and
- Eclipse <code>>= 4.2.*</code>).</p><p>After installing Eclim remember to create a new Eclipse project within your
- application by typing <code>:ProjectCreate <path-to-your-project> -n ruby</code> inside vim
- and don't forget to have <code>let g:EclimCompletionMethod = 'omnifunc'</code> in your
- vimrc. This will make YCM and Eclim play nice; YCM will use Eclim's omnifuncs as
- the data source for semantic completions and provide the auto-triggering and
- subsequence-based matching (and other YCM features) on top of it.</p><h3 id="writing-new-semantic-completers">Writing New Semantic Completers</h3><p>You have two options here: writing an <code>omnifunc</code> for Vim's omnicomplete system
- that YCM will then use through its omni-completer, or a custom completer for YCM
- using the <a href="https://github.com/ycm-core/ycmd/blob/master/ycmd/completers/completer.py">Completer API</a>.</p><p>Here are the differences between the two approaches:</p><ul>
- <li>You have to use VimScript to write the omnifunc, but get to use Python to
- write for the Completer API; this by itself should make you want to use the
- API.</li>
- <li>The Completer API is a <em>much</em> more powerful way to integrate with YCM and it
- provides a wider set of features. For instance, you can make your Completer
- query your semantic back-end in an asynchronous fashion, thus not blocking
- Vim's GUI thread while your completion system is processing stuff. This is
- impossible with VimScript. All of YCM's completers use the Completer API.</li>
- <li>Performance with the Completer API is better since Python executes faster than
- VimScript.</li>
- </ul><p>If you want to use the <code>omnifunc</code> system, see the relevant Vim docs with <code>:h
- complete-functions</code>. For the Completer API, see <a href="https://github.com/ycm-core/ycmd/blob/master/ycmd/completers/completer.py">the API docs</a>.</p><p>If you want to upstream your completer into YCM's source, you should use the
- Completer API.</p><h3 id="diagnostic-display">Diagnostic Display</h3><p>YCM will display diagnostic notifications for the C-family, C#, Go, Java,
- JavaScript, Rust and TypeScript languages. Since YCM continuously recompiles
- your file as you type, you'll get notified of errors and warnings in your file
- as fast as possible.</p><p>Here are the various pieces of the diagnostic UI:</p><ul>
- <li>Icons show up in the Vim gutter on lines that have a diagnostic.</li>
- <li>Regions of text related to diagnostics are highlighted (by default, a red
- wavy underline in <code>gvim</code> and a red background in <code>vim</code>).</li>
- <li>Moving the cursor to a line with a diagnostic echoes the diagnostic text.</li>
- <li>Vim's location list is automatically populated with diagnostic data (off by
- default, see options).</li>
- </ul><p>The new diagnostics (if any) will be displayed the next time you press any key
- on the keyboard. So if you stop typing and just wait for the new diagnostics to
- come in, that <em>will not work</em>. You need to press some key for the GUI to update.</p><p>Having to press a key to get the updates is unfortunate, but cannot be changed
- due to the way Vim internals operate; there is no way that a background task can
- update Vim's GUI after it has finished running. You <em>have to</em> press a key. This
- will make YCM check for any pending diagnostics updates.</p><p>You <em>can</em> force a full, blocking compilation cycle with the
- <code>:YcmForceCompileAndDiagnostics</code> command (you may want to map that command to a
- key; try putting <code>nnoremap <F5> :YcmForceCompileAndDiagnostics<CR></code> in your
- vimrc). Calling this command will force YCM to immediately recompile your file
- and display any new diagnostics it encounters. Do note that recompilation with
- this command may take a while and during this time the Vim GUI <em>will</em> be
- blocked.</p><p>YCM will display a short diagnostic message when you move your cursor to the
- line with the error. You can get a detailed diagnostic message with the
- <code><leader>d</code> key mapping (can be changed in the options) YCM provides when your
- cursor is on the line with the diagnostic.</p><p>You can also see the full diagnostic message for all the diagnostics in the
- current file in Vim's <code>locationlist</code>, which can be opened with the <code>:lopen</code> and
- <code>:lclose</code> commands (make sure you have set <code>let
- g:ycm_always_populate_location_list = 1</code> in your vimrc). A good way to toggle
- the display of the <code>locationlist</code> with a single key mapping is provided by
- another (very small) Vim plugin called <a href="https://github.com/Valloric/ListToggle">ListToggle</a> (which also makes it
- possible to change the height of the <code>locationlist</code> window), also written by
- yours truly.</p><h4 id="diagnostic-highlighting-groups">Diagnostic Highlighting Groups</h4><p>You can change the styling for the highlighting groups YCM uses. For the signs
- in the Vim gutter, the relevant groups are:</p><ul>
- <li><code>YcmErrorSign</code>, which falls back to group <code>SyntasticErrorSign</code> and then
- <code>error</code> if they exist</li>
- <li><code>YcmWarningSign</code>, which falls back to group <code>SyntasticWarningSign</code> and then
- <code>todo</code> if they exist</li>
- </ul><p>You can also style the line that has the warning/error with these groups:</p><ul>
- <li><code>YcmErrorLine</code>, which falls back to group <code>SyntasticErrorLine</code> if it exists</li>
- <li><code>YcmWarningLine</code>, which falls back to group <code>SyntasticWarningLine</code> if it
- exists</li>
- </ul><p>Note that the line highlighting groups only work when the
- <a href="#the-gycm_enable_diagnostic_signs-option"><code>g:ycm_enable_diagnostic_signs</code></a>
- option is set. If you want highlighted lines but no signs in the Vim gutter,
- ensure that your Vim version is 7.4.2201 or later and set the <code>signcolumn</code>
- option to <code>off</code> in your vimrc:</p><pre><code class="viml">set signcolumn=off
- </code></pre><p>The syntax groups used to highlight regions of text with errors/warnings:
- - <code>YcmErrorSection</code>, which falls back to group <code>SyntasticError</code> if it exists and
- then <code>SpellBad</code>
- - <code>YcmWarningSection</code>, which falls back to group <code>SyntasticWarning</code> if it exists
- and then <code>SpellCap</code></p><p>Here's how you'd change the style for a group:</p><pre><code class="viml">highlight YcmErrorLine guibg=#3f0000
- </code></pre><h2 id="commands">Commands</h2><h3 id="the-ycmrestartserver-command">The <code>:YcmRestartServer</code> command</h3><p>If the <a href="https://github.com/ycm-core/ycmd">ycmd completion server</a> suddenly stops for some reason, you can
- restart it with this command.</p><h3 id="the-ycmforcecompileanddiagnostics-command">The <code>:YcmForceCompileAndDiagnostics</code> command</h3><p>Calling this command will force YCM to immediately recompile your file
- and display any new diagnostics it encounters. Do note that recompilation with
- this command may take a while and during this time the Vim GUI <em>will</em> be
- blocked.</p><p>You may want to map this command to a key; try putting <code>nnoremap <F5>
- :YcmForceCompileAndDiagnostics<CR></code> in your vimrc.</p><h3 id="the-ycmdiags-command">The <code>:YcmDiags</code> command</h3><p>Calling this command will fill Vim's <code>locationlist</code> with errors or warnings if
- any were detected in your file and then open it. If a given error or warning can
- be fixed by a call to <code>:YcmCompleter FixIt</code>, then <code>(FixIt available)</code> is
- appended to the error or warning text. See the <code>FixIt</code> completer subcommand for
- more information.</p><p><strong>NOTE:</strong> The absence of <code>(FixIt available)</code> does not strictly imply a fix-it
- is not available as not all completers are able to provide this indication. For
- example, the c-sharp completer provides many fix-its but does not add this
- additional indication.</p><p>The <code>g:ycm_open_loclist_on_ycm_diags</code> option can be used to prevent the location
- list from opening, but still have it filled with new diagnostic data. See the
- <em>Options</em> section for details.</p><h3 id="the-ycmshowdetaileddiagnostic-command">The <code>:YcmShowDetailedDiagnostic</code> command</h3><p>This command shows the full diagnostic text when the user's cursor is on the
- line with the diagnostic.</p><h3 id="the-ycmdebuginfo-command">The <code>:YcmDebugInfo</code> command</h3><p>This will print out various debug information for the current file. Useful to
- see what compile commands will be used for the file if you're using the semantic
- completion engine.</p><h3 id="the-ycmtogglelogs-command">The <code>:YcmToggleLogs</code> command</h3><p>This command presents the list of logfiles created by YCM, the <a href="https://github.com/ycm-core/ycmd">ycmd
- server</a>, and the semantic engine server for the current filetype, if any.
- One of these logfiles can be opened in the editor (or closed if already open) by
- entering the corresponding number or by clicking on it with the mouse.
- Additionally, this command can take the logfile names as arguments. Use the
- <code><TAB></code> key (or any other key defined by the <code>wildchar</code> option) to complete the
- arguments or to cycle through them (depending on the value of the <code>wildmode</code>
- option). Each logfile given as an argument is directly opened (or closed if
- already open) in the editor. Only for debugging purposes.</p><h3 id="the-ycmcompleter-command">The <code>:YcmCompleter</code> command</h3><p>This command gives access to a number of additional <a href="#quick-feature-summary">IDE-like
- features</a> in YCM, for things like semantic GoTo, type
- information, FixIt and refactoring.</p><p>This command accepts a range that can either be specified through a selection in
- one of Vim's visual modes (see <code>:h visual-use</code>) or on the command line. For
- instance, <code>:2,5YcmCompleter</code> will apply the command from line 2 to line 5. This
- is useful for <a href="#the-format-subcommand">the <code>Format</code> subcommand</a>.</p><p>Call <code>YcmCompleter</code> without further arguments for a list of the commands you can
- call for the current completer.</p><p>See the <a href="#quick-feature-summary">file type feature summary</a> for an overview of
- the features available for each file type. See the <em>YcmCompleter subcommands</em>
- section for more information on the available subcommands and their usage.</p><h2 id="ycmcompleter-subcommands">YcmCompleter Subcommands</h2><p><strong>NOTE:</strong> See the docs for the <code>YcmCompleter</code> command before tackling this
- section.</p><p>The invoked subcommand is automatically routed to the currently active semantic
- completer, so <code>:YcmCompleter GoToDefinition</code> will invoke the <code>GoToDefinition</code>
- subcommand on the Python semantic completer if the currently active file is a
- Python one and on the Clang completer if the currently active file is a C-family
- language one.</p><p>You may also want to map the subcommands to something less verbose; for
- instance, <code>nnoremap <leader>jd :YcmCompleter GoTo<CR></code>
- maps the <code><leader>jd</code> sequence to the longer subcommand invocation.</p><h3 id="goto-commands">GoTo Commands</h3><p>These commands are useful for jumping around and exploring code. When moving
- the cursor, the subcommands add entries to Vim's <code>jumplist</code> so you can use
- <code>CTRL-O</code> to jump back to where you were before invoking the command (and
- <code>CTRL-I</code> to jump forward; see <code>:h jumplist</code> for details). If there is more
- than one destination, the quickfix list (see <code>:h quickfix</code>) is populated with
- the available locations and opened to full width at the bottom of the screen.
- You can change this behavior by using <a href="#the-ycmquickfixopened-autocommand">the <code>YcmQuickFixOpened</code>
- autocommand</a>.</p><h4 id="the-gotoinclude-subcommand">The <code>GoToInclude</code> subcommand</h4><p>Looks up the current line for a header and jumps to it.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda</code></p><h4 id="the-gotodeclaration-subcommand">The <code>GoToDeclaration</code> subcommand</h4><p>Looks up the symbol under the cursor and jumps to its declaration.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
- python, rust, typescript</code></p><h4 id="the-gotodefinition-subcommand">The <code>GoToDefinition</code> subcommand</h4><p>Looks up the symbol under the cursor and jumps to its definition.</p><p><strong>NOTE:</strong> For C-family languages <strong>this only works in certain situations</strong>,
- namely when the definition of the symbol is in the current translation unit. A
- translation unit consists of the file you are editing and all the files you are
- including with <code>#include</code> directives (directly or indirectly) in that file.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
- python, rust, typescript</code></p><h4 id="the-goto-subcommand">The <code>GoTo</code> subcommand</h4><p>This command tries to perform the "most sensible" GoTo operation it can.
- Currently, this means that it tries to look up the symbol under the cursor and
- jumps to its definition if possible; if the definition is not accessible from
- the current translation unit, jumps to the symbol's declaration. For
- C-family languages, it first tries to look up the current line for a header and
- jump to it. For C#, implementations are also considered and preferred.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
- python, rust, typescript</code></p><h4 id="the-gotoimprecise-subcommand">The <code>GoToImprecise</code> subcommand</h4><p>WARNING: This command trades correctness for speed!</p><p>Same as the <code>GoTo</code> command except that it doesn't recompile the file with
- libclang before looking up nodes in the AST. This can be very useful when you're
- editing files that take long to compile but you know that you haven't made any
- changes since the last parse that would lead to incorrect jumps. When you're
- just browsing around your codebase, this command can spare you quite a bit of
- latency.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda</code></p><h4 id="the-gotosymbol-symbol-query-subcommand">The <code>GoToSymbol <symbol query></code> subcommand</h4><p>Finds the definition of all symbols matching a specified string. Note that this
- does not use any sort of smart/fuzzy matching.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, cs, java, javascript, python, typescript</code></p><h4 id="the-gotoreferences-subcommand">The <code>GoToReferences</code> subcommand</h4><p>This command attempts to find all of the references within the project to the
- identifier under the cursor and populates the quickfix list with those
- locations.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, java, javascript, python, typescript, rust</code></p><h4 id="the-gotoimplementation-subcommand">The <code>GoToImplementation</code> subcommand</h4><p>Looks up the symbol under the cursor and jumps to its implementation (i.e.
- non-interface). If there are multiple implementations, instead provides a list
- of implementations to choose from.</p><p>Supported in filetypes: <code>cs, go, java, rust, typescript, javascript</code></p><h4 id="the-gotoimplementationelsedeclaration-subcommand">The <code>GoToImplementationElseDeclaration</code> subcommand</h4><p>Looks up the symbol under the cursor and jumps to its implementation if one,
- else jump to its declaration. If there are multiple implementations, instead
- provides a list of implementations to choose from.</p><p>Supported in filetypes: <code>cs</code></p><h4 id="the-gototype-subcommand">The <code>GoToType</code> subcommand</h4><p>Looks up the symbol under the cursor and jumps to the definition of its type
- e.g. if the symbol is an object, go to the definition of its class.</p><p>Supported in filetypes: <code>go, java, javascript, typescript</code></p><h3 id="semantic-information-commands">Semantic Information Commands</h3><p>These commands are useful for finding static information about the code, such
- as the types of variables, viewing declarations and documentation strings.</p><h4 id="the-gettype-subcommand">The <code>GetType</code> subcommand</h4><p>Echos the type of the variable or method under the cursor, and where it differs,
- the derived type.</p><p>For example:</p><pre><code class="c++"> std::string s;
- </code></pre><p>Invoking this command on <code>s</code> returns <code>std::string => std::basic_string<char></code></p><p><strong>NOTE:</strong> Causes re-parsing of the current translation unit.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, java, javascript,
- go, python, typescript, rust</code></p><h4 id="the-gettypeimprecise-subcommand">The <code>GetTypeImprecise</code> subcommand</h4><p>WARNING: This command trades correctness for speed!</p><p>Same as the <code>GetType</code> command except that it doesn't recompile the file with
- libclang before looking up nodes in the AST. This can be very useful when you're
- editing files that take long to compile but you know that you haven't made any
- changes since the last parse that would lead to incorrect type. When you're
- just browsing around your codebase, this command can spare you quite a bit of
- latency.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda</code></p><h4 id="the-getparent-subcommand">The <code>GetParent</code> subcommand</h4><p>Echos the semantic parent of the point under the cursor.</p><p>The semantic parent is the item that semantically contains the given position.</p><p>For example:</p><pre><code class="c++">class C {
- void f();
- };
- void C::f() {
- }
- </code></pre><p>In the out-of-line definition of <code>C::f</code>, the semantic parent is the class <code>C</code>,
- of which this function is a member.</p><p>In the example above, both declarations of <code>C::f</code> have <code>C</code> as their semantic
- context, while the lexical context of the first <code>C::f</code> is <code>C</code> and the lexical
- context of the second <code>C::f</code> is the translation unit.</p><p>For global declarations, the semantic parent is the translation unit.</p><p><strong>NOTE:</strong> Causes re-parsing of the current translation unit.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda</code></p><h4 id="the-getdoc-subcommand">The <code>GetDoc</code> subcommand</h4><p>Displays the preview window populated with quick info about the identifier
- under the cursor. Depending on the file type, this includes things like:</p><ul>
- <li>The type or declaration of identifier,</li>
- <li>Doxygen/javadoc comments,</li>
- <li>Python docstrings,</li>
- <li>etc.</li>
- </ul><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
- python, typescript, rust</code></p><h4 id="the-getdocimprecise-subcommand">The <code>GetDocImprecise</code> subcommand</h4><p>WARNING: This command trades correctness for speed!</p><p>Same as the <code>GetDoc</code> command except that it doesn't recompile the file with
- libclang before looking up nodes in the AST. This can be very useful when you're
- editing files that take long to compile but you know that you haven't made any
- changes since the last parse that would lead to incorrect docs. When you're
- just browsing around your codebase, this command can spare you quite a bit of
- latency.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda</code></p><h3 id="refactoring-commands">Refactoring Commands</h3><p>These commands make changes to your source code in order to perform refactoring
- or code correction. YouCompleteMe does not perform any action which cannot be
- undone, and never saves or writes files to the disk.</p><h4 id="the-fixit-subcommand">The <code>FixIt</code> subcommand</h4><p>Where available, attempts to make changes to the buffer to correct diagnostics
- on the current line. Where multiple suggestions are available (such as when
- there are multiple ways to resolve a given warning, or where multiple
- diagnostics are reported for the current line), the options are presented
- and one can be selected.</p><p>Completers which provide diagnostics may also provide trivial modifications to
- the source in order to correct the diagnostic. Examples include syntax errors
- such as missing trailing semi-colons, spurious characters, or other errors which
- the semantic engine can deterministically suggest corrections.</p><p>If no fix-it is available for the current line, or there is no diagnostic on the
- current line, this command has no effect on the current buffer. If any
- modifications are made, the number of changes made to the buffer is echo'd and
- the user may use the editor's undo command to revert.</p><p>When a diagnostic is available, and <code>g:ycm_echo_current_diagnostic</code> is set to 1,
- then the text <code>(FixIt)</code> is appended to the echo'd diagnostic when the
- completer is able to add this indication. The text <code>(FixIt available)</code> is
- also appended to the diagnostic text in the output of the <code>:YcmDiags</code> command
- for any diagnostics with available fix-its (where the completer can provide this
- indication).</p><p><strong>NOTE:</strong> Causes re-parsing of the current translation unit.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, cs, go, java, javascript,
- rust, typescript</code></p><h4 id="the-refactorrename-new-name-subcommand">The <code>RefactorRename <new name></code> subcommand</h4><p>In supported file types, this command attempts to perform a semantic rename of
- the identifier under the cursor. This includes renaming declarations,
- definitions and usages of the identifier, or any other language-appropriate
- action. The specific behavior is defined by the semantic engine in use.</p><p>Similar to <code>FixIt</code>, this command applies automatic modifications to your source
- files. Rename operations may involve changes to multiple files, which may or may
- not be open in Vim buffers at the time. YouCompleteMe handles all of this for
- you. The behavior is described in <a href="#multi-file-refactor">the following section</a>.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, java, javascript, typescript, rust, cs</code></p><h4 id="multi-file-refactor">Multi-file Refactor</h4><p>When a Refactor or FixIt command touches multiple files, YouCompleteMe attempts
- to apply those modifications to any existing open, visible buffer in the current
- tab. If no such buffer can be found, YouCompleteMe opens the file in a new
- small horizontal split at the top of the current window, applies the change,
- and then <em>hides</em> the window. <strong>NOTE:</strong> The buffer remains open, and must be
- manually saved. A confirmation dialog is opened prior to doing this to remind
- you that this is about to happen.</p><p>Once the modifications have been made, the quickfix list (see <code>:help quickfix</code>)
- is populated with the locations of all modifications. This can be used to review
- all automatic changes made by using <code>:copen</code>. Typically, use the <code>CTRL-W
- <enter></code> combination to open the selected file in a new split. It is possible to
- customize how the quickfix window is opened by using <a href="#the-ycmquickfixopened-autocommand">the <code>YcmQuickFixOpened</code>
- autocommand</a>.</p><p>The buffers are <em>not</em> saved automatically. That is, you must save the modified
- buffers manually after reviewing the changes from the quickfix list. Changes
- can be undone using Vim's powerful undo features (see <code>:help undo</code>). Note
- that Vim's undo is per-buffer, so to undo all changes, the undo commands must
- be applied in each modified buffer separately.</p><p><strong>NOTE:</strong> While applying modifications, Vim may find files which are already
- open and have a swap file. The command is aborted if you select Abort or Quit in
- any such prompts. This leaves the Refactor operation partially complete and must
- be manually corrected using Vim's undo features. The quickfix list is <em>not</em>
- populated in this case. Inspect <code>:buffers</code> or equivalent (see <code>:help buffers</code>)
- to see the buffers that were opened by the command.</p><h4 id="the-format-subcommand">The <code>Format</code> subcommand</h4><p>This command formats the whole buffer or some part of it according to the value
- of the Vim options <code>shiftwidth</code> and <code>expandtab</code> (see <code>:h 'sw'</code> and <code>:h et</code>
- respectively). To format a specific part of your document, you can either select
- it in one of Vim's visual modes (see <code>:h visual-use</code>) and run the command or
- directly enter the range on the command line, e.g. <code>:2,5YcmCompleter Format</code> to
- format it from line 2 to line 5.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, java, javascript, go, typescript, rust, cs</code></p><h4 id="the-organizeimports-subcommand">The <code>OrganizeImports</code> subcommand</h4><p>This command removes unused imports and sorts imports in the current file. It
- can also group imports from the same module in TypeScript and resolves imports
- in Java.</p><p>Supported in filetypes: <code>java, javascript, typescript</code></p><h3 id="miscellaneous-commands">Miscellaneous Commands</h3><p>These commands are for general administration, rather than IDE-like features.
- They cover things like the semantic engine server instance and compilation
- flags.</p><h4 id="the-executecommand-args-subcommand">The <code>ExecuteCommand <args></code> subcommand</h4><p>Some LSP completers (currently Rust and Java completers) support executing
- server specific commands. Consult the <a href="https://github.com/rust-lang/rls">rls</a> and <a href="https://github.com/eclipse/eclipse.jdt.ls">jdt.ls</a> respective
- documentations to find out what commands are supported and which arguments are
- expected.</p><p>The support for <code>ExecuteCommand</code> was implemented to support plugins like
- <a href="https://github.com/puremourning/vimspector">vimspector</a> to debug java, but isn't limited to that specific use case.</p><h4 id="the-restartserver-subcommand">The <code>RestartServer</code> subcommand</h4><p>Restarts the semantic-engine-as-localhost-server for those semantic engines that
- work as separate servers that YCM talks to.</p><p>Supported in filetypes: <code>c, cpp, objc, objcpp, cuda, cs, go, java, javascript, rust, typescript</code></p><h4 id="the-reloadsolution-subcommand">The <code>ReloadSolution</code> subcommand</h4><p>Instruct the Omnisharp-Roslyn server to clear its cache and reload all files
- from disk. This is useful when files are added, removed, or renamed in the
- solution, files are changed outside of Vim, or whenever Omnisharp-Roslyn cache
- is out-of-sync.</p><p>Supported in filetypes: <code>cs</code></p><h2 id="functions">Functions</h2><h3 id="the-youcompletemegeterrorcount-function">The <code>youcompleteme#GetErrorCount</code> function</h3><p>Get the number of YCM Diagnostic errors. If no errors are present, this function
- returns 0.</p><p>For example:</p><pre><code class="viml"> call youcompleteme#GetErrorCount()
- </code></pre><p>Both this function and <code>youcompleteme#GetWarningCount</code> can be useful when
- integrating YCM with other Vim plugins. For example, a <a href="https://github.com/itchyny/lightline.vim">lightline</a> user could
- add a diagnostics section to their statusline which would display the number of
- errors and warnings.</p><h3 id="the-youcompletemegetwarningcount-function">The <code>youcompleteme#GetWarningCount</code> function</h3><p>Get the number of YCM Diagnostic warnings. If no warnings are present, this
- function returns 0.</p><p>For example:</p><pre><code class="viml"> call youcompleteme#GetWarningCount()
- </code></pre><h3 id="the-youcompletemegetcommandresponse---function">The <code>youcompleteme#GetCommandResponse( ... )</code> function</h3><p>Run a <a href="#ycmcompleter-subcommands">completer subcommand</a> and return the result as
- a string. This can be useful for example to display the <code>GetGoc</code> output in a
- popup window, e.g.:</p><pre><code class="viml">let s:ycm_hover_popup = -1
- function s:Hover()
- let response = youcompleteme#GetCommandResponse( 'GetDoc' )
- if response == ''
- return
- endif
- call popup_hide( s:ycm_hover_popup )
- let s:ycm_hover_popup = popup_atcursor( balloon_split( response ), {} )
- endfunction
- " CursorHold triggers in normal mode after a delay
- autocmd CursorHold * call s:Hover()
- " Or, if you prefer, a mapping:
- nnoremap <silent> <leader>D :call <SID>Hover()<CR>
- </code></pre><p><strong>NOTE</strong>: This is only an example, for real hover support, see
- <a href="#the-gycm_auto_hover-option"><code>g:ycm_auto_hover</code></a>.</p><p>If the completer subcommand result is not a string (for example, it's a FixIt or
- a Location), or if the completer subcommand raises an error, an empty string is
- returned, so that calling code does not have to check for complex error
- conditions.</p><p>The arguments to the function are the same as the arguments to the
- <code>:YcmCompleter</code> ex command, e.g. the name of the subcommand, followed by any
- additional subcommand arguments. As with the <code>YcmCompleter</code> command, if the
- first argument is <code>ft=<filetype></code> the request is targetted at the specified
- filetype completer. This is an advanced usage and not necessary in most cases.</p><p>NOTE: The request is run synchronously and blocks Vim until the response is
- received, so we do not recommend running this as part of an autocommand that
- triggers frequently.</p><h2 id="autocommands">Autocommands</h2><h3 id="the-ycmlocationopened-autocommand">The <code>YcmLocationOpened</code> autocommand</h3><p>This <code>User</code> autocommand is fired when YCM opens the location list window in
- response to the <code>YcmDiags</code> command. By default, the location list window is
- opened to the bottom of the current window and its height is set to fit all
- entries. This behavior can be overridden by using the <code>YcmLocationOpened</code>
- autocommand which is triggered while the cursor is in the location list window.
- For instance:</p><pre><code class="viml">function! s:CustomizeYcmLocationWindow()
- " Move the window to the top of the screen.
- wincmd K
- " Set the window height to 5.
- 5wincmd _
- " Switch back to working window.
- wincmd p
- endfunction
- autocmd User YcmLocationOpened call s:CustomizeYcmLocationWindow()
- </code></pre><h3 id="the-ycmquickfixopened-autocommand">The <code>YcmQuickFixOpened</code> autocommand</h3><p>This <code>User</code> autocommand is fired when YCM opens the quickfix window in response
- to the <code>GoTo*</code> and <code>RefactorRename</code> subcommands. By default, the quickfix window
- is opened to full width at the bottom of the screen and its height is set to fit
- all entries. This behavior can be overridden by using the <code>YcmQuickFixOpened</code>
- autocommand which is triggered while the cursor is in the quickfix window. For
- instance:</p><pre><code class="viml">function! s:CustomizeYcmQuickFixWindow()
- " Move the window to the top of the screen.
- wincmd K
- " Set the window height to 5.
- 5wincmd _
- endfunction
- autocmd User YcmQuickFixOpened call s:CustomizeYcmQuickFixWindow()
- </code></pre><h2 id="options">Options</h2><p>All options have reasonable defaults so if the plug-in works after installation
- you don't need to change any options. These options can be configured in your
- <a href="https://vimhelp.appspot.com/starting.txt.html#vimrc">vimrc script</a> by including a line like this:</p><pre><code class="viml">let g:ycm_min_num_of_chars_for_completion = 1
- </code></pre><p>Note that after changing an option in your <a href="https://vimhelp.appspot.com/starting.txt.html#vimrc">vimrc script</a> you have to
- restart <a href="https://github.com/ycm-core/ycmd">ycmd</a> with the <code>:YcmRestartServer</code> command for the changes to take
- effect.</p><h3 id="the-gycm_min_num_of_chars_for_completion-option">The <code>g:ycm_min_num_of_chars_for_completion</code> option</h3><p>This option controls the number of characters the user needs to type before
- identifier-based completion suggestions are triggered. For example, if the
- option is set to <code>2</code>, then when the user types a second alphanumeric character
- after a whitespace character, completion suggestions will be triggered. This
- option is NOT used for semantic completion.</p><p>Setting this option to a high number like <code>99</code> effectively turns off the
- identifier completion engine and just leaves the semantic engine.</p><p>Default: <code>2</code></p><pre><code class="viml">let g:ycm_min_num_of_chars_for_completion = 2
- </code></pre><h3 id="the-gycm_min_num_identifier_candidate_chars-option">The <code>g:ycm_min_num_identifier_candidate_chars</code> option</h3><p>This option controls the minimum number of characters that a completion
- candidate coming from the identifier completer must have to be shown in the
- popup menu.</p><p>A special value of <code>0</code> means there is no limit.</p><p><strong>NOTE:</strong> This option only applies to the identifier completer; it has no effect
- on the various semantic completers.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_min_num_identifier_candidate_chars = 0
- </code></pre><h3 id="the-gycm_max_num_candidates-option">The <code>g:ycm_max_num_candidates</code> option</h3><p>This option controls the maximum number of semantic completion suggestions shown
- in the completion menu. This only applies to suggestions from semantic
- completion engines; see <a href="#the-gycm_max_num_identifier_candidates-option">the <code>g:ycm_max_identifier_candidates</code>
- option</a> to limit the number of
- suggestions from the identifier-based engine.</p><p>A special value of <code>0</code> means there is no limit.</p><p><strong>NOTE:</strong> Setting this option to <code>0</code> or to a value greater than <code>100</code> is not
- recommended as it will slow down completion when there are a very large number
- of suggestions.</p><p>Default: <code>50</code></p><pre><code class="viml">let g:ycm_max_num_candidates = 50
- </code></pre><h3 id="the-gycm_max_num_identifier_candidates-option">The <code>g:ycm_max_num_identifier_candidates</code> option</h3><p>This option controls the maximum number of completion suggestions from the
- identifier-based engine shown in the completion menu.</p><p>A special value of <code>0</code> means there is no limit.</p><p><strong>NOTE:</strong> Setting this option to <code>0</code> or to a value greater than <code>100</code> is not
- recommended as it will slow down completion when there are a very large number
- of suggestions.</p><p>Default: <code>10</code></p><pre><code class="viml">let g:ycm_max_num_identifier_candidates = 10
- </code></pre><h3 id="the-gycm_auto_trigger-option">The <code>g:ycm_auto_trigger</code> option</h3><p>When set to <code>0</code>, this option turns off YCM's identifier completer (the
- as-you-type popup) <em>and</em> the semantic triggers (the popup you'd get after typing
- <code>.</code> or <code>-></code> in say C++). You can still force semantic completion with the
- <code><C-Space></code> shortcut.</p><p>If you want to just turn off the identifier completer but keep the semantic
- triggers, you should set <code>g:ycm_min_num_of_chars_for_completion</code> to a high
- number like <code>99</code>.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_auto_trigger = 1
- </code></pre><h3 id="the-gycm_filetype_whitelist-option">The <code>g:ycm_filetype_whitelist</code> option</h3><p>This option controls for which Vim filetypes (see <code>:h filetype</code>) should YCM be
- turned on. The option value should be a Vim dictionary with keys being filetype
- strings (like <code>python</code>, <code>cpp</code>, etc.) and values being unimportant (the
- dictionary is used like a hash set, meaning that only the keys matter).</p><p>The <code>*</code> key is special and matches all filetypes. By default, the whitelist
- contains only this <code>*</code> key.</p><p>YCM also has a <code>g:ycm_filetype_blacklist</code> option that lists filetypes for which
- YCM shouldn't be turned on. YCM will work only in filetypes that both the
- whitelist and the blacklist allow (the blacklist "allows" a filetype by <em>not</em>
- having it as a key).</p><p>For example, let's assume you want YCM to work in files with the <code>cpp</code> filetype.
- The filetype should then be present in the whitelist either directly (<code>cpp</code> key
- in the whitelist) or indirectly through the special <code>*</code> key. It should <em>not</em> be
- present in the blacklist.</p><p>Filetypes that are blocked by the either of the lists will be completely ignored
- by YCM, meaning that neither the identifier-based completion engine nor the
- semantic engine will operate in them.</p><p>You can get the filetype of the current file in Vim with <code>:set ft?</code>.</p><p>Default: <code>{'*': 1}</code></p><pre><code class="viml">let g:ycm_filetype_whitelist = {'*': 1}
- </code></pre><h3 id="the-gycm_filetype_blacklist-option">The <code>g:ycm_filetype_blacklist</code> option</h3><p>This option controls for which Vim filetypes (see <code>:h filetype</code>) should YCM be
- turned off. The option value should be a Vim dictionary with keys being filetype
- strings (like <code>python</code>, <code>cpp</code>, etc.) and values being unimportant (the
- dictionary is used like a hash set, meaning that only the keys matter).</p><p>See the <code>g:ycm_filetype_whitelist</code> option for more details on how this works.</p><p>Default: <code>[see next line]</code></p><pre><code class="viml">let g:ycm_filetype_blacklist = {
- \ 'tagbar': 1,
- \ 'notes': 1,
- \ 'markdown': 1,
- \ 'netrw': 1,
- \ 'unite': 1,
- \ 'text': 1,
- \ 'vimwiki': 1,
- \ 'pandoc': 1,
- \ 'infolog': 1,
- \ 'leaderf': 1,
- \ 'mail': 1
- \}
- </code></pre><h3 id="the-gycm_filetype_specific_completion_to_disable-option">The <code>g:ycm_filetype_specific_completion_to_disable</code> option</h3><p>This option controls for which Vim filetypes (see <code>:h filetype</code>) should the YCM
- semantic completion engine be turned off. The option value should be a Vim
- dictionary with keys being filetype strings (like <code>python</code>, <code>cpp</code>, etc.) and
- values being unimportant (the dictionary is used like a hash set, meaning that
- only the keys matter). The listed filetypes will be ignored by the YCM semantic
- completion engine, but the identifier-based completion engine will still trigger
- in files of those filetypes.</p><p>Note that even if semantic completion is not turned off for a specific filetype,
- you will not get semantic completion if the semantic engine does not support
- that filetype.</p><p>You can get the filetype of the current file in Vim with <code>:set ft?</code>.</p><p>Default: <code>[see next line]</code></p><pre><code class="viml">let g:ycm_filetype_specific_completion_to_disable = {
- \ 'gitcommit': 1
- \}
- </code></pre><h3 id="the-gycm_filepath_blacklist-option">The <code>g:ycm_filepath_blacklist</code> option</h3><p>This option controls for which Vim filetypes (see <code>:h filetype</code>) should filepath
- completion be disabled. The option value should be a Vim dictionary with keys
- being filetype strings (like <code>python</code>, <code>cpp</code>, etc.) and values being unimportant
- (the dictionary is used like a hash set, meaning that only the keys matter).</p><p>The <code>*</code> key is special and matches all filetypes. Use this key if you want to
- completely disable filepath completion:</p><pre><code class="viml">let g:ycm_filepath_blacklist = {'*': 1}
- </code></pre><p>You can get the filetype of the current file in Vim with <code>:set ft?</code>.</p><p>Default: <code>[see next line]</code></p><pre><code class="viml">let g:ycm_filepath_blacklist = {
- \ 'html': 1,
- \ 'jsx': 1,
- \ 'xml': 1,
- \}
- </code></pre><h3 id="the-gycm_show_diagnostics_ui-option">The <code>g:ycm_show_diagnostics_ui</code> option</h3><p>When set, this option turns on YCM's diagnostic display features. See the
- <em>Diagnostic display</em> section in the <em>User Manual</em> for more details.</p><p>Specific parts of the diagnostics UI (like the gutter signs, text highlighting,
- diagnostic echo and auto location list population) can be individually turned on
- or off. See the other options below for details.</p><p>Note that YCM's diagnostics UI is only supported for C-family languages.</p><p>When set, this option also makes YCM remove all Syntastic checkers set for the
- <code>c</code>, <code>cpp</code>, <code>objc</code>, <code>objcpp</code>, and <code>cuda</code> filetypes since this would conflict
- with YCM's own diagnostics UI.</p><p>If you're using YCM's identifier completer in C-family languages but cannot use
- the clang-based semantic completer for those languages <em>and</em> want to use the GCC
- Syntastic checkers, unset this option.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_show_diagnostics_ui = 1
- </code></pre><h3 id="the-gycm_error_symbol-option">The <code>g:ycm_error_symbol</code> option</h3><p>YCM will use the value of this option as the symbol for errors in the Vim
- gutter.</p><p>This option is part of the Syntastic compatibility layer; if the option is not
- set, YCM will fall back to the value of the <code>g:syntastic_error_symbol</code> option
- before using this option's default.</p><p>Default: <code>>></code></p><pre><code class="viml">let g:ycm_error_symbol = '>>'
- </code></pre><h3 id="the-gycm_warning_symbol-option">The <code>g:ycm_warning_symbol</code> option</h3><p>YCM will use the value of this option as the symbol for warnings in the Vim
- gutter.</p><p>This option is part of the Syntastic compatibility layer; if the option is not
- set, YCM will fall back to the value of the <code>g:syntastic_warning_symbol</code> option
- before using this option's default.</p><p>Default: <code>>></code></p><pre><code class="viml">let g:ycm_warning_symbol = '>>'
- </code></pre><h3 id="the-gycm_enable_diagnostic_signs-option">The <code>g:ycm_enable_diagnostic_signs</code> option</h3><p>When this option is set, YCM will put icons in Vim's gutter on lines that have a
- diagnostic set. Turning this off will also turn off the <code>YcmErrorLine</code> and
- <code>YcmWarningLine</code> highlighting.</p><p>This option is part of the Syntastic compatibility layer; if the option is not
- set, YCM will fall back to the value of the <code>g:syntastic_enable_signs</code> option
- before using this option's default.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_enable_diagnostic_signs = 1
- </code></pre><h3 id="the-gycm_enable_diagnostic_highlighting-option">The <code>g:ycm_enable_diagnostic_highlighting</code> option</h3><p>When this option is set, YCM will highlight regions of text that are related to
- the diagnostic that is present on a line, if any.</p><p>This option is part of the Syntastic compatibility layer; if the option is not
- set, YCM will fall back to the value of the <code>g:syntastic_enable_highlighting</code>
- option before using this option's default.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_enable_diagnostic_highlighting = 1
- </code></pre><h3 id="the-gycm_echo_current_diagnostic-option">The <code>g:ycm_echo_current_diagnostic</code> option</h3><p>When this option is set, YCM will echo the text of the diagnostic present on the
- current line when you move your cursor to that line. If a <code>FixIt</code> is available
- for the current diagnostic, then <code>(FixIt)</code> is appended.</p><p>This option is part of the Syntastic compatibility layer; if the option is not
- set, YCM will fall back to the value of the <code>g:syntastic_echo_current_error</code>
- option before using this option's default.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_echo_current_diagnostic = 1
- </code></pre><h3 id="the-gycm_auto_hover-option">The <code>g:ycm_auto_hover</code> option</h3><p>This option controls whether or not YCM shows documentation in a popup at the
- cursor location after a short delay. Only supported in Vim.</p><p>When this option is set to <code>'CursorHold'</code>, the popup is displayed on the
- <code>CursorHold</code> autocommand. See <code>:help CursorHold</code> for the details, but this means
- that it is displayed after <code>updatetime</code> milliseconds. When set to an empty
- string, the popup is not automatically displayed.</p><p>In addition to this setting, there is the <code><plug>(YCMHover)</code> mapping, which can
- be used to manually trigger or hide the popup (it works like a toggle).
- For example:</p><pre><code class="viml">nmap <leader>D <plug>(YCMHover)
- </code></pre><p>After dismissing the popup with this mapping, it will not be automatically
- triggered again until the cursor is moved (i.e. <code>CursorMoved</code> autocommand).</p><p>The displayed documentation depends on what the completer for the current
- language supports. It's selected heuristically in this order of preference:</p><ol>
- <li><code>GetHover</code> with <code>markdown</code> syntax</li>
- <li><code>GetDoc</code> with no syntax</li>
- <li><code>GetType</code> with the syntax of the current file. </li>
- </ol><p>You can customise this by manually setting up <code>b:ycm_hover</code> to your liking. This
- buffer-local variable can be set to a dictionary with the following keys:</p><ul>
- <li><code>command</code>: The YCM completer subcommand which should be run on hover</li>
- <li><code>syntax</code>: The syntax to use (as in <code>set syntax=</code>) in the popup window for
- highlighting.</li>
- </ul><p>For example, to use C/C++ syntax highlighting in the popup for C-family
- languages, add something like this to your vimrc:</p><pre><code class="viml">augroup MyYCMCustom
- autocmd!
- autocmd FileType c,cpp let b:ycm_hover = {
- \ 'command': 'GetDoc',
- \ 'syntax': &filetype
- \ }
- augroup END
- </code></pre><p>Default: <code>'CursorHold'</code></p><h3 id="the-gycm_filter_diagnostics-option">The <code>g:ycm_filter_diagnostics</code> option</h3><p>This option controls which diagnostics will be rendered by YCM. This option
- holds a dictionary of key-values, where the keys are Vim's filetype strings
- delimited by commas and values are dictionaries describing the filter.</p><p>A filter is a dictionary of key-values, where the keys are the type of filter,
- and the value is a list of arguments to that filter. In the case of just a
- single item in the list, you may omit the brackets and just provide the argument
- directly. If any filter matches a diagnostic, it will be dropped and YCM will
- not render it.</p><p>The following filter types are supported:</p><ul>
- <li>"regex": Accepts a string <a href="https://docs.python.org/2/library/re.html#regular-expression-syntax">regular expression</a>. This type matches
- when the regex (treated as case-insensitive) is found in the diagnostic text.</li>
- <li>"level": Accepts a string level, either "warning" or "error." This type
- matches when the diagnostic has the same level.</li>
- </ul><p><strong>NOTE:</strong> The regex syntax is <strong>NOT</strong> Vim's, it's <a href="https://docs.python.org/2/library/re.html#regular-expression-syntax">Python's</a>.</p><p>Default: <code>{}</code></p><pre><code class="viml">let g:ycm_filter_diagnostics = {
- \ "java": {
- \ "regex": [ ".*taco.*", ... ],
- \ "level": "error",
- \ ...
- \ }
- \ }
- </code></pre><h3 id="the-gycm_always_populate_location_list-option">The <code>g:ycm_always_populate_location_list</code> option</h3><p>When this option is set, YCM will populate the location list automatically every
- time it gets new diagnostic data. This option is off by default so as not to
- interfere with other data you might have placed in the location list.</p><p>See <code>:help location-list</code> in Vim to learn more about the location list.</p><p>This option is part of the Syntastic compatibility layer; if the option is not
- set, YCM will fall back to the value of the
- <code>g:syntastic_always_populate_loc_list</code> option before using this option's
- default.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_always_populate_location_list = 0
- </code></pre><h3 id="the-gycm_open_loclist_on_ycm_diags-option">The <code>g:ycm_open_loclist_on_ycm_diags</code> option</h3><p>When this option is set, <code>:YcmDiags</code> will automatically open the location list
- after forcing a compilation and filling the list with diagnostic data.</p><p>See <code>:help location-list</code> in Vim to learn more about the location list.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_open_loclist_on_ycm_diags = 1
- </code></pre><h3 id="the-gycm_complete_in_comments-option">The <code>g:ycm_complete_in_comments</code> option</h3><p>When this option is set to <code>1</code>, YCM will show the completion menu even when
- typing inside comments.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_complete_in_comments = 0
- </code></pre><h3 id="the-gycm_complete_in_strings-option">The <code>g:ycm_complete_in_strings</code> option</h3><p>When this option is set to <code>1</code>, YCM will show the completion menu even when
- typing inside strings.</p><p>Note that this is turned on by default so that you can use the filename
- completion inside strings. This is very useful for instance in C-family files
- where typing <code>#include "</code> will trigger the start of filename completion. If you
- turn off this option, you will turn off filename completion in such situations
- as well.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_complete_in_strings = 1
- </code></pre><h3 id="the-gycm_collect_identifiers_from_comments_and_strings-option">The <code>g:ycm_collect_identifiers_from_comments_and_strings</code> option</h3><p>When this option is set to <code>1</code>, YCM's identifier completer will also collect
- identifiers from strings and comments. Otherwise, the text in comments and
- strings will be ignored.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_collect_identifiers_from_comments_and_strings = 0
- </code></pre><h3 id="the-gycm_collect_identifiers_from_tags_files-option">The <code>g:ycm_collect_identifiers_from_tags_files</code> option</h3><p>When this option is set to <code>1</code>, YCM's identifier completer will also collect
- identifiers from tags files. The list of tags files to examine is retrieved from
- the <code>tagfiles()</code> Vim function which examines the <code>tags</code> Vim option. See <code>:h
- 'tags'</code> for details.</p><p>YCM will re-index your tags files if it detects that they have been modified.</p><p>The only supported tag format is the <a href="http://ctags.sourceforge.net/FORMAT">Exuberant Ctags format</a>. The
- format from "plain" ctags is NOT supported. Ctags needs to be called with the
- <code>--fields=+l</code> option (that's a lowercase <code>L</code>, not a one) because YCM needs the
- <code>language:<lang></code> field in the tags output.</p><p>See the <em>FAQ</em> for pointers if YCM does not appear to read your tag files.</p><p>This option is off by default because it makes Vim slower if your tags are on a
- network directory.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_collect_identifiers_from_tags_files = 0
- </code></pre><h3 id="the-gycm_seed_identifiers_with_syntax-option">The <code>g:ycm_seed_identifiers_with_syntax</code> option</h3><p>When this option is set to <code>1</code>, YCM's identifier completer will seed its
- identifier database with the keywords of the programming language you're
- writing.</p><p>Since the keywords are extracted from the Vim syntax file for the filetype, all
- keywords may not be collected, depending on how the syntax file was written.
- Usually at least 95% of the keywords are successfully extracted.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_seed_identifiers_with_syntax = 0
- </code></pre><h3 id="the-gycm_extra_conf_vim_data-option">The <code>g:ycm_extra_conf_vim_data</code> option</h3><p>If you're using semantic completion for C-family files, this option might come
- handy; it's a way of sending data from Vim to your <code>Settings</code> function in
- your <code>.ycm_extra_conf.py</code> file.</p><p>This option is supposed to be a list of VimScript expression strings that are
- evaluated for every request to the <a href="https://github.com/ycm-core/ycmd">ycmd server</a> and then passed to your
- <code>Settings</code> function as a <code>client_data</code> keyword argument.</p><p>For instance, if you set this option to <code>['v:version']</code>, your <code>Settings</code>
- function will be called like this:</p><pre><code class="python"># The '801' value is of course contingent on Vim 8.1; in 8.0 it would be '800'
- Settings( ..., client_data = { 'v:version': 801 } )
- </code></pre><p>So the <code>client_data</code> parameter is a dictionary mapping Vim expression strings to
- their values at the time of the request.</p><p>The correct way to define parameters for your <code>Settings</code> function:</p><pre><code class="python">def Settings( **kwargs ):
- </code></pre><p>You can then get to <code>client_data</code> with <code>kwargs['client_data']</code>.</p><p>Default: <code>[]</code></p><pre><code class="viml">let g:ycm_extra_conf_vim_data = []
- </code></pre><h3 id="the-gycm_server_python_interpreter-option">The <code>g:ycm_server_python_interpreter</code> option</h3><p>YCM will by default search for an appropriate Python interpreter on your system.
- You can use this option to override that behavior and force the use of a
- specific interpreter of your choosing.</p><p><strong>NOTE:</strong> This interpreter is only used for the <a href="https://github.com/ycm-core/ycmd">ycmd server</a>. The YCM
- client running inside Vim always uses the Python interpreter that's embedded
- inside Vim.</p><p>Default: <code>''</code></p><pre><code class="viml">let g:ycm_server_python_interpreter = ''
- </code></pre><h3 id="the-gycm_keep_logfiles-option">The <code>g:ycm_keep_logfiles</code> option</h3><p>When this option is set to <code>1</code>, YCM and the <a href="https://github.com/ycm-core/ycmd">ycmd completion server</a> will
- keep the logfiles around after shutting down (they are deleted on shutdown by
- default).</p><p>To see where the logfiles are, call <code>:YcmDebugInfo</code>.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_keep_logfiles = 0
- </code></pre><h3 id="the-gycm_log_level-option">The <code>g:ycm_log_level</code> option</h3><p>The logging level that YCM and the <a href="https://github.com/ycm-core/ycmd">ycmd completion server</a> use. Valid
- values are the following, from most verbose to least verbose:
- - <code>debug</code>
- - <code>info</code>
- - <code>warning</code>
- - <code>error</code>
- - <code>critical</code></p><p>Note that <code>debug</code> is <em>very</em> verbose.</p><p>Default: <code>info</code></p><pre><code class="viml">let g:ycm_log_level = 'info'
- </code></pre><h3 id="the-gycm_auto_start_csharp_server-option">The <code>g:ycm_auto_start_csharp_server</code> option</h3><p>When set to <code>1</code>, the OmniSharp-Roslyn server will be automatically started
- (once per Vim session) when you open a C# file.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_auto_start_csharp_server = 1
- </code></pre><h3 id="the-gycm_auto_stop_csharp_server-option">The <code>g:ycm_auto_stop_csharp_server</code> option</h3><p>When set to <code>1</code>, the OmniSharp-Roslyn server will be automatically stopped upon
- closing Vim.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_auto_stop_csharp_server = 1
- </code></pre><h3 id="the-gycm_csharp_server_port-option">The <code>g:ycm_csharp_server_port</code> option</h3><p>When g:ycm_auto_start_csharp_server is set to <code>1</code>, specifies the port for
- the OmniSharp-Roslyn server to listen on. When set to <code>0</code> uses an unused port provided
- by the OS.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_csharp_server_port = 0
- </code></pre><h3 id="the-gycm_csharp_insert_namespace_expr-option">The <code>g:ycm_csharp_insert_namespace_expr</code> option</h3><p>By default, when YCM inserts a namespace, it will insert the <code>using</code> statement
- under the nearest <code>using</code> statement. You may prefer that the <code>using</code> statement is
- inserted somewhere, for example, to preserve sorting. If so, you can set this
- option to override this behavior.</p><p>When this option is set, instead of inserting the <code>using</code> statement itself, YCM
- will set the global variable <code>g:ycm_namespace_to_insert</code> to the namespace to
- insert, and then evaluate this option's value as an expression. The option's
- expression is responsible for inserting the namespace - the default insertion
- will not occur.</p><p>Default: ''</p><pre><code class="viml">let g:ycm_csharp_insert_namespace_expr = ''
- </code></pre><h3 id="the-gycm_add_preview_to_completeopt-option">The <code>g:ycm_add_preview_to_completeopt</code> option</h3><p>When this option is set to <code>1</code>, YCM will add the <code>preview</code> string to Vim's
- <code>completeopt</code> option (see <code>:h completeopt</code>). If your <code>completeopt</code> option
- already has <code>preview</code> set, there will be no effect. Alternatively, when set to
- <code>popup</code> and your version of Vim supports popup windows (see <code>:help popup</code>), the
- <code>popup</code> string will be used instead. You can see the current state of your
- <code>completeopt</code> setting with <code>:set completeopt?</code> (yes, the question mark is
- important).</p><p>When <code>preview</code> is present in <code>completeopt</code>, YCM will use the <code>preview</code> window at
- the top of the file to store detailed information about the current completion
- candidate (but only if the candidate came from the semantic engine). For
- instance, it would show the full function prototype and all the function
- overloads in the window if the current completion is a function name.</p><p>When <code>popup</code> is present in <code>completeopt</code>, YCM will instead use a <code>popup</code>
- window to the side of the completion popup for storing detailed information
- about the current completion candidate. In addition, YCM may truncate the
- detailed completion information in order to give the popup sufficient room
- to display that detailed information.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_add_preview_to_completeopt = 0
- </code></pre><h3 id="the-gycm_autoclose_preview_window_after_completion-option">The <code>g:ycm_autoclose_preview_window_after_completion</code> option</h3><p>When this option is set to <code>1</code>, YCM will auto-close the <code>preview</code> window after
- the user accepts the offered completion string. If there is no <code>preview</code> window
- triggered because there is no <code>preview</code> string in <code>completeopt</code>, this option is
- irrelevant. See the <code>g:ycm_add_preview_to_completeopt</code> option for more details.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_autoclose_preview_window_after_completion = 0
- </code></pre><h3 id="the-gycm_autoclose_preview_window_after_insertion-option">The <code>g:ycm_autoclose_preview_window_after_insertion</code> option</h3><p>When this option is set to <code>1</code>, YCM will auto-close the <code>preview</code> window after
- the user leaves insert mode. This option is irrelevant if
- <code>g:ycm_autoclose_preview_window_after_completion</code> is set or if no <code>preview</code>
- window is triggered. See the <code>g:ycm_add_preview_to_completeopt</code> option for more
- details.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_autoclose_preview_window_after_insertion = 0
- </code></pre><h3 id="the-gycm_max_diagnostics_to_display-option">The <code>g:ycm_max_diagnostics_to_display</code> option</h3><p>This option controls the maximum number of diagnostics shown to the user when
- errors or warnings are detected in the file. This option is only relevant for
- the C-family, C#, Java, JavaScript, and TypeScript languages.</p><p>A special value of <code>0</code> means there is no limit.</p><p>Default: <code>30</code></p><pre><code class="viml">let g:ycm_max_diagnostics_to_display = 30
- </code></pre><h3 id="the-gycm_key_list_select_completion-option">The <code>g:ycm_key_list_select_completion</code> option</h3><p>This option controls the key mappings used to select the first completion
- string. Invoking any of them repeatedly cycles forward through the completion
- list.</p><p>Some users like adding <code><Enter></code> to this list.</p><p>Default: <code>['<TAB>', '<Down>']</code></p><pre><code class="viml">let g:ycm_key_list_select_completion = ['<TAB>', '<Down>']
- </code></pre><h3 id="the-gycm_key_list_previous_completion-option">The <code>g:ycm_key_list_previous_completion</code> option</h3><p>This option controls the key mappings used to select the previous completion
- string. Invoking any of them repeatedly cycles backwards through the completion
- list.</p><p>Note that one of the defaults is <code><S-TAB></code> which means Shift-TAB. That mapping
- will probably only work in GUI Vim (Gvim or MacVim) and not in plain console Vim
- because the terminal usually does not forward modifier key combinations to Vim.</p><p>Default: <code>['<S-TAB>', '<Up>']</code></p><pre><code class="viml">let g:ycm_key_list_previous_completion = ['<S-TAB>', '<Up>']
- </code></pre><h3 id="the-gycm_key_list_stop_completion-option">The <code>g:ycm_key_list_stop_completion</code> option</h3><p>This option controls the key mappings used to close the completion menu. This is
- useful when the menu is blocking the view, when you need to insert the <code><TAB></code>
- character, or when you want to expand a snippet from <a href="https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt">UltiSnips</a> and navigate
- through it.</p><p>Default: <code>['<C-y>']</code></p><pre><code class="viml">let g:ycm_key_list_stop_completion = ['<C-y>']
- </code></pre><h3 id="the-gycm_key_invoke_completion-option">The <code>g:ycm_key_invoke_completion</code> option</h3><p>This option controls the key mapping used to invoke the completion menu for
- semantic completion. By default, semantic completion is triggered automatically
- after typing <code>.</code>, <code>-></code> and <code>::</code> in insert mode (if semantic completion support
- has been compiled in). This key mapping can be used to trigger semantic
- completion anywhere. Useful for searching for top-level functions and classes.</p><p>Console Vim (not Gvim or MacVim) passes <code><Nul></code> to Vim when the user types
- <code><C-Space></code> so YCM will make sure that <code><Nul></code> is used in the map command when
- you're editing in console Vim, and <code><C-Space></code> in GUI Vim. This means that you
- can just press <code><C-Space></code> in both console and GUI Vim and YCM will do the right
- thing.</p><p>Setting this option to an empty string will make sure no mapping is created.</p><p>Default: <code><C-Space></code></p><pre><code class="viml">let g:ycm_key_invoke_completion = '<C-Space>'
- </code></pre><h3 id="the-gycm_key_detailed_diagnostics-option">The <code>g:ycm_key_detailed_diagnostics</code> option</h3><p>This option controls the key mapping used to show the full diagnostic text when
- the user's cursor is on the line with the diagnostic. It basically calls
- <code>:YcmShowDetailedDiagnostic</code>.</p><p>Setting this option to an empty string will make sure no mapping is created.</p><p>Default: <code><leader>d</code></p><pre><code class="viml">let g:ycm_key_detailed_diagnostics = '<leader>d'
- </code></pre><h3 id="the-gycm_global_ycm_extra_conf-option">The <code>g:ycm_global_ycm_extra_conf</code> option</h3><p>Normally, YCM searches for a <code>.ycm_extra_conf.py</code> file for compilation flags
- (see the User Guide for more details on how this works). This option specifies
- a fallback path to a config file which is used if no <code>.ycm_extra_conf.py</code> is
- found.</p><p>You can place such a global file anywhere in your filesystem.</p><p>Default: <code>''</code></p><pre><code class="viml">let g:ycm_global_ycm_extra_conf = ''
- </code></pre><h3 id="the-gycm_confirm_extra_conf-option">The <code>g:ycm_confirm_extra_conf</code> option</h3><p>When this option is set to <code>1</code> YCM will ask once per <code>.ycm_extra_conf.py</code> file
- if it is safe to be loaded. This is to prevent execution of malicious code
- from a <code>.ycm_extra_conf.py</code> file you didn't write.</p><p>To selectively get YCM to ask/not ask about loading certain <code>.ycm_extra_conf.py</code>
- files, see the <code>g:ycm_extra_conf_globlist</code> option.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_confirm_extra_conf = 1
- </code></pre><h3 id="the-gycm_extra_conf_globlist-option">The <code>g:ycm_extra_conf_globlist</code> option</h3><p>This option is a list that may contain several globbing patterns. If a pattern
- starts with a <code>!</code> all <code>.ycm_extra_conf.py</code> files matching that pattern will be
- blacklisted, that is they won't be loaded and no confirmation dialog will be
- shown. If a pattern does not start with a <code>!</code> all files matching that pattern
- will be whitelisted. Note that this option is not used when confirmation is
- disabled using <code>g:ycm_confirm_extra_conf</code> and that items earlier in the list
- will take precedence over the later ones.</p><p>Rules:</p><ul>
- <li><code>*</code> matches everything</li>
- <li><code>?</code> matches any single character</li>
- <li><code>[seq]</code> matches any character in seq</li>
- <li><code>[!seq]</code> matches any char not in seq</li>
- </ul><p>Example:</p><pre><code class="viml">let g:ycm_extra_conf_globlist = ['~/dev/*','!~/*']
- </code></pre><ul>
- <li>The first rule will match everything contained in the <code>~/dev</code> directory so
- <code>.ycm_extra_conf.py</code> files from there will be loaded.</li>
- <li>The second rule will match everything in the home directory so a
- <code>.ycm_extra_conf.py</code> file from there won't be loaded.</li>
- <li>As the first rule takes precedence everything in the home directory excluding
- the <code>~/dev</code> directory will be blacklisted.</li>
- </ul><p><strong>NOTE:</strong> The glob pattern is first expanded with Python's
- <code>os.path.expanduser()</code> and then resolved with <code>os.path.abspath()</code> before being
- matched against the filename.</p><p>Default: <code>[]</code></p><pre><code class="viml">let g:ycm_extra_conf_globlist = []
- </code></pre><h3 id="the-gycm_filepath_completion_use_working_dir-option">The <code>g:ycm_filepath_completion_use_working_dir</code> option</h3><p>By default, YCM's filepath completion will interpret relative paths like <code>../</code>
- as being relative to the folder of the file of the currently active buffer.
- Setting this option will force YCM to always interpret relative paths as being
- relative to Vim's current working directory.</p><p>Default: <code>0</code></p><pre><code class="viml">let g:ycm_filepath_completion_use_working_dir = 0
- </code></pre><h3 id="the-gycm_semantic_triggers-option">The <code>g:ycm_semantic_triggers</code> option</h3><p>This option controls the character-based triggers for the various semantic
- completion engines. The option holds a dictionary of key-values, where the keys
- are Vim's filetype strings delimited by commas and values are lists of strings,
- where the strings are the triggers.</p><p>Setting key-value pairs on the dictionary <em>adds</em> semantic triggers to the
- internal default set (listed below). You cannot remove the default triggers,
- only add new ones.</p><p>A "trigger" is a sequence of one or more characters that trigger semantic
- completion when typed. For instance, C++ (<code>cpp</code> filetype) has <code>.</code> listed as a
- trigger. So when the user types <code>foo.</code>, the semantic engine will trigger and
- serve <code>foo</code>'s list of member functions and variables. Since C++ also has <code>-></code>
- listed as a trigger, the same thing would happen when the user typed <code>foo-></code>.</p><p>It's also possible to use a regular expression as a trigger. You have to prefix
- your trigger with <code>re!</code> to signify it's a regex trigger. For instance,
- <code>re!\w+\.</code> would only trigger after the <code>\w+\.</code> regex matches.</p><p><strong>NOTE:</strong> The regex syntax is <strong>NOT</strong> Vim's, it's <a href="https://docs.python.org/2/library/re.html#regular-expression-syntax">Python's</a>.</p><p>Default: <code>[see next line]</code></p><pre><code class="viml">let g:ycm_semantic_triggers = {
- \ 'c': ['->', '.'],
- \ 'objc': ['->', '.', 're!\[[_a-zA-Z]+\w*\s', 're!^\s*[^\W\d]\w*\s',
- \ 're!\[.*\]\s'],
- \ 'ocaml': ['.', '#'],
- \ 'cpp,cuda,objcpp': ['->', '.', '::'],
- \ 'perl': ['->'],
- \ 'php': ['->', '::'],
- \ 'cs,d,elixir,go,groovy,java,javascript,julia,perl6,python,scala,typescript,vb': ['.'],
- \ 'ruby,rust': ['.', '::'],
- \ 'lua': ['.', ':'],
- \ 'erlang': [':'],
- \ }
- </code></pre><h3 id="the-gycm_cache_omnifunc-option">The <code>g:ycm_cache_omnifunc</code> option</h3><p>Some omnicompletion engines do not work well with the YCM cache—in particular,
- they might not produce all possible results for a given prefix. By unsetting
- this option you can ensure that the omnicompletion engine is re-queried on every
- keypress. That will ensure all completions will be presented, but might cause
- stuttering and lagginess if the omnifunc is slow.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_cache_omnifunc = 1
- </code></pre><h3 id="the-gycm_use_ultisnips_completer-option">The <code>g:ycm_use_ultisnips_completer</code> option</h3><p>By default, YCM will query the UltiSnips plugin for possible completions of
- snippet triggers. This option can turn that behavior off.</p><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_use_ultisnips_completer = 1
- </code></pre><h3 id="the-gycm_goto_buffer_command-option">The <code>g:ycm_goto_buffer_command</code> option</h3><p>Defines where <code>GoTo*</code> commands result should be opened. Can take one of the
- following values: <code>'same-buffer'</code>, <code>'split'</code>, or <code>'split-or-existing-window'</code>.
- If this option is set to the <code>'same-buffer'</code> but current buffer can not be
- switched (when buffer is modified and <code>nohidden</code> option is set), then result
- will be opened in a split. When the option is set to
- <code>'split-or-existing-window'</code>, if the result is already open in a window of the
- current tab page (or any tab pages with the <code>:tab</code> modifier; see below), it will
- jump to that window. Otherwise, the result will be opened in a split as if the
- option was set to <code>'split'</code>.</p><p>To customize the way a new window is split, prefix the <code>GoTo*</code> command with one
- of the following modifiers: <code>:aboveleft</code>, <code>:belowright</code>, <code>:botright</code>,
- <code>:leftabove</code>, <code>:rightbelow</code>, <code>:topleft</code>, and <code>:vertical</code>. For instance, to
- split vertically to the right of the current window, run the command:</p><pre><code class="viml">:rightbelow vertical YcmCompleter GoTo
- </code></pre><p>To open in a new tab page, use the <code>:tab</code> modifier with the <code>'split'</code> or
- <code>'split-or-existing-window'</code> options e.g.:</p><pre><code class="viml">:tab YcmCompleter GoTo
- </code></pre><p><strong>NOTE:</strong> command modifiers were added in Vim 7.4.1898. If you are using an
- older version, you can still configure this by setting the option to one of the
- deprecated values: <code>'vertical-split'</code>, <code>'new-tab'</code>, or <code>'new-or-existing-tab'</code>.</p><p>Default: <code>'same-buffer'</code></p><pre><code class="viml">let g:ycm_goto_buffer_command = 'same-buffer'
- </code></pre><h3 id="the-gycm_disable_for_files_larger_than_kb-option">The <code>g:ycm_disable_for_files_larger_than_kb</code> option</h3><p>Defines the max size (in Kb) for a file to be considered for completion. If this
- option is set to 0 then no check is made on the size of the file you're opening.</p><p>Default: 1000</p><pre><code class="viml">let g:ycm_disable_for_files_larger_than_kb = 1000
- </code></pre><h3 id="the-gycm_use_clangd-option">The <code>g:ycm_use_clangd</code> option</h3><p>This option controls whether <strong>clangd</strong> should be used as completion engine for
- C-family languages. Can take one of the following values: <code>1</code>, <code>0</code>, with
- meanings:</p><ul>
- <li><code>1</code>: YCM will use clangd if clangd binary exists in third party or it was
- provided with <code>ycm_clangd_binary_path</code> option.</li>
- <li><code>0</code>: YCM will never use clangd completer.</li>
- </ul><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_use_clangd = 1
- </code></pre><h3 id="the-gycm_clangd_binary_path-option">The <code>g:ycm_clangd_binary_path</code> option</h3><p>When <code>ycm_use_clangd</code> option is set to <code>1</code>, this option sets the path to
- <strong>clangd</strong> binary.</p><p>Default: <code>''</code></p><pre><code class="viml">let g:ycm_clangd_binary_path = ''
- </code></pre><h3 id="the-gycm_clangd_args-option">The <code>g:ycm_clangd_args</code> option</h3><p>This option controls the command line arguments passed to the clangd binary. It
- appends new options and overrides the existing ones.</p><p>Default: <code>[]</code></p><pre><code class="viml">let g:ycm_clangd_args = []
- </code></pre><h3 id="the-gycm_clangd_uses_ycmd_caching-option">The <code>g:ycm_clangd_uses_ycmd_caching</code> option</h3><p>This option controls which ranking and filtering algorithm to use for completion
- items. It can take values:</p><ul>
- <li><code>1</code>: Uses ycmd's caching and filtering logic.</li>
- <li><code>0</code>: Uses clangd's caching and filtering logic.</li>
- </ul><p>Default: <code>1</code></p><pre><code class="viml">let g:ycm_clangd_uses_ycmd_caching = 1
- </code></pre><h3 id="the-gycm_language_server-option">The <code>g:ycm_language_server</code> option</h3><p>This option lets YCM use an arbitrary LSP server, not unlike coc.nvim and others.
- However, the officially supported completers are favoured over custom LSP ones,
- so overriding an existing completer means first making sure YCM won't choose
- that existing completer in the first place.</p><p>A simple working example of this option can be found in the section called
- <a href="#semantic-completion-for-other-languages">"Semantic Completion for Other Languages"</a>.</p><p>Default: <code>[]</code></p><pre><code class="viml">let g:ycm_language_server = []
- </code></pre><h3 id="the-gycm_disable_signature_help-option">The <code>g:ycm_disable_signature_help</code> option</h3><p>This option allows you to disable all signature help for all completion engines.
- There is no way to disable it per-completer. This option is <em>reserved</em>, meaning
- that while signature help support remains experimental, its values and meaning
- may change and it may be removed in a future version.</p><p>Default: <code>0</code></p><pre><code class="viml">" Disable signature help
- let g:ycm_disable_signature_help = 1
- </code></pre><h3 id="the-gycm_gopls_binary_path-option">The <code>g:ycm_gopls_binary_path</code> option</h3><p>In case the system-wide <code>gopls</code> binary is newer than the bundled one, setting
- this option to the path of the system-wide <code>gopls</code> would make YCM use that one
- instead.</p><p>If the path is just <code>gopls</code>, YCM will search in <code>$PATH</code>.</p><h3 id="the-gycm_gopls_args-option">The <code>g:ycm_gopls_args</code> option</h3><p>Similar to <a href="#the-gycm-clangd-args">the <code>g:ycm_clangd_args</code></a>, this option allows
- passing additional flags to the <code>gopls</code> command line.</p><p>Default: <code>[]</code></p><pre><code class="viml">let g:ycm_gopls_args = []
- </code></pre><h3 id="the-gycm_rls_binary_path-and-gycm_rustc_binary_path-options">The <code>g:ycm_rls_binary_path</code> and <code>g:ycm_rustc_binary_path</code> options</h3><p>Similar to <a href="#the-gycm-gopls-binaty-path">the <code>gopls</code> path</a>, these two options
- tell YCM which <code>rls</code> and <code>rustc</code> to use.</p><p>NOTE: You <em>need</em> to either set both or none of these two.</p><h3 id="the-gycm_tsserver_binary_path-option">The <code>g:ycm_tsserver_binary_path</code> option</h3><p>Similar to <a href="#the-gycm-gopls-binaty-path">the <code>gopls</code> path</a>, this option
- tells YCM where is the TSServer executable located.</p><h3 id="the-gycm_roslyn_binary_path-option">The <code>g:ycm_roslyn_binary_path</code> option</h3><p>Similar to <a href="#the-gycm-gopls-binaty-path">the <code>gopls</code> path</a>, this option
- tells YCM where is the Omnisharp-Roslyn executable located.</p><h2 id="faq">FAQ</h2><p>The FAQ section has been moved to the <a href="https://github.com/ycm-core/YouCompleteMe/wiki/FAQ">wiki</a>.</p><h2 id="contributor-code-of-conduct">Contributor Code of Conduct</h2><p>Please note that this project is released with a <a href="https://github.com/ycm-core/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md">Contributor Code of
- Conduct</a>. By participating in this project you agree to abide by its
- terms.</p><h2 id="contact">Contact</h2><p>If you have questions about the plugin or need help, please join the <a href="https://gitter.im/Valloric/YouCompleteMe">Gitter
- room</a> or use the <a href="https://groups.google.com/forum/?hl=en#!forum/ycm-users">ycm-users</a> mailing list.</p><p>If you have bug reports or feature suggestions, please use the <a href="https://github.com/ycm-core/YouCompleteMe/issues?state=open">issue
- tracker</a>. Before you do, please carefully read
- <a href="https://github.com/ycm-core/YouCompleteMe/blob/master/CONTRIBUTING.md">CONTRIBUTING.md</a> as this asks for important diagnostics which
- the team will use to help get you going.</p><p>The latest version of the plugin is available at
- <a href="https://ycm-core.github.io/YouCompleteMe/">https://ycm-core.github.io/YouCompleteMe/</a>.</p><p>The author's homepage is <a href="https://val.markovic.io">https://val.markovic.io</a>.</p><p>Please do <strong>NOT</strong> go to #vim on freenode for support. Please contact the
- YouCompleteMe maintainers directly using the <a href="#contact">contact details</a>.</p><h2 id="license">License</h2><p>This software is licensed under the <a href="https://www.gnu.org/copyleft/gpl.html">GPL v3 license</a>.
- © 2015-2018 YouCompleteMe contributors</p></div>
- </section>
- </div>
- <!--[if !IE]><script>fixScale(document);</script><![endif]-->
- <script type="text/javascript">
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
- </script>
- <script type="text/javascript">
- try {
- var pageTracker = _gat._getTracker("UA-34688172-3");
- pageTracker._trackPageview();
- } catch(err) {}
- </script>
- <a href="https://github.com/Valloric/YouCompleteMe"><img alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" style="position: absolute; top: 0; right: 0; border: 0;"/></a>
- </body></html>
|