Updating vimdoc
This commit is contained in:
parent
bc4e7fb850
commit
bdb88f7b76
@ -14,8 +14,10 @@ Contents ~
|
|||||||
2. Completion string ranking |youcompleteme-completion-string-ranking|
|
2. Completion string ranking |youcompleteme-completion-string-ranking|
|
||||||
3. General Semantic Completion Engine Usage |youcompleteme-general-semantic-completion-engine-usage|
|
3. General Semantic Completion Engine Usage |youcompleteme-general-semantic-completion-engine-usage|
|
||||||
4. C-family Semantic Completion Engine Usage |youcompleteme-c-family-semantic-completion-engine-usage|
|
4. C-family Semantic Completion Engine Usage |youcompleteme-c-family-semantic-completion-engine-usage|
|
||||||
5. Syntastic integration |youcompleteme-syntastic-integration|
|
5. Python semantic completion |youcompleteme-python-semantic-completion|
|
||||||
6. Writing New Semantic Completers |youcompleteme-writing-new-semantic-completers|
|
6. Semantic completion for other languages |youcompleteme-semantic-completion-for-other-languages|
|
||||||
|
7. Writing New Semantic Completers |youcompleteme-writing-new-semantic-completers|
|
||||||
|
8. Syntastic integration |youcompleteme-syntastic-integration|
|
||||||
7. Commands |youcompleteme-commands|
|
7. Commands |youcompleteme-commands|
|
||||||
1. The |YcmForceCompileAndDiagnostics| command
|
1. The |YcmForceCompileAndDiagnostics| command
|
||||||
2. The |YcmDiags| command
|
2. The |YcmDiags| command
|
||||||
@ -27,36 +29,41 @@ Contents ~
|
|||||||
2. The |g:ycm_filetype_whitelist| option
|
2. The |g:ycm_filetype_whitelist| option
|
||||||
3. The |g:ycm_filetype_blacklist| option
|
3. The |g:ycm_filetype_blacklist| option
|
||||||
4. The |g:ycm_filetype_specific_completion_to_disable| option
|
4. The |g:ycm_filetype_specific_completion_to_disable| option
|
||||||
5. The |g:ycm_allow_changing_updatetime| option
|
5. The |g:ycm_register_as_syntastic_checker| option
|
||||||
6. The |g:ycm_complete_in_comments_and_strings| option
|
6. The |g:ycm_allow_changing_updatetime| option
|
||||||
7. The |g:ycm_collect_identifiers_from_comments_and_strings| option
|
7. The |g:ycm_complete_in_comments_and_strings| option
|
||||||
8. The |g:ycm_add_preview_to_completeopt| option
|
8. The |g:ycm_collect_identifiers_from_comments_and_strings| option
|
||||||
9. The |g:ycm_autoclose_preview_window_after_completion| option
|
9. The |g:ycm_add_preview_to_completeopt| option
|
||||||
10. The |g:ycm_max_diagnostics_to_display| option
|
10. The |g:ycm_autoclose_preview_window_after_completion| option
|
||||||
11. The |g:ycm_key_list_select_completion| option
|
11. The |g:ycm_autoclose_preview_window_after_insertion| option
|
||||||
12. The |g:ycm_key_list_previous_completion| option
|
12. The |g:ycm_max_diagnostics_to_display| option
|
||||||
13. The |g:ycm_key_invoke_completion| option
|
13. The |g:ycm_key_list_select_completion| option
|
||||||
14. The |g:ycm_key_detailed_diagnostics| option
|
14. The |g:ycm_key_list_previous_completion| option
|
||||||
15. The |g:ycm_global_ycm_extra_conf| option
|
15. The |g:ycm_key_invoke_completion| option
|
||||||
16. The |g:ycm_confirm_extra_conf| option
|
16. The |g:ycm_key_detailed_diagnostics| option
|
||||||
17. The |g:ycm_extra_conf_globlist| option
|
17. The |g:ycm_global_ycm_extra_conf| option
|
||||||
18. The |g:ycm_semantic_triggers| option
|
18. The |g:ycm_confirm_extra_conf| option
|
||||||
|
19. The |g:ycm_extra_conf_globlist| option
|
||||||
|
20. The |g:ycm_semantic_triggers| option
|
||||||
9. FAQ |youcompleteme-faq|
|
9. FAQ |youcompleteme-faq|
|
||||||
1. I get a linker warning regarding |libpython| on Mac when compiling YCM
|
1. I get a linker warning regarding |libpython| on Mac when compiling YCM
|
||||||
2. I get a weird window at the top of my file when I use the semantic engine
|
2. I get a weird window at the top of my file when I use the semantic engine
|
||||||
3. It appears that YCM is not working
|
3. It appears that YCM is not working
|
||||||
4. I cannot get the Syntastic integration to work
|
4. I cannot get the Syntastic integration to work
|
||||||
5. Sometimes it takes much longer to get semantic completions than normal
|
5. Sometimes it takes much longer to get semantic completions than normal
|
||||||
6. YCM auto-inserts completion strings I don't want!
|
6. Vim flickers every time I move the cursor or moving the cursor is slow
|
||||||
7. I get a 'E227: mapping already exists for <blah>' error when I start Vim
|
7. YCM auto-inserts completion strings I don't want!
|
||||||
8. I'm trying to use a Homebrew Vim with YCM and I'm getting segfaults
|
8. I get a 'E227: mapping already exists for <blah>' error when I start Vim
|
||||||
9. I have a Homebrew Python and/or MacVim; can't compile/SIGABRT when starting
|
9. I'm trying to use a Homebrew Vim with YCM and I'm getting segfaults
|
||||||
10. I get 'LONG_BIT definition appears wrong for platform' when compiling
|
10. I have a Homebrew Python and/or MacVim; can't compile/SIGABRT when starting
|
||||||
11. I get 'Vim: Caught deadly signal SEGV' on Vim startup
|
11. Vim segfaults when I use the semantic completer in Ruby files
|
||||||
12. Why isn't YCM just written in plain VimScript, FFS?
|
12. I get 'LONG_BIT definition appears wrong for platform' when compiling
|
||||||
13. Why does YCM demand such a recent version of Vim?
|
13. I get 'Vim: Caught deadly signal SEGV' on Vim startup
|
||||||
14. I get annoying messages in Vim's status area when I type
|
14. |CTRL-U| in insert mode does not work
|
||||||
15. Nasty bugs happen if I have the |vim-autoclose| plugin installed
|
15. Why isn't YCM just written in plain VimScript, FFS?
|
||||||
|
16. Why does YCM demand such a recent version of Vim?
|
||||||
|
17. I get annoying messages in Vim's status area when I type
|
||||||
|
18. Nasty bugs happen if I have the |vim-autoclose| plugin installed
|
||||||
10. Contact |youcompleteme-contact|
|
10. Contact |youcompleteme-contact|
|
||||||
11. License |youcompleteme-license|
|
11. License |youcompleteme-license|
|
||||||
|
|
||||||
@ -68,11 +75,12 @@ 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
|
Vim. It has several completion engines: an identifier-based engine that works
|
||||||
with every programming language, a semantic, Clang [1]-based engine that
|
with every programming language, a semantic, Clang [1]-based engine that
|
||||||
provides native semantic code completion for C/C++/Objective-C/Objective-C++
|
provides native semantic code completion for C/C++/Objective-C/Objective-C++
|
||||||
(from now on referred to as "the C-family languages") and an omnifunc-based
|
(from now on referred to as "the C-family languages"), a Jedi [2]-based
|
||||||
completer that uses data from Vim's omnicomplete system to provide semantic
|
completion engine for Python and an omnifunc-based completer that uses data
|
||||||
completions for many other languages (Python, Ruby, PHP etc.).
|
from Vim's omnicomplete system to provide semantic completions for many other
|
||||||
|
languages (Ruby, PHP etc.).
|
||||||
|
|
||||||
YouCompleteMe GIF demo, see reference [2]
|
YouCompleteMe GIF demo, see reference [3]
|
||||||
|
|
||||||
Here's an explanation of what happens in the short GIF demo above.
|
Here's an explanation of what happens in the short GIF demo above.
|
||||||
|
|
||||||
@ -91,7 +99,7 @@ typing to further filter out unwanted completions.
|
|||||||
|
|
||||||
A critical thing to notice is that the completion filtering is NOT based on
|
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
|
the input being a string prefix of the completion (but that works too). The
|
||||||
input needs to be a subsequence [3] match of a completion. This is a fancy way
|
input needs to be a subsequence [4] match of a completion. This is a fancy way
|
||||||
of saying that any input characters need to be present in a completion string
|
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
|
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
|
'xaybgc', but not of 'xbyxaxxc'. After the filter, a complicated sorting
|
||||||
@ -108,7 +116,7 @@ The demo also shows the semantic engine in use. When the user presses '.',
|
|||||||
can also be triggered with a keyboard shortcut; see the rest of the docs).
|
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 integration with
|
The last thing that you can see in the demo is YCM's integration with
|
||||||
Syntastic [4] (the little red X that shows up in the left gutter) if you are
|
Syntastic [5] (the little red X that shows up in the left gutter) if you are
|
||||||
editing a C-family file. As Clang compiles your file and detects warnings or
|
editing a C-family file. As Clang compiles your file and detects warnings or
|
||||||
errors, they will be piped to Syntastic for display. You don't need to save
|
errors, they will be piped to Syntastic for display. You don't need to save
|
||||||
your file or press any keyboard shortcut to trigger this, it "just happens" in
|
your file or press any keyboard shortcut to trigger this, it "just happens" in
|
||||||
@ -132,16 +140,16 @@ Mac OS X super-quick installation ~
|
|||||||
Please refer to the full Installation Guide below; the following commands are
|
Please refer to the full Installation Guide below; the following commands are
|
||||||
provided on a best-effort basis and may not work for you.
|
provided on a best-effort basis and may not work for you.
|
||||||
|
|
||||||
Install the latest version of MacVim [5]. Yes, MacVim. And yes, the latest.
|
Install the latest version of MacVim [6]. Yes, MacVim. And yes, the latest.
|
||||||
|
|
||||||
If you don't use the MacVim GUI, it is recommended to use the Vim binary that
|
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
|
is inside the MacVim.app package ('MacVim.app/Contents/MacOS/Vim'). To ensure
|
||||||
it works correctly copy the 'mvim' script from the MacVim [5] download to your
|
it works correctly copy the 'mvim' script from the MacVim [6] download to your
|
||||||
local binary folder (for example '/usr/local/bin/mvim') and then symlink it:
|
local binary folder (for example '/usr/local/bin/mvim') and then symlink it:
|
||||||
>
|
>
|
||||||
ln -s /usr/local/bin/mvim vim
|
ln -s /usr/local/bin/mvim vim
|
||||||
|
|
||||||
Install YouCompleteMe with Vundle [6].
|
Install YouCompleteMe with Vundle [7].
|
||||||
|
|
||||||
Remember: YCM is a plugin with a compiled component. If you update YCM using
|
Remember: YCM is a plugin with a compiled component. If you update YCM using
|
||||||
Vundle and the ycm_core library API has changed (happens rarely), YCM will
|
Vundle and the ycm_core library API has changed (happens rarely), YCM will
|
||||||
@ -150,8 +158,8 @@ notify you to recompile it. You should then rerun the install process.
|
|||||||
It's recommended that you have the latest Xcode installed along with the
|
It's recommended that you have the latest Xcode installed along with the
|
||||||
latest Command Line Tools (that you install from within Xcode).
|
latest Command Line Tools (that you install from within Xcode).
|
||||||
|
|
||||||
Install CMake. Preferably with Homebrew [7], but here's the stand-alone CMake
|
Install CMake. Preferably with Homebrew [8], but here's the stand-alone CMake
|
||||||
installer [8].
|
installer [9].
|
||||||
|
|
||||||
If you have installed a Homebrew Python and/or Homebrew MacVim, see the FAQ
|
If you have installed a Homebrew Python and/or Homebrew MacVim, see the FAQ
|
||||||
for details.
|
for details.
|
||||||
@ -185,9 +193,9 @@ provided on a best-effort basis and may not work for you.
|
|||||||
|
|
||||||
Make sure you have Vim 7.3.584 with python2 support. At the time of writing,
|
Make sure you have Vim 7.3.584 with python2 support. At the time of writing,
|
||||||
the version of Vim shipping with Ubuntu is too old. You may need to compile
|
the version of Vim shipping with Ubuntu is too old. You may need to compile
|
||||||
Vim from source [9] (don't worry, it's easy).
|
Vim from source [10] (don't worry, it's easy).
|
||||||
|
|
||||||
Install YouCompleteMe with Vundle [6].
|
Install YouCompleteMe with Vundle [7].
|
||||||
|
|
||||||
Remember: YCM is a plugin with a compiled component. If you update YCM using
|
Remember: YCM is a plugin with a compiled component. If you update YCM using
|
||||||
Vundle and the ycm_core library API has changed (happens rarely), YCM will
|
Vundle and the ycm_core library API has changed (happens rarely), YCM will
|
||||||
@ -224,7 +232,7 @@ turn on.
|
|||||||
Windows Installation ~
|
Windows Installation ~
|
||||||
|
|
||||||
YCM has no official support for Windows, but that doesn't mean you can't get
|
YCM has no official support for Windows, but that doesn't mean you can't get
|
||||||
it to work there. See the Windows Installation Guide [10] wiki page. Feel free
|
it to work there. See the Windows Installation Guide [11] wiki page. Feel free
|
||||||
to add to it.
|
to add to it.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@ -250,14 +258,14 @@ Please follow the instructions carefully. Read EVERY WORD.
|
|||||||
to three lines of output; it should say 'Vi IMproved 7.3' and then below
|
to three lines of output; it should say 'Vi IMproved 7.3' and then below
|
||||||
that, 'Included patches: 1-X', where X will be some number. That number
|
that, 'Included patches: 1-X', where X will be some number. That number
|
||||||
needs to be 584 or higher. If your version of Vim is not recent enough, you
|
needs to be 584 or higher. If your version of Vim is not recent enough, you
|
||||||
may need to compile Vim from source [9] (don't worry, it's easy). After you
|
may need to compile Vim from source [10] (don't worry, it's easy). After
|
||||||
have made sure that you have Vim 7.3.584+, type the following in Vim:
|
you have made sure that you have Vim 7.3.584+, type the following in Vim:
|
||||||
':echo has('python')'. The output should be 1. If it's 0, then get a
|
':echo has('python')'. The output should be 1. If it's 0, then get a
|
||||||
version of Vim with Python support.
|
version of Vim with Python support.
|
||||||
|
|
||||||
- Install YCM with Vundle [6] (or Pathogen [11], but Vundle is a better idea).
|
- Install YCM with Vundle [7] (or Pathogen [12], but Vundle is a better idea).
|
||||||
With Vundle, this would mean adding a 'Bundle 'Valloric/YouCompleteMe' line
|
With Vundle, this would mean adding a 'Bundle 'Valloric/YouCompleteMe' line
|
||||||
to your vimrc [12].
|
to your vimrc [13].
|
||||||
|
|
||||||
- [Complete this step ONLY if you care about semantic completion support for
|
- [Complete this step ONLY if you care about semantic completion support for
|
||||||
C-family languages. Otherwise it's not neccessary.] Download the latest
|
C-family languages. Otherwise it's not neccessary.] Download the latest
|
||||||
@ -266,15 +274,15 @@ Please follow the instructions carefully. Read EVERY WORD.
|
|||||||
to power the YCM semantic completion engine for those languages. YCM needs
|
to power the YCM semantic completion engine for those languages. YCM needs
|
||||||
libclang version 3.2 or higher. You can use the system libclang only if you
|
libclang version 3.2 or higher. You can use the system libclang only if you
|
||||||
are sure it is version 3.2 or higher, otherwise don't. Even if it is, I
|
are sure it is version 3.2 or higher, otherwise don't. Even if it is, I
|
||||||
recommend using the official binaries from llvm.org [13] if at all
|
recommend using the official binaries from llvm.org [14] if at all
|
||||||
possible. Make sure you download the correct archive file for your OS.
|
possible. Make sure you download the correct archive file for your OS.
|
||||||
|
|
||||||
- Compile the 'ycm_core' plugin plugin (ha!) that YCM needs. This is the C++
|
- Compile the 'ycm_core' plugin plugin (ha!) that YCM needs. This is the C++
|
||||||
engine that YCM uses to get fast completions. You will need to have 'cmake'
|
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
|
installed in order to generate the required makefiles. Linux users can
|
||||||
install cmake with their package manager ('sudo apt-get install cmake' for
|
install cmake with their package manager ('sudo apt-get install cmake' for
|
||||||
Ubuntu) whereas other users can download and install [8] cmake from its
|
Ubuntu) whereas other users can download and install [9] cmake from its
|
||||||
project site. Mac users can also get it through Homebrew [7] with 'brew
|
project site. Mac users can also get it through Homebrew [8] with 'brew
|
||||||
install cmake'. You also need to make sure you have Python headers
|
install cmake'. You also need to make sure you have Python headers
|
||||||
installed. On a Debian-like Linux distro, this would be 'sudo apt-get
|
installed. On a Debian-like Linux distro, this would be 'sudo apt-get
|
||||||
install python-dev'. On Mac they should already be present. Here we'll
|
install python-dev'. On Mac they should already be present. Here we'll
|
||||||
@ -373,7 +381,7 @@ General Semantic Completion Engine Usage ~
|
|||||||
*youcompleteme-c-family-semantic-completion-engine-usage*
|
*youcompleteme-c-family-semantic-completion-engine-usage*
|
||||||
C-family Semantic Completion Engine Usage ~
|
C-family Semantic Completion Engine Usage ~
|
||||||
|
|
||||||
- You really also want to install the latest version of the Syntastic [4] Vim
|
- You really also want to install the latest version of the Syntastic [5] Vim
|
||||||
plugin. It has support for YCM and together they will provide you with
|
plugin. It has support for YCM and together they will provide you with
|
||||||
compile errors/warnings practically instantly and without saving the file.
|
compile errors/warnings practically instantly and without saving the file.
|
||||||
|
|
||||||
@ -392,12 +400,13 @@ 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
|
sequence of operations to produce a list of compilation flags YCM should hand
|
||||||
to Clang.
|
to Clang.
|
||||||
|
|
||||||
See YCM's own '.ycm_extra_conf.py' [14] for details on how this works. You
|
See YCM's own '.ycm_extra_conf.py' [15] for details on how this works. You
|
||||||
should be able to use it as a starting point. Hint: just replace the strings
|
should be able to use it as a starting point. Don't just copy/paste that file
|
||||||
in the 'flags' variable with compilation flags necessary for your project.
|
somewhere and expect things to magically work; your project needs different
|
||||||
That should be enough for 99% of projects.
|
flags. Hint: just replace the strings in the 'flags' variable with compilation
|
||||||
|
flags necessary for your project. That should be enough for 99% of projects.
|
||||||
|
|
||||||
Yes, Clang's 'CompilationDatabase' system [15] is also supported. Again, see
|
Yes, Clang's 'CompilationDatabase' system [16] is also supported. Again, see
|
||||||
the above linked example file.
|
the above linked example file.
|
||||||
|
|
||||||
If Clang encounters errors when compiling the header files that your file
|
If Clang encounters errors when compiling the header files that your file
|
||||||
@ -411,11 +420,65 @@ to getting fast completions.
|
|||||||
Call the ':YcmDiags' command to see if any errors or warnings were detected in
|
Call the ':YcmDiags' command to see if any errors or warnings were detected in
|
||||||
your file. Even better, use Syntastic.
|
your file. Even better, use Syntastic.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
*youcompleteme-python-semantic-completion*
|
||||||
|
Python semantic completion ~
|
||||||
|
|
||||||
|
YCM uses Jedi [2] to power its semantic completion for Python. This should
|
||||||
|
"just work" without any configuration from the user.
|
||||||
|
|
||||||
|
In the future expect to see features like go-to-definition for Python as well.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
*youcompleteme-semantic-completion-for-other-languages*
|
||||||
|
Semantic completion for other languages ~
|
||||||
|
|
||||||
|
YCM will use your 'omnifunc' (see ':h omnifunc' 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.
|
||||||
|
|
||||||
|
You can get stellar omnifuncs for Java and Ruby with Eclim [17]. Just make
|
||||||
|
sure you have the latest Eclim installed and configured and don't forget to
|
||||||
|
have 'let g:EclimCompletionMethod = 'omnifunc' 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.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
*youcompleteme-writing-new-semantic-completers*
|
||||||
|
Writing New Semantic Completers ~
|
||||||
|
|
||||||
|
You have two options here: writing an 'omnifunc' for Vim's omnicomplete system
|
||||||
|
that YCM will then use through its omni-completer, or a custom completer for
|
||||||
|
YCM using the Completer API [18].
|
||||||
|
|
||||||
|
Here are the differences between the two approaches:
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
||||||
|
- The Completer API is a much 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.
|
||||||
|
|
||||||
|
- Performance with the Completer API is better since Python executes faster
|
||||||
|
than VimScript.
|
||||||
|
|
||||||
|
If you want to use the 'omnifunc' system, see the relevant Vim docs with ':h
|
||||||
|
complete-functions'. For the Completer API, see the API docs [18].
|
||||||
|
|
||||||
|
If you want to upstream your completer into YCM's source, you should use the
|
||||||
|
Completer API.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
*youcompleteme-syntastic-integration*
|
*youcompleteme-syntastic-integration*
|
||||||
Syntastic integration ~
|
Syntastic integration ~
|
||||||
|
|
||||||
YCM has explicit support for Syntastic [4] (and vice-versa) if you compiled
|
YCM has explicit support for Syntastic [5] (and vice-versa) if you compiled
|
||||||
YCM with Clang support; this means that any diagnostics (errors or warnings)
|
YCM with Clang support; this means that any diagnostics (errors or warnings)
|
||||||
that Clang encounters while compiling your file will be fed back to Syntastic
|
that Clang encounters while compiling your file will be fed back to Syntastic
|
||||||
for display.
|
for display.
|
||||||
@ -453,38 +516,9 @@ You can also see the full diagnostic message for all the diagnostics in the
|
|||||||
current file in Vim's 'locationlist', which can be opened with the ':lopen'
|
current file in Vim's 'locationlist', which can be opened with the ':lopen'
|
||||||
and ':lclose' commands. A good way to toggle the display of the 'locationlist'
|
and ':lclose' commands. A good way to toggle the display of the 'locationlist'
|
||||||
with a single key mapping is provided by another (very small) Vim plugin
|
with a single key mapping is provided by another (very small) Vim plugin
|
||||||
called ListToggle [16] (which also makes it possible to change the height of
|
called ListToggle [19] (which also makes it possible to change the height of
|
||||||
the 'locationlist' window), also written by yours truly.
|
the 'locationlist' window), also written by yours truly.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
*youcompleteme-writing-new-semantic-completers*
|
|
||||||
Writing New Semantic Completers ~
|
|
||||||
|
|
||||||
You have two options here: writing an 'omnifunc' for Vim's omnicomplete system
|
|
||||||
that YCM will then use through its omni-completer, or a custom completer for
|
|
||||||
YCM using the Completer API [17].
|
|
||||||
|
|
||||||
Here are the differences between the two approaches:
|
|
||||||
|
|
||||||
- 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.
|
|
||||||
|
|
||||||
- The Completer API is a much 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.
|
|
||||||
|
|
||||||
- Performance with the Completer API is better since Python executes faster
|
|
||||||
than VimScript.
|
|
||||||
|
|
||||||
If you want to use the 'omnifunc' system, see the relevant Vim docs with ':h
|
|
||||||
complete-functions'. For the Completer API, see the API docs [17].
|
|
||||||
|
|
||||||
If you want to upstream your completer into YCM's source, you should use the
|
|
||||||
Completer API.
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*youcompleteme-commands*
|
*youcompleteme-commands*
|
||||||
Commands ~
|
Commands ~
|
||||||
@ -538,11 +572,11 @@ Options ~
|
|||||||
|
|
||||||
All options have reasonable defaults so if the plug-in works after
|
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
|
installation you don't need to change any options. These options can be
|
||||||
configured in your vimrc script [12] by including a line like this:
|
configured in your vimrc script [13] by including a line like this:
|
||||||
>
|
>
|
||||||
let g:ycm_min_num_of_chars_for_completion = 1
|
let g:ycm_min_num_of_chars_for_completion = 1
|
||||||
|
|
||||||
Note that after changing an option in your vimrc script [12] you have to
|
Note that after changing an option in your vimrc script [13] you have to
|
||||||
restart Vim for the changes to take effect.
|
restart Vim for the changes to take effect.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -627,6 +661,23 @@ Default: '{}'
|
|||||||
>
|
>
|
||||||
let g:ycm_filetype_specific_completion_to_disable = {}
|
let g:ycm_filetype_specific_completion_to_disable = {}
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
The *g:ycm_register_as_syntastic_checker* option
|
||||||
|
|
||||||
|
When set, this option makes YCM register itself as the Syntastic checker for
|
||||||
|
the 'c', 'cpp', 'objc' and 'objcpp' filetypes. This enables the YCM-Syntastic
|
||||||
|
integration.
|
||||||
|
|
||||||
|
If you're using YCM's identifier completer in C-family languages but cannot
|
||||||
|
use the clang-based semantic completer for those languages and want to use the
|
||||||
|
GCC Syntastic checkers, unset this option.
|
||||||
|
|
||||||
|
Don't unset this option unless you're sure you know what you're doing.
|
||||||
|
|
||||||
|
Default: '1'
|
||||||
|
>
|
||||||
|
let g:ycm_register_as_syntastic_checker = 1
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
The *g:ycm_allow_changing_updatetime* option
|
The *g:ycm_allow_changing_updatetime* option
|
||||||
|
|
||||||
@ -698,6 +749,19 @@ Default: '0'
|
|||||||
>
|
>
|
||||||
let g:ycm_autoclose_preview_window_after_completion = 0
|
let g:ycm_autoclose_preview_window_after_completion = 0
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
The *g:ycm_autoclose_preview_window_after_insertion* option
|
||||||
|
|
||||||
|
When this option is set to '1', YCM will auto-close the 'preview' window after
|
||||||
|
the user leaves insert mode. This option is irrelevant if
|
||||||
|
|g:ycm_autoclose_preview_window_after_completion| is set or if no 'preview'
|
||||||
|
window is triggered. See the |g:ycm_add_preview_to_completeopt| option for
|
||||||
|
more details.
|
||||||
|
|
||||||
|
Default: '0'
|
||||||
|
>
|
||||||
|
let g:ycm_autoclose_preview_window_after_insertion = 0
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
The *g:ycm_max_diagnostics_to_display* option
|
The *g:ycm_max_diagnostics_to_display* option
|
||||||
|
|
||||||
@ -886,7 +950,8 @@ and their types to write the function call.
|
|||||||
|
|
||||||
If you would like this window to auto-close after you select a completion
|
If you would like this window to auto-close after you select a completion
|
||||||
string, set the |g:ycm_autoclose_preview_window_after_completion| option to
|
string, set the |g:ycm_autoclose_preview_window_after_completion| option to
|
||||||
'1' in your 'vimrc' file.
|
'1' in your 'vimrc' file. Similarly, the |g:ycm_autoclose_preview_window_after_insertion|
|
||||||
|
option can be set to close the 'preview' window after leaving insert mode.
|
||||||
|
|
||||||
If you don't want this window to ever show up, add 'set completeopt-=preview'
|
If you don't want this window to ever show up, add 'set completeopt-=preview'
|
||||||
to your 'vimrc'. Also make sure that the |g:ycm_add_preview_to_completeopt|
|
to your 'vimrc'. Also make sure that the |g:ycm_add_preview_to_completeopt|
|
||||||
@ -923,6 +988,15 @@ Bottom line, if libclang can't pre-compile your file's preamble because there
|
|||||||
were errors in it, you're going to get slow completions because there's no AST
|
were errors in it, you're going to get slow completions because there's no AST
|
||||||
cache.
|
cache.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Vim flickers every time I move the cursor or moving the cursor is slow ~
|
||||||
|
|
||||||
|
You probably have an old version of Syntastic installed. If you are using
|
||||||
|
Vundle, make sure that your bundle command is 'Bundle 'scrooloose/syntastic'
|
||||||
|
and not'Bundle 'Syntastic'. The first command pulls in the latest version of
|
||||||
|
Syntastic from GitHub while the second one pulls in an old version from
|
||||||
|
vim.org.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
YCM auto-inserts completion strings I don't want! ~
|
YCM auto-inserts completion strings I don't want! ~
|
||||||
|
|
||||||
@ -949,7 +1023,7 @@ conflict goes away.
|
|||||||
I'm trying to use a Homebrew Vim with YCM and I'm getting segfaults ~
|
I'm trying to use a Homebrew Vim with YCM and I'm getting segfaults ~
|
||||||
|
|
||||||
Something (I don't know what) is wrong with the way that Homebrew configures
|
Something (I don't know what) is wrong with the way that Homebrew configures
|
||||||
and builds Vim. I recommend using MacVim [5]. Even if you don't like the
|
and builds Vim. I recommend using MacVim [6]. Even if you don't like the
|
||||||
MacVim GUI, you can use the Vim binary that is inside the MacVim.app package
|
MacVim GUI, you can use the Vim binary that is inside the MacVim.app package
|
||||||
(it's 'MacVim.app/Contents/MacOS/Vim') and get the Vim console experience.
|
(it's 'MacVim.app/Contents/MacOS/Vim') and get the Vim console experience.
|
||||||
|
|
||||||
@ -958,9 +1032,15 @@ I have a Homebrew Python and/or MacVim; can't compile/SIGABRT when starting ~
|
|||||||
|
|
||||||
You should probably run 'brew rm python; brew install python' to get the
|
You should probably run 'brew rm python; brew install python' to get the
|
||||||
latest fixes that should make YCM work with such a configuration. Also rebuild
|
latest fixes that should make YCM work with such a configuration. Also rebuild
|
||||||
Macvim then. If you still get problems with this, see issue #18 [18] for
|
Macvim then. If you still get problems with this, see issue #18 [20] for
|
||||||
suggestions.
|
suggestions.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Vim segfaults when I use the semantic completer in Ruby files ~
|
||||||
|
|
||||||
|
This was caused by a Vim bug. Update your version of Vim (Vim 7.3.874 is known
|
||||||
|
to work, earlier versions may also fix this issue).
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
I get 'LONG_BIT definition appears wrong for platform' when compiling ~
|
I get 'LONG_BIT definition appears wrong for platform' when compiling ~
|
||||||
|
|
||||||
@ -1014,6 +1094,13 @@ So just go through the installation guide and make sure you are using a
|
|||||||
correct 'libclang.so'. I recommend downloading prebuilt binaries from
|
correct 'libclang.so'. I recommend downloading prebuilt binaries from
|
||||||
llvm.org.
|
llvm.org.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
*CTRL-U* in insert mode does not work
|
||||||
|
|
||||||
|
YCM keeps you in a 'completefunc' completion mode when you're typing in insert
|
||||||
|
mode and Vim disables '<C-U>' in completion mode as a "feature." Sadly there's
|
||||||
|
nothing I can do about this.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Why isn't YCM just written in plain VimScript, FFS? ~
|
Why isn't YCM just written in plain VimScript, FFS? ~
|
||||||
|
|
||||||
@ -1051,7 +1138,7 @@ You'll have to learn to ignore them. It's a shitty "solution", I know.
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Nasty bugs happen if I have the *vim-autoclose* plugin installed
|
Nasty bugs happen if I have the *vim-autoclose* plugin installed
|
||||||
|
|
||||||
Use the delimitMate [19] plugin instead. It does the same thing without
|
Use the delimitMate [21] plugin instead. It does the same thing without
|
||||||
conflicting with YCM.
|
conflicting with YCM.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@ -1059,7 +1146,7 @@ conflicting with YCM.
|
|||||||
Contact ~
|
Contact ~
|
||||||
|
|
||||||
If you have questions, bug reports, suggestions, etc. please use the issue
|
If you have questions, bug reports, suggestions, etc. please use the issue
|
||||||
tracker [20]. The latest version is available at http://valloric.github.com/YouCompleteMe/.
|
tracker [22]. The latest version is available at http://valloric.github.com/YouCompleteMe/.
|
||||||
|
|
||||||
The author's homepage is http://val.markovic.io.
|
The author's homepage is http://val.markovic.io.
|
||||||
|
|
||||||
@ -1067,7 +1154,7 @@ The author's homepage is http://val.markovic.io.
|
|||||||
*youcompleteme-license*
|
*youcompleteme-license*
|
||||||
License ~
|
License ~
|
||||||
|
|
||||||
This software is licensed under the GPL v3 license [21]. Copyright 2012
|
This software is licensed under the GPL v3 license [23]. Copyright 2012
|
||||||
Strahinja Val Markovic <val@markovic.io>.
|
Strahinja Val Markovic <val@markovic.io>.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@ -1075,25 +1162,27 @@ Strahinja Val Markovic <val@markovic.io>.
|
|||||||
References ~
|
References ~
|
||||||
|
|
||||||
[1] http://clang.llvm.org/
|
[1] http://clang.llvm.org/
|
||||||
[2] http://i.imgur.com/0OP4ood.gif
|
[2] https://github.com/davidhalter/jedi
|
||||||
[3] http://en.wikipedia.org/wiki/Subsequence
|
[3] http://i.imgur.com/0OP4ood.gif
|
||||||
[4] https://github.com/scrooloose/syntastic
|
[4] http://en.wikipedia.org/wiki/Subsequence
|
||||||
[5] http://code.google.com/p/macvim/#Download
|
[5] https://github.com/scrooloose/syntastic
|
||||||
[6] https://github.com/gmarik/vundle#about
|
[6] http://code.google.com/p/macvim/#Download
|
||||||
[7] http://mxcl.github.com/homebrew/
|
[7] https://github.com/gmarik/vundle#about
|
||||||
[8] http://www.cmake.org/cmake/resources/software.html
|
[8] http://mxcl.github.com/homebrew/
|
||||||
[9] https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source
|
[9] http://www.cmake.org/cmake/resources/software.html
|
||||||
[10] https://github.com/Valloric/YouCompleteMe/wiki/Windows-Installation-Guide
|
[10] https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source
|
||||||
[11] https://github.com/tpope/vim-pathogen#pathogenvim
|
[11] https://github.com/Valloric/YouCompleteMe/wiki/Windows-Installation-Guide
|
||||||
[12] http://vimhelp.appspot.com/starting.txt.html#vimrc
|
[12] https://github.com/tpope/vim-pathogen#pathogenvim
|
||||||
[13] http://llvm.org/releases/download.html#3.2
|
[13] http://vimhelp.appspot.com/starting.txt.html#vimrc
|
||||||
[14] https://github.com/Valloric/YouCompleteMe/blob/master/cpp/ycm/.ycm_extra_conf.py
|
[14] http://llvm.org/releases/download.html#3.2
|
||||||
[15] http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
[15] https://github.com/Valloric/YouCompleteMe/blob/master/cpp/ycm/.ycm_extra_conf.py
|
||||||
[16] https://github.com/Valloric/ListToggle
|
[16] http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
||||||
[17] https://github.com/Valloric/YouCompleteMe/blob/master/python/completers/completer.py
|
[17] http://eclim.org/
|
||||||
[18] https://github.com/Valloric/YouCompleteMe/issues/18
|
[18] https://github.com/Valloric/YouCompleteMe/blob/master/python/completers/completer.py
|
||||||
[19] https://github.com/Raimondi/delimitMate
|
[19] https://github.com/Valloric/ListToggle
|
||||||
[20] https://github.com/Valloric/YouCompleteMe/issues?state=open
|
[20] https://github.com/Valloric/YouCompleteMe/issues/18
|
||||||
[21] http://www.gnu.org/copyleft/gpl.html
|
[21] https://github.com/Raimondi/delimitMate
|
||||||
|
[22] https://github.com/Valloric/YouCompleteMe/issues?state=open
|
||||||
|
[23] http://www.gnu.org/copyleft/gpl.html
|
||||||
|
|
||||||
vim: ft=help
|
vim: ft=help
|
||||||
|
Loading…
Reference in New Issue
Block a user