{"tagline":"An autocompletion system for Vim","name":"Youcompleteme","body":"YouCompleteMe: a code-completion engine for Vim\r\n===============================================\r\n\r\nYouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for\r\n[Vim][]. It has two completion engines: an identifier-based engine that works\r\nwith every programming language and a semantic, [Clang][]-based engine that\r\nprovides semantic code completion for C/C++/Objective-C/Objective-C++ (from now\r\non referred to as \"the C-family languages\").\r\n\r\n![YouCompleteMe GIF demo](http://i.imgur.com/0OP4ood.gif)\r\n\r\nHere's an explanation of what happens in the short GIF demo above.\r\n\r\nFirst, realize that **no keyboard shortcuts had to be pressed** to get the list\r\nof completion candidates at any point in the demo. The user just types and the\r\nsuggestions pop up by themselves. If the user doesn't find the completion\r\nsuggestions relevant and/or just wants to type, he can do so; the completion\r\nengine will not interfere.\r\n\r\nWhen the user sees a useful completion string being offered, he presses the TAB\r\nkey to accept it. This inserts the completion string. Repeated presses of the\r\nTAB key cycle through the offered completions.\r\n\r\nIf the offered completions are not relevant enough, the user can continue typing\r\nto further filter out unwanted completions.\r\n\r\nA critical thing to notice is that the completion **filtering is NOT based on\r\nthe input being a string prefix of the completion** (but that works too). The\r\ninput needs to be a _[subsequence][] match_ of a completion. This is a fancy way\r\nof saying that any input characters need to be present in a completion string in\r\nthe order in which they appear in the input. So `abc` is a subsequence of\r\n`xaybgc`, but not of `xbyxaxxc`. After the filter, a complicated sorting system\r\nranks the completion strings so that the most relevant ones rise to the top of\r\nthe menu (so you usually need to press TAB just once).\r\n\r\n**All of the above works with any programming language** because of the\r\nidentifier-based completion engine. It collects all of the identifiers in the\r\ncurrent file and other files you visit and searches them when you type\r\n(identifiers are put into per-filetype groups).\r\n\r\nThe demo also shows the semantic engine in use. The current semantic engine\r\nsupports only C-family languages. When the user presses `.`, `->` or `::` while\r\ntyping in insert mode, the semantic engine is triggered (it can also be\r\ntriggered with a keyboard shortcut; see the rest of the docs).\r\n\r\nThe last thing that you can see in the demo is YCM's integration with\r\n[Syntastic][] (the little red X that shows up in the left gutter) if you are\r\nediting a file with semantic engine support. As Clang compiles your file and\r\ndetects warnings or errors, they will be piped to Syntastic for display. You\r\ndon't need to save your file or press any keyboard shortcut to trigger this, it\r\n\"just happens\" in the background.\r\n\r\nIn essence, YCM obsoletes the following Vim plugins because it has all of their\r\nfeatures plus extra:\r\n\r\n- clang_complete\r\n- AutoComplPop\r\n- Supertab\r\n- neocomplcache\r\n\r\nMac OS X super-quick installation\r\n---------------------------------\r\n\r\nPlease refer to the full Installation Guide below; the following commands are\r\nprovided on a best-effort basis and may not work for you.\r\n\r\nInstall the latest version of [MacVim][]. Yes, MacVim. And yes, the _latest_.\r\nEven if you don't like the MacVim GUI, you can use the Vim binary that is inside\r\nthe MacVim.app package (`MacVim.app/Contents/MacOS/Vim`).\r\n\r\nInstall YouCompleteMe with [Vundle][].\r\n\r\nInstall CMake. Preferably with [Homebrew][brew], but here's the [stand-alone\r\nCMake installer][cmake-download].\r\n\r\n_If_ you care about semantic completion for C-family languages, type in the\r\nfollowing commands in the console. If you don't, **skip this step**.\r\n\r\n cd ~\r\n mkdir ycm_temp\r\n cd ycm_temp\r\n curl -O http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-apple-darwin11.tar.gz\r\n tar -zxvf clang+llvm-3.2-x86_64-apple-darwin11.tar.gz\r\n cp clang+llvm-3.2-x86_64-apple-darwin11/lib/libclang.dylib ~/.vim/bundle/YouCompleteMe/python\r\n\r\nCompiling YCM **with** semantic support for C-family languages (previous step\r\nrequired):\r\n\r\n cd ~\r\n makedir ycm_build\r\n cd ycm_build\r\n cmake -G \"Unix Makefiles\" -DPATH_TO_LLVM_ROOT=~/ycm_temp/clang+llvm-3.2-x86_64-apple-darwin11 . ~/.vim/bundle/YouCompleteMe/cpp\r\n make ycm_core\r\n\r\nCompiling YCM **without** semantic support for C-family languages:\r\n\r\n cd ~\r\n makedir ycm_build\r\n cd ycm_build\r\n cmake -G \"Unix Makefiles\" . ~/.vim/bundle/YouCompleteMe/cpp\r\n make ycm_core\r\n\r\nThat's it. You're done. Refer to the User Guide section on how to use YCM. Don't\r\nforget that if you want the C-family semantic completion engine to work, you\r\nwill need to provide the compilation flags for your project to YCM. It's all in\r\nthe User Guide.\r\n\r\nYCM comes with sane defaults for its options, but you still may want to take a\r\nlook at what's available for configuration. There are a few interesting options\r\nthat are conservatively turned off by default that you may want to turn on.\r\n\r\nUbuntu Linux x64 super-quick installation\r\n-----------------------------------------\r\n\r\nPlease refer to the full Installation Guide below; the following commands are\r\nprovided on a best-effort basis and may not work for you.\r\n\r\nMake sure you have Vim 7.3.584 with python2 support. At the time of writing, the\r\nversion of Vim shipping with Ubuntu is too old. You may need to [compile Vim\r\nfrom source][vim-build] (don't worry, it's easy).\r\n\r\nInstall YouCompleteMe with [Vundle][].\r\n\r\nInstall CMake. `sudo apt-get install cmake`\r\n\r\n_If_ you care about semantic completion for C-family languages, type in the\r\nfollowing commands in the console. If you don't, **skip this step**.\r\n\r\n cd ~\r\n mkdir ycm_temp\r\n cd ycm_temp\r\n curl -O http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-linux-ubuntu-12.04.tar.gz\r\n tar -zxvf clang+llvm-3.2-x86_64-linux-ubuntu-12.04.tar.gz\r\n cp clang+llvm-3.2-x86_64-linux-ubuntu-12.04/lib/libclang.so ~/.vim/bundle/YouCompleteMe/python\r\n\r\nCompiling YCM **with** semantic support for C-family languages (previous step\r\nrequired):\r\n\r\n cd ~\r\n mkdir ycm_build\r\n cd ycm_build\r\n cmake -G \"Unix Makefiles\" -DPATH_TO_LLVM_ROOT=~/ycm_temp/clang+llvm-3.2-x86_64-linux-ubuntu-12.04 . ~/.vim/bundle/YouCompleteMe/cpp\r\n make ycm_core\r\n\r\nCompiling YCM **without** semantic support for C-family languages:\r\n\r\n cd ~\r\n mkdir ycm_build\r\n cd ycm_build\r\n cmake -G \"Unix Makefiles\" . ~/.vim/bundle/YouCompleteMe/cpp\r\n make ycm_core\r\n\r\nThat's it. You're done. Refer to the User Guide section on how to use YCM. Don't\r\nforget that if you want the C-family semantic completion engine to work, you\r\nwill need to provide the compilation flags for your project to YCM. It's all in\r\nthe User Guide.\r\n\r\nYCM comes with sane defaults for its options, but you still may want to take a\r\nlook at what's available for configuration. There are a few interesting options\r\nthat are conservatively turned off by default that you may want to turn on.\r\n\r\n\r\nFull Installation Guide\r\n-----------------------\r\n\r\nThese are the steps necessary to get YCM working on a Unix OS like Linux or\r\nMac OS X. My apologies to Windows users, but I don't have a guide for them. The\r\ncode is platform agnostic, so if everything is configured correctly, YCM\r\n_should_ work on Windows without issues (but as of writing, it's untested on\r\nthat platform).\r\n\r\nSee the FAQ if you have any issues.\r\n\r\n**Please follow the instructions carefully. Read EVERY WORD.**\r\n\r\n1. **Ensure that your version of Vim is _at least_ 7.3.584 _and_ that it has\r\n support for python2 scripting**.\r\n\r\n Inside Vim, type `:version`. Look at the first two to three lines of output;\r\n it should say `Vi IMproved 7.3` and then below that, `Included patches:\r\n 1-X`, where X will be some number. That number needs to be 584 or higher.\r\n\r\n If your version of Vim is not recent enough, you may need to [compile Vim\r\n from source][vim-build] (don't worry, it's easy).\r\n\r\n After you have made sure that you have Vim 7.3.584+, type the following in\r\n Vim: `:has('python')`. The output should be 1. If it's 0, then get a version\r\n of Vim with Python support.\r\n\r\n2. **Install YCM** with [Vundle][] (or [Pathogen][], but Vundle is a better\r\n idea). With Vundle, this would mean adding a `Bundle\r\n 'Valloric/YouCompleteMe'` line to your [vimrc][].\r\n\r\n3. [Complete this step ONLY if you care about semantic completion support for\r\n C-family languages. Otherwise it's not neccessary.]\r\n\r\n **Download the latest version of `libclang`**. Clang is an open-source\r\n compiler that can compile C/C++/Objective-C/Objective-C++. The `libclang`\r\n library it provides is used to power the YCM semantic completion engine for\r\n those languages. YCM needs libclang version 3.2 or higher.\r\n\r\n You can use the system libclang _only if you are sure it is version 3.2 or\r\n higher_, otherwise don't. Even if it is, I recommend using the [official\r\n binaries from llvm.org][clang-download] if at all possible. Make sure you\r\n download the correct archive file for your OS.\r\n\r\n4. **Compile the `ycm_core` plugin plugin** (ha!) that YCM needs. This is the\r\n C++ engine that YCM uses to get fast completions.\r\n\r\n You will need to have `cmake` installed in order to generate the required\r\n makefiles. Linux users can install cmake with their package manager (`sudo\r\n apt-get install cmake` for Ubuntu) whereas other users can [download and\r\n install][cmake-download] cmake from its project site. Mac users can also get\r\n it through [Homebrew][brew] with `brew install cmake`.\r\n\r\n Here we'll assume you installed YCM with Vundle. That means that the\r\n top-level YCM directory is in `~/.vim/bundle/YouCompleteMe`.\r\n\r\n We'll create a new folder where build files will be placed. Run the\r\n following:\r\n\r\n cd ~\r\n mkdir ycm_build\r\n cd ycm_build\r\n\r\n Now we need to generate the makefiles. If you DON'T care about semantic\r\n support for C-family languages, run the following command in the `ycm_build`\r\n directory: `cmake -G \"Unix Makefiles\" . ~/.vim/bundle/YouCompleteMe/cpp`\r\n\r\n If you DO care about semantic support for C-family languages, then your\r\n `cmake` call will be a bit more complicated. We'll assume you downloaded a\r\n binary distribution of LLVM+Clang from llvm.org in step 3 and that you\r\n extracted the archive file to folder `~/ycm_temp/llvm_root_dir` (with `bin`,\r\n `lib`, `include` etc. folders right inside that folder). With that in mind,\r\n run the following command in the `ycm_build` directory: `cmake -G \"Unix Makefiles\" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/cpp`\r\n\r\n Now that makefiles have been generated, simply run `make ycm_core`.\r\n\r\n For those who want to use the system version of libclang, you would pass\r\n `-DUSE_SYSTEM_LIBCLANG=ON` to cmake _instead of_ the\r\n `-DPATH_TO_LLVM_ROOT=...` flag.\r\n\r\n You could also force the use of a custom libclang library with\r\n `-DEXTERNAL_LIBCLANG_PATH=/path/to/libclang.so` flag (the library would end\r\n with `.dylib` on a Mac). Again, this flag would be used _instead of_ the\r\n other flags.\r\n\r\n5. [Complete this step ONLY if you care about semantic completion support for\r\n C-family languages. Otherwise it's not neccessary.]\r\n\r\n **Copy the libclang library file into the `YouCompleteMe/python` folder.**\r\n The library file is `libclang.so` on Linux and `libclang.dylib` on Mac.\r\n\r\n We'll assume you downloaded a binary distribution of LLVM+Clang from\r\n llvm.org in step 3 and that you extracted the archive file to folder\r\n `~/ycm_temp/llvm_root_dir` (with `bin`, `lib`, `include` etc. folders right\r\n inside that folder).\r\n\r\n We'll also assume you installed YCM with Vundle. That means that the\r\n top-level YCM directory is in `~/.vim/bundle/YouCompleteMe`.\r\n\r\n On Linux, run: `cp ~/ycm_temp/llvm_root_dir/lib/libclang.so ~/.vim/bundle/YouCompleteMe/python`\r\n\r\n On Mac, run: `cp ~/ycm_temp/llvm_root_dir/lib/libclang.dylib ~/.vim/bundle/YouCompleteMe/python`\r\n\r\n **DO NOT FORGET THIS STEP**. If you forget to copy over `libclang.so`\r\n version 3.2 into the `YouCompleteMe/python` folder then YCM _will not work_\r\n if you selected C-family support during YCM compilation.\r\n\r\nThat's it. You're done. Refer to the User Guide section on how to use YCM. Don't\r\nforget that if you want the C-family semantic completion engine to work, you\r\nwill need to provide the compilation flags for your project to YCM. It's all in\r\nthe User Guide.\r\n\r\nYCM comes with sane defaults for its options, but you still may want to take a\r\nlook at what's available for configuration. There are a few interesting options\r\nthat are conservatively turned off by default that you may want to turn on.\r\n\r\nUser Guide\r\n----------\r\n\r\n### General Usage\r\n\r\n- If the offered completions are too broad, keep typing characters; YCM will\r\n continue refining the offered completions based on your input.\r\n- Use the TAB key to accept a completion and continue pressing TAB to cycle\r\n through the completions. Use Shift-TAB to cycle backwards. Note that if you're\r\n using console Vim (that is, not Gvim or MacVim) then it's likely that the\r\n Shift-TAB binding will not work because the console will not pass it to Vim.\r\n You can remap the keys; see the options section below.\r\n\r\n### Completion string ranking\r\n\r\nThe subsequence filter removes any completions that do not match the input, but\r\nthen the sorting system kicks in. It's actually very complicated and uses lots\r\nof factors, but suffice it to say that \"word boundary\" (WB) subsequence\r\ncharacter matches are \"worth\" more than non-WB matches. In effect, this means\r\ngiven an input of \"gua\", the completion \"getUserAccount\" would be ranked higher\r\nin the list than the \"Fooguxa\" completion (both of which are subsequence\r\nmatches). A word-boundary character are all capital characters, characters\r\npreceded by an underscore and the first letter character in the completion\r\nstring.\r\n\r\n### Semantic Completion Engine Usage\r\n\r\n- You can use Ctrl+Space to trigger the completion suggestions anywhere, even\r\n without a string prefix. This is useful to see which top-level functions are\r\n available for use.\r\n- You _really_ also want to install the latest version of the [Syntastic][] Vim\r\n plugin. It has support for YCM and together they will provide you with compile\r\n errors/warnings practically instantly and without saving the file.\r\n\r\nYCM looks for a `.ycm_extra_conf.py` file in the directory of the opened file\r\nor in any directory above it in the hierarchy (recursively); when the file is\r\nfound, it is loaded (only once!) as a Python module. YCM calls a `FlagsForFile`\r\nmethod in that module which should provide it with the information necessary to\r\ncompile the current file. (You can also provide a path to a global\r\n`.ycm_extra_conf.py` file and override this searching behavior. See the Options\r\nsection for more details.)\r\n\r\nThis system was designed this way so that the user can perform any arbitrary\r\nsequence of operations to produce a list of compilation flags YCM should hand\r\nto Clang.\r\n\r\n[See YCM's own `.ycm_extra_conf.py`][flags_example] for details on how this\r\nworks. You should be able to use it as a starting point. Hint: just replace the\r\nstrings in the `flags` variable with compilation flags necessary for your\r\nproject. That should be enough for 99% of projects.\r\n\r\nYes, [Clang's `CompilationDatabase` system][compdb] is also supported. Again, see the\r\nabove linked example file.\r\n\r\nIf Clang encounters errors when compiling the header files that your file\r\nincludes, then it's probably going to take a long time to get completions. When\r\nthe completion menu finally appears, it's going to have a large number of\r\nunrelated completion strings (type/function names that are not actually\r\nmembers). This is because Clang fails to build a precompiled preamble for your\r\nfile if there are any errors in the included headers and that preamble is key to\r\ngetting fast completions.\r\n\r\nCall the `:YcmDiags` command to see if any errors or warnings were detected in\r\nyour file. Even better, use Syntastic.\r\n\r\n### Syntastic integration\r\n\r\nYCM has explicit support for [Syntastic][] (and vice-versa) if you compiled YCM\r\nwith Clang support; this means that any diagnostics (errors or warnings) that\r\nClang encounters while compiling your file will be fed back to Syntastic for\r\ndisplay.\r\n\r\nYCM will recompile your file in the background `updatetime` (see `:h updatetime`\r\nin Vim) milliseconds after you stop typing (to be specific, on `CursorHold` and\r\n`CursorHoldI` Vim events). YCM will change your `updatetime` value to be `2000`\r\nmilliseconds (there's an option to tell it not to do this if you wish).\r\n\r\nThe new diagnostics (if any) will be fed back to Syntastic the next time you\r\npress any key on the keyboard. So if you stop typing and just wait for the new\r\ndiagnostics to come in, that _will not work_. You need to press some key for the\r\nGUI to update.\r\n\r\nHaving to press a key to get the updates is unfortunate, but cannot be changed\r\ndue to the way Vim internals operate; there is no way that a background task can\r\nupdate Vim's GUI after it has finished running. You _have to_ press a key. This\r\nwill make YCM check for any pending diagnostics updates.\r\n\r\nYou _can_ force a full, blocking compilation cycle with the\r\n`:YcmForceCompileAndDiagnostics` command (you may want to map that command to a\r\nkey; try putting `nnoremap :YcmForceCompileAndDiagnostics` in your\r\nvimrc). Calling this command will force YCM to immediately recompile your file\r\nand display any new diagnostics it encounters. Do note that recompilation with\r\nthis command may take a while and during this time the Vim GUI _will_ be\r\nblocked.\r\n\r\nAfter the errors are displayed by Syntastic, it will display a short diagnostic\r\nmessage when you move your cursor to the line with the error. You can get a\r\ndetailed diagnostic message with the `d` key mapping (can be changed in\r\nthe options) YCM provides when your cursor is on the line with the diagnostic.\r\n\r\nYou can also see the full diagnostic message for all the diagnostics in the\r\ncurrent file in Vim's `locationlist`, which can be opened with the `:lopen` and\r\n`:lclose` commands. A good way to toggle the display of the `locationlist` with\r\na single key mapping is provided by another (very small) Vim plugin called\r\n[ListToggle][] (which also makes it possible to change the height of the\r\n`locationlist` window), also written by yours truly.\r\n\r\nTODO: extending the semantic engine for other langs\r\n\r\nCommands\r\n--------\r\n\r\n### The `YcmForceCompileAndDiagnostics` command\r\n\r\nCalling this command will force YCM to immediately recompile your file\r\nand display any new diagnostics it encounters. Do note that recompilation with\r\nthis command may take a while and during this time the Vim GUI _will_ be\r\nblocked.\r\n\r\nYou may want to map this command to a key; try putting `nnoremap \r\n:YcmForceCompileAndDiagnostics` in your vimrc.\r\n\r\n### The `YcmDiags` command\r\n\r\nCalling this command will fill Vim's `locationlist` with errors or warnings if\r\nany were detected in your file and then open it.\r\n\r\nA better option would be to use Syntastic which will keep your `locationlist`\r\nup to date automatically and will also show error/warning notifications in Vim's\r\ngutter.\r\n\r\n### The `YcmDebugInfo` command\r\n\r\nThis will print out various debug information for the current file. Useful to\r\nsee what compile commands will be used for the file if you're using the semantic\r\ncompletion engine.\r\n\r\nOptions\r\n-------\r\n\r\nAll options have reasonable defaults so if the plug-in works after installation\r\nyou don't need to change any options. These options can be configured in your\r\n[vimrc script][vimrc] by including a line like this:\r\n\r\n let g:ycm_min_num_of_chars_for_completion = 1\r\n\r\nNote that after changing an option in your [vimrc script] [vimrc] you have to\r\nrestart Vim for the changes to take effect.\r\n\r\n### The `g:ycm_min_num_of_chars_for_completion` option\r\n\r\nThis option controls the number of characters the user needs to type before\r\ncompletion suggestions are triggered. For example, if the option is set to `2`,\r\nthen when the user types a second alphanumeric character after a whitespace\r\ncharacter, completion suggestions will be triggered.\r\n\r\nDefault: `2`\r\n\r\n let g:ycm_min_num_of_chars_for_completion = 2\r\n\r\n### The `g:ycm_filetypes_to_completely_ignore` option\r\n\r\nThis option controls for which Vim filetypes (see `:h filetype`) should YCM be\r\nturned off. The option value should be a Vim dictionary with keys being filetype\r\nstrings (like `python`, `cpp` etc) and values being unimportant (the dictionary\r\nis used like a hash set, meaning that only the keys matter). The listed\r\nfiletypes will be completely ignored by YCM, meaning that neither the\r\nidentifier-based completion engine nor the semantic engine will operate in files\r\nof those filetypes.\r\n\r\nYou can get the filetype of the current file in Vim with `:set ft?`.\r\n\r\nDefault: `{notes: 1, markdown: 1, text: 1}`\r\n\r\n let g:ycm_filetypes_to_completely_ignore = {\r\n \\ 'notes' : 1,\r\n \\ 'markdown' : 1,\r\n \\ 'text' : 1,\r\n \\}\r\n\r\n### The `g:ycm_filetype_specific_completion_to_disable` option\r\n\r\nThis option controls for which Vim filetypes (see `:h filetype`) should the YCM\r\nsemantic completion engine be turned off. The option value should be a Vim\r\ndictionary with keys being filetype strings (like `python`, `cpp` etc) and\r\nvalues being unimportant (the dictionary is used like a hash set, meaning that\r\nonly the keys matter). The listed filetypes will be ignored by the YCM semantic\r\ncompletion engine, but the identifier-based completion engine will still trigger\r\nin files of those filetypes.\r\n\r\nNote that even if semantic completion is not turned off for a specific filetype,\r\nyou will not get semantic completion if the semantic engine does not support\r\nthat filetype. Currently, the semantic engine only supports the `c`, `cpp`,\r\n`objc` and `objcpp` filetypes.\r\n\r\nYou can get the filetype of the current file in Vim with `:set ft?`.\r\n\r\nDefault: `{}`\r\n\r\n let g:ycm_filetype_specific_completion_to_disable = {}\r\n\r\n### The `g:ycm_allow_changing_updatetime` option\r\n\r\nWhen this option is set to `1`, YCM will change the `updatetime` Vim option to\r\n`2000` (see `:h updatetime`). This may conflict with some other plugins you have\r\n(but it's unlikely). The `updatetime` option is the number of milliseconds that\r\nhave to pass before Vim's `CursorHold` (see `:h CursorHold`) event fires. YCM\r\nruns the completion engines' \"file comprehension\" systems in the background on\r\nevery such event; the identifier-based engine collects the identifiers whereas\r\nthe semantic engine compiles the file to build an AST.\r\n\r\nThe Vim default of `4000` for `updatetime` is a bit long, so YCM reduces\r\nthis. Set this option to `0` to force YCM to leave your `updatetime` setting\r\nalone.\r\n\r\nDefault: `1`\r\n\r\n let g:ycm_allow_changing_updatetime = 1\r\n\r\n### The `g:ycm_add_preview_to_completeopt` option\r\n\r\nWhen this option is set to `1`, YCM will add the `preview` string to Vim's\r\n`completeopt` option (see `:h completeopt`). If your `completeopt` option\r\nalready has `preview` set, there will be no effect. You can see the current\r\nstate of your `completeopt` setting with `:set completeopt?` (yes, the question\r\nmark is important).\r\n\r\nWhen `preview` is present in `completeopt`, YCM will use the `preview` window at\r\nthe top of the file to store detailed information about the current completion\r\ncandidate (but only if the candidate came from the semantic engine). For\r\ninstance, it would show the full function prototype and all the function\r\noverloads in the window if the current completion is a function name.\r\n\r\nDefault: `0`\r\n\r\n let g:ycm_add_preview_to_completeopt = 0\r\n\r\n### The `g:ycm_autoclose_preview_window_after_completion` option\r\n\r\nWhen this option is set to `1`, YCM will auto-close the `preview` window after\r\nthe user accepts the offered completion string. If there is no `preview` window\r\ntriggered because there is no `preview` string in `completeopt`, this option is\r\nirrelevant. See the `g:ycm_add_preview_to_completeopt` option for more details.\r\n\r\nDefault: `0`\r\n\r\n let g:ycm_autoclose_preview_window_after_completion = 0\r\n\r\n### The `g:ycm_max_diagnostics_to_display` option\r\n\r\nThis option controls the maximum number of diagnostics shown to the user when\r\nerrors or warnings are detected in the file. This option is only relevant if you\r\nare using the semantic completion engine and have installed the version of the\r\nSyntastic plugin that supports YCM.\r\n\r\nDefault: `30`\r\n\r\n let g:ycm_max_diagnostics_to_display = 30\r\n\r\n### The `g:ycm_key_select_completion` option\r\n\r\nThis option controls the key mapping used to select the first completion string.\r\nInvoking it repeatedly cycles forward through the completion list.\r\n\r\nDefault: ``\r\n\r\n let g:ycm_key_select_completion = ''\r\n\r\n### The `g:ycm_key_previous_completion` option\r\n\r\nThis option controls the key mapping used to select the previous completion\r\nstring. Invoking it repeatedly cycles backwards through the completion list.\r\n\r\nNote that the default of `` means Shift-TAB. Also note that the default\r\nmapping will probably only work in GUI Vim (Gvim or MacVim) and not in plain\r\nconsole Vim because the terminal usually does not forward modifier key\r\ncombinations to Vim.\r\n\r\nDefault: ``\r\n\r\n let g:ycm_key_previous_completion = ''\r\n\r\n### The `g:ycm_key_invoke_completion` option\r\n\r\nThis option controls the key mapping used to invoke the completion menu for\r\nsemantic completion. By default, semantic completion is trigged automatically\r\nafter typing `.`, `->` and `::` in insert mode (if semantic completion support\r\nhas been compiled in). This key mapping can be used to trigger semantic\r\ncompletion anywhere. Useful for searching for top-level functions and classes.\r\n\r\nNote that the default of `` means Ctrl-Space. Also note that the\r\ndefault mapping will probably only work in GUI Vim (Gvim or MacVim) and not in\r\nplain console Vim because the terminal usually does not forward modifier key\r\ncombinations to Vim.\r\n\r\nDefault: ``\r\n\r\n let g:ycm_key_invoke_completion = ''\r\n\r\n### The `g:ycm_key_detailed_diagnostics` option\r\n\r\nThis option controls the key mapping used to show the full diagnostic text when\r\nthe user's cursor is on the line with the diagnostic.\r\n\r\nDefault: `d`\r\n\r\n let g:ycm_key_detailed_diagnostics = 'd'\r\n\r\n### The `g:ycm_global_ycm_extra_conf` option\r\n\r\nNormally, YCM searches for a `.ycm_extra_conf.py` file for compilation flags\r\n(see the User Guide for more details on how this works). You can use this option\r\nto override this searching behavior by providing a full, absolute path to a\r\nglobal `.ycm_extra_conf.py` file (although you can call the global file whatever\r\nyou want).\r\n\r\nYou can place such a global file anywhere in your filesystem.\r\n\r\nDefault: ``\r\n\r\n let g:ycm_global_ycm_extra_conf = ''\r\n\r\n\r\nFAQ\r\n---\r\n\r\n### I get a linker warning regarding `libpython` on Mac when compiling YCM\r\n\r\nIf the warning is `ld: warning: path '/usr/lib/libpython2.7.dylib' following -L\r\nnot a directory`, then feel free to ignore it; it's caused by a limitation of\r\nCMake and is not an issue. Everything should still work fine.\r\n\r\n### I get a weird window at the top of my file when I use the semantic engine\r\n\r\nThis is Vim's `preview` window. Vim uses it to show you extra information about\r\nsomething if such information is available. YCM provides Vim with such extra\r\ninformation. For instance, when you select a function in the completion list,\r\nthe `preview` window will hold that function's prototype and the prototypes of\r\nany overloads of the function. It will stay there after you select the\r\ncompletion so that you can use the information about the parameters and their\r\ntypes to write the function call.\r\n\r\nIf you would like this window to auto-close after you select a completion\r\nstring, set the `g:ycm_autoclose_preview_window_after_completion` option to `1`\r\nin your `vimrc` file.\r\n\r\nIf you don't want this window to ever show up, add `set completeopt-=preview` to\r\nyour `vimrc`. Also make sure that the `g:ycm_add_preview_to_completeopt` option\r\nis set to `0`.\r\n\r\n### It appears that YCM is not working\r\n\r\nIn Vim, run `:messages` and carefully read the output. YCM will echo messages to\r\nthe message log if it encounters problems. It's likely you misconfigured\r\nsomething and YCM is complaining about it.\r\n\r\nAlso, you may want to run the `:YcmDebugInfo` command; it will make YCM spew out\r\nvarious debugging information, including the compile flags for the file if the\r\nfile is a C-family language file and you have compiled in Clang support.\r\n\r\n### I cannot get the Syntastic integration to work\r\n\r\nTry to update your version of Syntastic. At the time of writing (Jan 2013), the\r\nYCM integration is very recent and it's likely that your version of Syntastic\r\ndoes not have it.\r\n\r\n### Sometimes it takes much longer to get semantic completions than normal\r\n\r\nThis means that libclang (which YCM uses for C-family semantic completion)\r\nfailed to compile your file's preamble. In other words, there was an error\r\ncompiling some of the source code you pulled in through your header files. I\r\nsuggest calling the `:YcmDiags` command to see what they were (even better, have\r\nSyntastic installed and call `:lopen`).\r\n\r\n### YCM auto-inserts completion strings I don't want!\r\n\r\nThis means you probably have some mappings that interfere with YCM's internal\r\nones. Make sure you don't have something mapped to ``, `` or ``\r\n(in insert mode).\r\n\r\nYCM _never_ selects something for you; it just shows you a menu and the user has\r\nto explicitly select something. If something is being selected automatically,\r\nthis means there's a bug or a misconfiguration somewhere.\r\n\r\n### I get a `E227: mapping already exists for ` error when I start Vim\r\n\r\nThis means that YCM tried to set up a key mapping but failed because you already\r\nhad something mapped to that key combination. The `` part of the message\r\nwill tell you what was the key combination that failed.\r\n\r\nLook in the options section and see if which of the default mappings conflict\r\nwith your own. Then change that option value to something else so that the\r\nconflict goes away.\r\n\r\n### I'm trying to use a Homebrew Vim with YCM and I'm getting segfaults\r\n\r\nSomething (I don't know what) is wrong with the way that Homebrew configures and\r\nbuilds Vim. I recommend using [MacVim][]. Even if you don't like the MacVim GUI,\r\nyou can use the Vim binary that is inside the MacVim.app package (it's\r\n`MacVim.app/Contents/MacOS/Vim`) and get the Vim console experience.\r\n\r\n### Why isn't YCM just written in plain VimScript, FFS?\r\n\r\nBecause of the identifier completion engine and subsequence-based filtering.\r\nLet's say you have _many_ dozens of files open in a single Vim instance (I often\r\ndo); the identifier-based engine then needs to store thousands (if not tens of\r\nthousands) of identifiers in its internal data-structures. When the user types,\r\nYCM needs to perform subsequence-based filtering on _all_ of those identifiers\r\n(every single one!) in less than 10 milliseconds.\r\n\r\nI'm sorry, but that level of performance is just plain impossible to achieve\r\nwith VimScript. I've tried, and the language is just too slow. No, you can't get\r\nacceptable performance even if you limit yourself to just the identifiers in the\r\ncurrent file and simple prefix-based fitering.\r\n\r\n### Why does YCM demand such a recent version of Vim?\r\n\r\nDuring YCM's development several show-stopper bugs where encountered in Vim.\r\nThose needed to be fixed upstream (and were). A few months after those bugs were\r\nfixed, Vim trunk landed the `pyeval()` function which improved YCM performance\r\neven more since less time was spent serializing and deserializing data between\r\nVim and the embedded Python interpreter. A few critical bugfixes for `pyeval()`\r\nlanded in Vim 7.3.584 (and a few commits before that).\r\n\r\nContact\r\n-------\r\n\r\nIf you have questions, bug reports, suggestions, etc. please use the [issue\r\ntracker][tracker]. The latest version is available at\r\n.\r\n\r\nThe author's homepage is .\r\n\r\nLicense\r\n-------\r\n\r\nThis software is licensed under the [GPL v3 license][gpl].\r\n© 2012 Strahinja Val Markovic <>.\r\n\r\n\r\n[Clang]: http://clang.llvm.org/\r\n[vundle]: https://github.com/gmarik/vundle#about\r\n[pathogen]: https://github.com/tpope/vim-pathogen#pathogenvim\r\n[clang-download]: http://llvm.org/releases/download.html#3.2\r\n[brew]: http://mxcl.github.com/homebrew/\r\n[cmake-download]: http://www.cmake.org/cmake/resources/software.html\r\n[macvim]: http://code.google.com/p/macvim/#Download\r\n[vimrc]: http://vimhelp.appspot.com/starting.txt.html#vimrc\r\n[gpl]: http://www.gnu.org/copyleft/gpl.html\r\n[vim]: http://www.vim.org/\r\n[syntastic]: https://github.com/scrooloose/syntastic\r\n[flags_example]: https://github.com/Valloric/YouCompleteMe/blob/master/cpp/ycm/.ycm_extra_conf.py\r\n[compdb]: http://clang.llvm.org/docs/JSONCompilationDatabase.html\r\n[subsequence]: http://en.wikipedia.org/wiki/Subsequence\r\n[listtoggle]: https://github.com/Valloric/ListToggle\r\n[vim-build]: https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source\r\n[tracker]: https://github.com/Valloric/YouCompleteMe/issues?state=open\r\n","note":"Don't delete this file! It's used internally to help with page regeneration.","google":"UA-34688172-3"}