forked from ycm-core/YouCompleteMe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoucompleteme.txt
3266 lines (2618 loc) · 144 KB
/
youcompleteme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
*youcompleteme* YouCompleteMe: a code-completion engine for Vim
===============================================================================
Contents ~
1. Introduction |youcompleteme-introduction|
2. Intro |youcompleteme-intro|
3. Installation |youcompleteme-installation|
1. Mac OS X |youcompleteme-mac-os-x|
2. Ubuntu Linux x64 |youcompleteme-ubuntu-linux-x64|
3. Fedora Linux x64 |youcompleteme-fedora-linux-x64|
4. Windows |youcompleteme-windows|
5. FreeBSD/OpenBSD |youcompleteme-freebsd-openbsd|
6. Full Installation Guide |youcompleteme-full-installation-guide|
4. Quick Feature Summary |youcompleteme-quick-feature-summary|
1. General (all languages) |youcompleteme-general|
2. C-family languages (C, C++, Objective C, Objective C++) |youcompleteme-c-family-languages|
3. C♯ |youcompleteme-c|
4. Python |youcompleteme-python|
5. Go |youcompleteme-go|
6. TypeScript |youcompleteme-typescript|
7. JavaScript |youcompleteme-javascript|
8. Rust |youcompleteme-rust|
5. User Guide |youcompleteme-user-guide|
1. General Usage |youcompleteme-general-usage|
2. Client-Server Architecture |youcompleteme-client-server-architecture|
3. Completion String Ranking |youcompleteme-completion-string-ranking|
4. General Semantic Completion |youcompleteme-general-semantic-completion|
5. C-family Semantic Completion |youcompleteme-c-family-semantic-completion|
6. JavaScript Semantic Completion |youcompleteme-javascript-semantic-completion|
1. Quick start |youcompleteme-quick-start|
2. Explanation |youcompleteme-explanation|
3. Tips and tricks |youcompleteme-tips-tricks|
1. Configuring Tern for node support |youcompleteme-configuring-tern-for-node-support|
2. Configuring Tern for requirejs support |youcompleteme-configuring-tern-for-requirejs-support|
7. Rust Semantic Completion |youcompleteme-rust-semantic-completion|
8. Python Semantic Completion |youcompleteme-python-semantic-completion|
9. Semantic Completion for Other Languages |youcompleteme-semantic-completion-for-other-languages|
10. Writing New Semantic Completers |youcompleteme-writing-new-semantic-completers|
11. Diagnostic Display |youcompleteme-diagnostic-display|
1. Diagnostic Highlighting Groups |youcompleteme-diagnostic-highlighting-groups|
6. Commands |youcompleteme-commands|
1. The |:YcmRestartServer| command
2. The |:YcmForceCompileAndDiagnostics| command
3. The |:YcmDiags| command
4. The |:YcmShowDetailedDiagnostic| command
5. The |:YcmDebugInfo| command
6. The |:YcmToggleLogs| command
7. The |:YcmCompleter| command
7. YcmCompleter Subcommands |youcompleteme-ycmcompleter-subcommands|
1. GoTo Commands |youcompleteme-goto-commands|
1. The |GoToInclude| subcommand
2. The |GoToDeclaration| subcommand
3. The |GoToDefinition| subcommand
4. The |GoTo| subcommand
5. The |GoToImprecise| subcommand
6. The |GoToReferences| subcommand
7. The |GoToImplementation| subcommand
8. The |GoToImplementationElseDeclaration| subcommand
2. Semantic Information Commands |youcompleteme-semantic-information-commands|
1. The |GetType| subcommand
2. The |GetTypeImprecise| subcommand
3. The |GetParent| subcommand
4. The |GetDoc| subcommand
5. The |GetDocImprecise| subcommand
3. Refactoring and FixIt Commands |youcompleteme-refactoring-fixit-commands|
1. The |FixIt| subcommand
2. The 'RefactorRename <new name>' subcommand |RefactorRename-new-name|
3. Multi-file Refactor |youcompleteme-multi-file-refactor|
4. Miscellaneous Commands |youcompleteme-miscellaneous-commands|
1. The |RestartServer| subcommand
2. The |ClearCompilationFlagCache| subcommand
3. The |ReloadSolution| subcommand
8. Functions |youcompleteme-functions|
1. The |youcompleteme#GetErrorCount| function
2. The |youcompleteme#GetWarningCount| function
9. Autocommands |youcompleteme-autocommands|
1. The |YcmQuickFixOpened| autocommand
10. Options |youcompleteme-options|
1. The |g:ycm_min_num_of_chars_for_completion| option
2. The |g:ycm_min_num_identifier_candidate_chars| option
3. The |g:ycm_auto_trigger| option
4. The |g:ycm_filetype_whitelist| option
5. The |g:ycm_filetype_blacklist| option
6. The |g:ycm_filetype_specific_completion_to_disable| option
7. The |g:ycm_show_diagnostics_ui| option
8. The |g:ycm_error_symbol| option
9. The |g:ycm_warning_symbol| option
10. The |g:ycm_enable_diagnostic_signs| option
11. The |g:ycm_enable_diagnostic_highlighting| option
12. The |g:ycm_echo_current_diagnostic| option
13. The |g:ycm_filter_diagnostics| option
14. The |g:ycm_always_populate_location_list| option
15. The |g:ycm_open_loclist_on_ycm_diags| option
16. The |g:ycm_allow_changing_updatetime| option
17. The |g:ycm_complete_in_comments| option
18. The |g:ycm_complete_in_strings| option
19. The |g:ycm_collect_identifiers_from_comments_and_strings| option
20. The |g:ycm_collect_identifiers_from_tags_files| option
21. The |g:ycm_seed_identifiers_with_syntax| option
22. The |g:ycm_extra_conf_vim_data| option
23. The |g:ycm_server_python_interpreter| option
24. The |g:ycm_keep_logfiles| option
25. The |g:ycm_log_level| option
26. The |g:ycm_auto_start_csharp_server| option
27. The |g:ycm_auto_stop_csharp_server| option
28. The |g:ycm_csharp_server_port| option
29. The |g:ycm_csharp_insert_namespace_expr| option
30. The |g:ycm_add_preview_to_completeopt| option
31. The |g:ycm_autoclose_preview_window_after_completion| option
32. The |g:ycm_autoclose_preview_window_after_insertion| option
33. The |g:ycm_max_diagnostics_to_display| option
34. The |g:ycm_key_list_select_completion| option
35. The |g:ycm_key_list_previous_completion| option
36. The |g:ycm_key_invoke_completion| option
37. The |g:ycm_key_detailed_diagnostics| option
38. The |g:ycm_global_ycm_extra_conf| option
39. The |g:ycm_confirm_extra_conf| option
40. The |g:ycm_extra_conf_globlist| option
41. The |g:ycm_filepath_completion_use_working_dir| option
42. The |g:ycm_semantic_triggers| option
43. The |g:ycm_cache_omnifunc| option
44. The |g:ycm_use_ultisnips_completer| option
45. The |g:ycm_goto_buffer_command| option
46. The |g:ycm_disable_for_files_larger_than_kb| option
47. The |g:ycm_python_binary_path| option
11. FAQ |youcompleteme-faq|
1. I used to be able to 'import vim' in '.ycm_extra_conf.py', but now can't |import-vim|
2. On very rare occasions Vim crashes when I tab through the completion menu |youcompleteme-on-very-rare-occasions-vim-crashes-when-i-tab-through-completion-menu|
3. I get |ImportError| exceptions that mention 'PyInit_ycm_core' or 'initycm_core'
4. I get a linker warning regarding |libpython| on Mac when compiling YCM
5. I get a weird window at the top of my file when I use the semantic engine |youcompleteme-i-get-weird-window-at-top-of-my-file-when-i-use-semantic-engine|
6. It appears that YCM is not working |youcompleteme-it-appears-that-ycm-is-not-working|
7. Sometimes it takes much longer to get semantic completions than normal |youcompleteme-sometimes-it-takes-much-longer-to-get-semantic-completions-than-normal|
8. YCM auto-inserts completion strings I don't want! |youcompleteme-ycm-auto-inserts-completion-strings-i-dont-want|
9. I get a 'E227: mapping already exists for <blah>' error when I start Vim |E227:-mapping-already-exists-for-blah|
10. I get "'GLIBC_2.XX' not found (required by libclang.so)" when starting Vim |GLIBC_2.XX-not-found()|
11. I'm trying to use a Homebrew Vim with YCM and I'm getting segfaults |youcompleteme-im-trying-to-use-homebrew-vim-with-ycm-im-getting-segfaults|
12. I have a Homebrew Python and/or MacVim; can't compile/SIGABRT when starting |youcompleteme-i-have-homebrew-python-and-or-macvim-cant-compile-sigabrt-when-starting|
13. I get 'LONG_BIT definition appears wrong for platform' when compiling |LONG_BIT-definition-appears-wrong-for-platform|
14. I get 'libpython2.7.a [...] relocation R_X86_64_32' when compiling |libpython2.7.a-...-relocation-R_X86_64_32|
15. I get 'Vim: Caught deadly signal SEGV' on Vim startup |Vim:-Caught-deadly-signal-SEGV|
16. I get 'Fatal Python error: PyThreadState_Get: no current thread' on startup |Fatal-Python-error:-PyThreadState_Get:-no-current-thread|
17. |install.py| says python must be compiled with '--enable-framework'. Wat?
18. YCM does not read identifiers from my tags files |youcompleteme-ycm-does-not-read-identifiers-from-my-tags-files|
19. 'CTRL-U' in insert mode does not work |CTRL-sub-U|
20. YCM conflicts with UltiSnips TAB key usage |youcompleteme-ycm-conflicts-with-ultisnips-tab-key-usage|
21. Snippets added with |:UltiSnipsAddFiletypes| do not appear in the popup menu
22. Why isn't YCM just written in plain VimScript, FFS? |youcompleteme-why-isnt-ycm-just-written-in-plain-vimscript-ffs|
23. Why does YCM demand such a recent version of Vim? |youcompleteme-why-does-ycm-demand-such-recent-version-of-vim|
24. I get annoying messages in Vim's status area when I type |youcompleteme-i-get-annoying-messages-in-vims-status-area-when-i-type|
25. Nasty bugs happen if I have the 'vim-autoclose' plugin installed |vim-sub-autoclose|
26. Is there some sort of YCM mailing list? I have questions |youcompleteme-is-there-sort-of-ycm-mailing-list-i-have-questions|
27. I get an internal compiler error when installing |youcompleteme-i-get-an-internal-compiler-error-when-installing|
28. I get weird errors when I press 'Ctrl-C' in Vim |Ctrl-sub-C|
29. Why did YCM stop using Syntastic for diagnostics display? |youcompleteme-why-did-ycm-stop-using-syntastic-for-diagnostics-display|
30. Completion doesn't work with the C++ standard library headers |youcompleteme-completion-doesnt-work-with-c-standard-library-headers|
31. When I open a JavaScript file, I get an annoying warning about '.tern-project'
file |.tern-sub-project|
32. When I start vim I get a runtime error saying 'R6034 An application has made an
attempt to load the C runtime library incorrectly.' |R6034-An-application-has-made-an-attempt-to-load-the-C-runtime-library-incorrectly.|
33. I hear that YCM only supports Python 2, is that true? |youcompleteme-i-hear-that-ycm-only-supports-python-2-is-that-true|
34. On Windows I get "E887: Sorry, this command is disabled, the Python's site
module could not be loaded" |E887:-Sorry-this-command-is-disabled-the-Python-s-site-module-could-not-be-loaded|
35. I can't complete python packages in a virtual environment. |youcompleteme-i-cant-complete-python-packages-in-virtual-environment.|
12. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct|
13. Contact |youcompleteme-contact|
14. License |youcompleteme-license|
15. References |youcompleteme-references|
===============================================================================
*youcompleteme-introduction*
Introduction ~
Image: Gitter Room [1] Image: Build Status [3] Image: Build status [5] Image:
Coverage Status [7]
- Intro
- Installation
- Mac OS X
- Ubuntu Linux x64
- Fedora Linux x64
- Windows
- FreeBSD/OpenBSD
- Full Installation Guide
- Quick Feature Summary
- User Guide
- General Usage
- Client-Server Architecture
- Completion String Ranking
- General Semantic Completion
- C-family Semantic Completion
- JavaScript Semantic Completion
- Rust Semantic Completion
- Python Semantic Completion
- Semantic Completion for Other Languages
- Writing New Semantic Completers
- Diagnostic Display
- Diagnostic Highlighting Groups
- Commands
- YcmCompleter subcommands
- GoTo Commands
- Semantic Information Commands
- Refactoring and FixIt Commands
- Miscellaneous Commands
- Functions
- Autocommands
- Options
- FAQ
- Contributor Code of Conduct
- Contact
- License
===============================================================================
*youcompleteme-intro*
Intro ~
YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for
Vim. It has several completion engines:
- an identifier-based engine that works with every programming language,
- a Clang [9]-based engine that provides native semantic code completion for
C/C++/Objective-C/Objective-C++ (from now on referred to as "the C-family
languages"),
- a Jedi [10]-based completion engine for Python 2 and 3 (using the JediHTTP
[11] wrapper),
- an OmniSharp [12]-based completion engine for C#,
- a combination of Gocode [13] and Godef [14] semantic engines for Go,
- a TSServer [15]-based completion engine for TypeScript,
- a Tern [16]-based completion engine for JavaScript,
- a racer [17]-based completion engine for Rust,
- and an omnifunc-based completer that uses data from Vim's omnicomplete
system to provide semantic completions for many other languages (Ruby, PHP
etc.).
Image: YouCompleteMe GIF demo (see reference [18])
Here's an explanation of what happens in the short GIF demo above.
First, realize that **no keyboard shortcuts had to be pressed** 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.
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.
If the offered completions are not relevant enough, the user can continue
typing to further filter out unwanted completions.
A critical thing to notice is that the completion **filtering is NOT based on
the input being a string prefix of the completion** (but that works too). The
input needs to be a _subsequence [19] match_ 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 'abc' is a
subsequence of 'xaybgc', but not of 'xbyxaxxc'. 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).
**All of the above works with any programming language** 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).
The demo also shows the semantic engine in use. When the user presses '.', '->'
or '::' 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).
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
Syntastic [20]) if you are editing a C-family file. As Clang 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.
In essence, YCM obsoletes the following Vim plugins because it has all of their
features plus extra:
- clang_complete
- AutoComplPop
- Supertab
- neocomplcache
**And that's not all...**
YCM also provides semantic IDE-like features in a number of languages,
including:
- finding declarations, definitions, usages, etc. of identifiers,
- displaying type information for classes, variables, functions etc.,
- displaying documentation for methods, members, etc. in the preview window,
- fixing common coding errors, like missing semi-colons, typos, etc.,
- semantic renaming of variables across files (JavaScript only).
Features vary by file type, so make sure to check out the file type feature
summary and the full list of completer subcommands to find out what's available
for your favourite languages.
You'll also find that YCM has filepath completers (try typing './' in a file)
and a completer that integrates with UltiSnips [21].
===============================================================================
*youcompleteme-installation*
Installation ~
-------------------------------------------------------------------------------
*youcompleteme-mac-os-x*
Mac OS X ~
Please refer to the full Installation Guide below; the following commands are
provided on a best-effort basis and may not work for you.
Install the latest version of MacVim [22]. Yes, MacVim. And yes, the _latest_.
If you don't use the MacVim GUI, it is recommended to use the Vim binary that
is inside the MacVim.app package ('MacVim.app/Contents/MacOS/Vim'). To ensure
it works correctly copy the 'mvim' script from the MacVim [22] download to your
local binary folder (for example '/usr/local/bin/mvim') and then symlink it:
>
ln -s /usr/local/bin/mvim vim
<
Install YouCompleteMe with Vundle [23].
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
will notify you to recompile it. You should then rerun the install process.
**NOTE:** 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 'clang' for the first time, or manually by running
'xcode-select --install')
Install CMake. Preferably with Homebrew [24], but here's the stand-alone CMake
installer [25].
_If_ you have installed a Homebrew Python and/or Homebrew MacVim, see the _FAQ_
for details.
Compiling YCM **with** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
<
Compiling YCM **without** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py
<
The following additional language support options are available:
- C# support: install Mono with Homebrew [24] or by downloading the Mono Mac
package [26] and add '--omnisharp-completer' when calling './install.py'.
- Go support: install Go [27] and add '--gocode-completer' when calling
'./install.py'.
- TypeScript support: install Node.js and npm [28] then install the
TypeScript SDK with 'npm install -g typescript'.
- JavaScript support: install Node.js and npm [28] and add '--tern-completer'
when calling './install.py'.
- Rust support: install Rust [29] and add '--racer-completer' when calling
'./install.py'.
To simply compile with everything enabled, there's a '--all' flag. So, to
install with all language features, ensure 'xbuild', 'go', 'tsserver', 'node',
'npm', 'rustc', and 'cargo' tools are installed and in your 'PATH', then simply
run:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --all
<
That's it. You're done. Refer to the _User Guide_ 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.
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.
-------------------------------------------------------------------------------
*youcompleteme-ubuntu-linux-x64*
Ubuntu Linux x64 ~
Please refer to the full Installation Guide below; the following commands are
provided on a best-effort basis and may not work for you.
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support. Ubuntu 14.10
and later have a Vim that's recent enough. You can see the version of Vim
installed by running 'vim --version'. If the version is too old, you may need
to compile Vim from source [30] (don't worry, it's easy).
Install YouCompleteMe with Vundle [23].
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
will notify you to recompile it. You should then rerun the install process.
Install development tools and CMake: 'sudo apt-get install build-essential
cmake'
Make sure you have Python headers installed: 'sudo apt-get install python-dev
python3-dev'.
Compiling YCM **with** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
<
Compiling YCM **without** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py
<
The following additional language support options are available:
- C# support: install Mono [31] and add '--omnisharp-completer' when calling
'./install.py'.
- Go support: install Go [27] and add '--gocode-completer' when calling
'./install.py'.
- TypeScript support: install Node.js and npm [28] then install the
TypeScript SDK with 'npm install -g typescript'.
- JavaScript support: install Node.js and npm [28] and add '--tern-completer'
when calling './install.py'.
- Rust support: install Rust [29] and add '--racer-completer' when calling
'./install.py'.
To simply compile with everything enabled, there's a '--all' flag. So, to
install with all language features, ensure 'xbuild', 'go', 'tsserver', 'node',
'npm', 'rustc', and 'cargo' tools are installed and in your 'PATH', then simply
run:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --all
<
That's it. You're done. Refer to the _User Guide_ 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.
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.
-------------------------------------------------------------------------------
*youcompleteme-fedora-linux-x64*
Fedora Linux x64 ~
Please refer to the full Installation Guide below; the following commands are
provided on a best-effort basis and may not work for you.
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support. Fedora 21 and
later have a Vim that's recent enough. You can see the version of Vim installed
by running 'vim --version'. If the version is too old, you may need to compile
Vim from source [30] (don't worry, it's easy).
Install YouCompleteMe with Vundle [23].
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
will notify you to recompile it. You should then rerun the install process.
Install development tools and CMake: 'sudo dnf install automake gcc gcc-c++
kernel-devel cmake'
Make sure you have Python headers installed: 'sudo dnf install python-devel
python3-devel'.
Compiling YCM **with** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
<
Compiling YCM **without** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py
<
The following additional language support options are available:
- C# support: install Mono [32] and add '--omnisharp-completer' when calling
'./install.py'.
- Go support: install Go [27] and add '--gocode-completer' when calling
'./install.py'.
- TypeScript support: install Node.js and npm [28] then install the
TypeScript SDK with 'npm install -g typescript'.
- JavaScript support: install Node.js and npm [28] and add '--tern-completer'
when calling './install.py'.
- Rust support: install Rust [29] and add '--racer-completer' when calling
'./install.py'.
To simply compile with everything enabled, there's a '--all' flag. So, to
install with all language features, ensure 'xbuild', 'go', 'tsserver', 'node',
'npm', 'rustc', and 'cargo' tools are installed and in your 'PATH', then simply
run:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --all
<
That's it. You're done. Refer to the _User Guide_ 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.
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.
-------------------------------------------------------------------------------
*youcompleteme-windows*
Windows ~
Please refer to the full Installation Guide below; the following commands are
provided on a best-effort basis and may not work for you.
**Important:** we assume that you are using the 'cmd.exe' command prompt and
that you know how to add an executable to the PATH environment variable.
Make sure you have at least Vim 7.4.143 with Python 2 or Python 3 support. You
can check the version and which Python is supported by typing ':version' inside
Vim. Look at the features included: '+python/dyn' for Python 2 and
'+python3/dyn' 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. Daily updated copies of 32-bit and 64-bit Vim with
Python 2 and Python 3 support [33] are available.
Install YouCompleteMe with Vundle [23].
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
will notify you to recompile it. You should then rerun the install process.
Download and install the following software:
- Python 2 or Python 3 [34]. Be sure to pick the version corresponding to
your Vim architecture. It is _Windows x86_ for a 32-bit Vim and _Windows
x86-64_ for a 64-bit Vim. We recommend installing Python 3.
- CMake [25]. Add CMake executable to the PATH environment variable.
- Visual Studio [35]. Download the community edition. During setup, choose
_Custom_ as the installation type and select the _Visual C++_ component.
- 7-zip [36]. Required to build YCM with semantic support for C-family
languages.
Compiling YCM **with** semantic support for C-family languages:
>
cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
install.py --clang-completer
<
Compiling YCM **without** semantic support for C-family languages:
>
cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
install.py
<
The following additional language support options are available:
- C# support: add '--omnisharp-completer' when calling |install.py|. Be sure
that the build utility 'msbuild' is in your PATH [37].
- Go support: install Go [27] and add '--gocode-completer' when calling
|install.py|.
- TypeScript support: install Node.js and npm [28] then install the
TypeScript SDK with 'npm install -g typescript'.
- JavaScript support: install Node.js and npm [28] and add '--tern-completer'
when calling |install.py|.
- Rust support: install Rust [29] and add '--racer-completer' when calling
|install.py|.
To simply compile with everything enabled, there's a '--all' flag. So, to
install with all language features, ensure 'msbuild', 'go', 'tsserver', 'node',
'npm', and 'cargo' tools are installed and in your 'PATH', then simply run:
>
cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe
python install.py --all
<
You can specify the Microsoft Visual C++ (MSVC) version using the '--msvc'
option. YCM officially supports MSVC 11 (Visual Studio 2012), 12 (2013), and 14
(2015).
That's it. You're done. Refer to the _User Guide_ 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.
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.
-------------------------------------------------------------------------------
*youcompleteme-freebsd-openbsd*
FreeBSD/OpenBSD ~
Please refer to the full Installation Guide below; the following commands are
provided on a best-effort basis and may not work for you. OpenBSD / FreeBSD are
not officially supported platforms by YCM.
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support.
OpenBSD 5.5 and later have a Vim that's recent enough. You can see the version
of Vim installed by running 'vim --version'.
FreeBSD 10.x comes with clang compiler but not the libraries needed to install.
>
pkg install llvm38 boost-all boost-python-libs clang38
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/llvm38/lib/
<
Install YouCompleteMe with Vundle [23].
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
will notify you to recompile it. You should then rerun the install process.
Install dependencies and CMake: 'sudo pkg_add llvm boost cmake'
Compiling YCM **with** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer --system-libclang --system-boost
<
Compiling YCM **without** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --system-boost
<
The following additional language support options are available:
- C# support: install Mono and add '--omnisharp-completer' when calling
'./install.py'.
- Go support: install Go [27] and add '--gocode-completer' when calling
'./install.py'.
- TypeScript support: install Node.js and npm [28] then install the
TypeScript SDK with 'npm install -g typescript'.
- JavaScript support: install Node.js and npm [28] and add '--tern-completer'
when calling './install.py'.
- Rust support: install Rust [29] and add '--racer-completer' when calling
'./install.py'.
To simply compile with everything enabled, there's a '--all' flag. So, to
install with all language features, ensure 'xbuild', 'go', 'tsserver', 'node',
'npm', and 'cargo' tools are installed and in your 'PATH', then simply run:
>
cd ~/.vim/bundle/YouCompleteMe
./install.py --all
<
That's it. You're done. Refer to the _User Guide_ 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.
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.
-------------------------------------------------------------------------------
*youcompleteme-full-installation-guide*
Full Installation Guide ~
These are the steps necessary to get YCM working on a Unix OS and on Windows.
**Note to Windows users:** we assume that you are running the 'cmd.exe' command
prompt and that the needed executables are in the PATH environment variable. Do
not just copy the shell commands. Replace '~' by '%USERPROFILE%' in them and
use the right Vim home directory. It should be 'vimfiles' by default instead of
'.vim'.
See the _FAQ_ if you have any issues.
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
will notify you to recompile it. You should then rerun the install process.
**Please follow the instructions carefully. Read EVERY WORD.**
1. **Ensure that your version of Vim is _at least_ 7.4.143 _and_ that it has
support for Python 2 or Python 3 scripting**.
Inside Vim, type ':version'. Look at the first two to three lines of
output; it should say 'Vi IMproved X.Y', where X.Y is the major version
of vim. If your version is greater than 7.4, then you're all set. If your
version is 7.4 then look below that where it says, 'Included patches:
1-Z', where Z will be some number. That number needs to be 143 or higher.
If your version of Vim is not recent enough, you may need to compile Vim
from source [30] (don't worry, it's easy).
After you have made sure that you have Vim 7.4.143+, type the following
in Vim: ":echo has('python') || has('python3')". The output should be 1.
If it's 0, then get a version of Vim with Python support.
On Windows, check also if your Vim architecture is 32 or 64-bit. This is
critical because it must match the Python and the YCM libraries
architectures. We recommend using a 64-bit Vim.
2. **Install YCM** with Vundle [23] (or Pathogen [38], but Vundle is a
better idea). With Vundle, this would mean adding a "Plugin
'Valloric/YouCompleteMe'" line to your vimrc [39].
If you don't install YCM with Vundle, make sure you have run 'git
submodule update --init --recursive' after checking out the YCM
repository (Vundle will do this for you) to fetch YCM's dependencies.
3. [Complete this step ONLY if you care about semantic completion support
for C-family languages. Otherwise it's not necessary.]
**Download the latest version of 'libclang'**. Clang is an open-source
compiler that can compile C/C++/Objective-C/Objective-C++. The 'libclang'
library it provides is used to power the YCM semantic completion engine
for those languages. YCM is designed to work with libclang version 3.9 or
higher.
You can use the system libclang _only if you are sure it is version 3.9
or higher_, otherwise don't. Even if it is, we recommend using the
official binaries from llvm.org [40] if at all possible. Make sure you
download the correct archive file for your OS.
We **STRONGLY recommend AGAINST use** of the system libclang instead of
the upstream compiled binaries. Random things may break. Save yourself
the hassle and use the upstream pre-built libclang.
4. **Compile the 'ycm_core' library** that YCM needs. This library is the
C++ engine that YCM uses to get fast completions.
You will need to have 'cmake' installed in order to generate the required
makefiles. Linux users can install cmake with their package manager
('sudo apt-get install cmake' for Ubuntu) whereas other users can
download and install [25] cmake from its project site. Mac users can also
get it through Homebrew [24] with 'brew install cmake'.
On a Unix OS, you need to make sure you have Python headers installed. On
a Debian-like Linux distro, this would be 'sudo apt-get install python-
dev python3-dev'. On Mac they should already be present.
On Windows, you need to download and install Python 2 or Python 3 [34].
Pick the version corresponding to your Vim architecture. You will also
need Microsoft Visual C++ (MSVC) to build YCM. You can obtain it by
installing Visual Studio [35]. MSVC 11 (Visual Studio 2012), 12 (2013),
and 14 (2015) are officially supported.
Here we'll assume you installed YCM with Vundle. That means that the top-
level YCM directory is in '~/.vim/bundle/YouCompleteMe'.
We'll create a new folder where build files will be placed. Run the
following:
>
cd ~
mkdir ycm_build
cd ycm_build
<
Now we need to generate the makefiles. If you DON'T care about semantic
support for C-family languages, run the following command in the
'ycm_build' directory:
>
cmake -G "<generator>" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
<
where '<generator>' is 'Unix Makefiles' on Unix systems and one of the
following Visual Studio generators on Windows:
- 'Visual Studio 11 Win64'
- 'Visual Studio 12 Win64'
- 'Visual Studio 14 Win64'
Remove the 'Win64' part in these generators if your Vim architecture is
32-bit.
For those who want to use the system version of boost, you would pass
'-DUSE_SYSTEM_BOOST=ON' to cmake. This may be necessary on some systems
where the bundled version of boost doesn't compile out of the box.
NOTE: We **STRONGLY recommend AGAINST use** of the system boost instead
of the bundled version of boost. Random things may break. Save yourself
the hassle and use the bundled version of boost.
If you DO care about semantic support for C-family languages, then your
'cmake' call will be a bit more complicated. We'll assume you downloaded
a binary distribution of LLVM+Clang from llvm.org in step 3 and that you
extracted the archive file to folder '~/ycm_temp/llvm_root_dir' (with
'bin', 'lib', 'include' etc. folders right inside that folder). On
Windows, you can extract the files from the LLVM+Clang installer using
7-zip [36].
NOTE: This _only_ works with a _downloaded_ LLVM binary package, not a
custom-built LLVM! See docs below for 'EXTERNAL_LIBCLANG_PATH' when using
a custom LLVM build.
With that in mind, run the following command in the 'ycm_build'
directory:
>
cmake -G "<generator>" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
<
where '<generator>' is replaced like above.
Now that configuration files have been generated, compile the libraries
using this command:
>
cmake --build . --target ycm_core --config Release
<
The '--config Release' part is specific to Windows and will be ignored on
a Unix OS.
For those who want to use the system version of libclang, you would pass
'-DUSE_SYSTEM_LIBCLANG=ON' to cmake _instead of_ the
'-DPATH_TO_LLVM_ROOT=...' flag.
NOTE: We **STRONGLY recommend AGAINST use** of the system libclang
instead of the upstream compiled binaries. Random things may break. Save
yourself the hassle and use the upstream pre-built libclang.
You could also force the use of a custom libclang library with
'-DEXTERNAL_LIBCLANG_PATH=/path/to/libclang.so' flag (the library would
end with '.dylib' on a Mac). Again, this flag would be used _instead of_
the other flags. **If you compiled LLVM from source, this is the flag you
should be using.**
Running the 'cmake' command will also place the 'libclang.[so|dylib|dll]'
in the 'YouCompleteMe/third_party/ycmd' folder for you if you compiled
with clang support (it needs to be there for YCM to work).
5. Set up support for additional languages, as desired:
6. C# support: install Mono on non-Windows platforms [41]. Navigate to
'YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer' and run
'msbuild /property:Configuration=Release' on Windows. Replace 'msbuild'
by 'xbuild' on other platforms. On Windows, be sure that the build
utility 'msbuild' is in your PATH [37].
7. Go support: install Go [27] and add it to your path. Navigate to
'YouCompleteMe/third_party/ycmd/third_party/gocode' and run 'go build'.
8. TypeScript support: as with the quick installation, simply 'npm install
-g typescript' after successfully installing Node.js and npm [28].
9. JavaScript support: install Node.js and npm [28]. Then navigate to
'YouCompleteMe/third_party/ycmd/third_party/tern_runtime' and run 'npm
install --production'
10. Rust support: install Rust [29]. Navigate to
'YouCompleteMe/third_party/ycmd/third_party/racerd' and run 'cargo
build --release'.
That's it. You're done. Refer to the _User Guide_ 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.
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.
===============================================================================
*youcompleteme-quick-feature-summary*
Quick Feature Summary ~
-------------------------------------------------------------------------------
*youcompleteme-general*
General (all languages) ~
- Super-fast identifier completer including tags files and syntax elements
- Intelligent suggestion ranking and filtering
- File and path suggestions
- Suggestions from Vim's OmniFunc
- UltiSnips snippet suggestions
-------------------------------------------------------------------------------
*youcompleteme-c-family-languages*
C-family languages (C, C++, Objective C, Objective C++) ~
- Semantic auto-completion
- Real-time diagnostic display
- Go to include/declaration/definition (|GoTo|, etc.)
- Semantic type information for identifiers (|GetType|)
- Automatically fix certain errors (|FixIt|)
- View documentation comments for identifiers (|GetDoc|)
-------------------------------------------------------------------------------
*youcompleteme-c*
C♯ ~
- Semantic auto-completion
- Real-time diagnostic display
- Go to declaration/definition (|GoTo|, etc.)
- Semantic type information for identifiers (|GetType|)
- Automatically fix certain errors (|FixIt|)
- Management of OmniSharp server instance
- View documentation comments for identifiers (|GetDoc|)
-------------------------------------------------------------------------------
*youcompleteme-python*
Python ~
- Intelligent auto-completion
- Go to declaration/definition, find references (|GoTo|, |GoToReferences|)
- View documentation comments for identifiers (|GetDoc|)
- Restart JediHTTP [11] server using a different Python interpreter
-------------------------------------------------------------------------------
*youcompleteme-go*
Go ~
- Semantic auto-completion
- Go to definition (|GoTo|)
- Management of 'gocode' server instance
-------------------------------------------------------------------------------
*youcompleteme-typescript*
TypeScript ~
- Semantic auto-completion
- Renaming symbols ('RefactorRename <new name>')
- Go to definition, find references (|GoToDefinition|, |GoToReferences|)
- Semantic type information for identifiers (|GetType|)
- View documentation comments for identifiers (|GetDoc|)
-------------------------------------------------------------------------------
*youcompleteme-javascript*
JavaScript ~
- Intelligent auto-completion
- Renaming variables ('RefactorRename <new name>')
- Go to definition, find references (|GoToDefinition|, |GoToReferences|)
- Type information for identifiers (|GetType|)
- View documentation comments for identifiers (|GetDoc|)
- Management of 'Tern' server instance
-------------------------------------------------------------------------------
*youcompleteme-rust*
Rust ~
- Semantic auto-completion
- Go to definition (|GoTo|, |GoToDefinition|, and |GoToDeclaration| are
identical)
- Management of 'racer' server instance
- View documentation comments for identifiers (|GetDoc|)
===============================================================================
*youcompleteme-user-guide*
User Guide ~
-------------------------------------------------------------------------------
*youcompleteme-general-usage*
General Usage ~
- If the offered completions are too broad, keep typing characters; YCM will
continue refining the offered completions based on your input.
- Filtering is "smart-case" 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).
So, "foo" matches "Foo" and "foo", "Foo" matches "Foo" and "FOO" but not
"foo".
- 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 _Options [42]_ section below.
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).