New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need a way to temporarily halt autocompletion #1731
Comments
You just need to type :let g:ycm_auto_trigger = 0 before the command and :let g:ycm_auto_trigger = 1 after. |
No, that just disables the completion suggestions. The file is still compiled after every insert command as part of my command block, which seems to account for the majority of the time the command is executing. |
Try using the |
you should use |
trying When calling call |
On second glance, it seems the vim help claims that
Which of course is the content of my register. |
This is kind of a hack but the command :let b:ycm_largefile should do the job. Use :unlet b:ycm_largefile` to revert it.
A |
Yeah, sorry. For me using those functions is the way to go. We put those there for compatibility with other plugins which would suffer for try to complete on every key stroke, so I think is appropriate. |
Okay, we're closer, but not there yet. with It's not presenting the popup suggestions, however, it's still compiling and updating the warnings and errors whenever I go between insert and normal mode as part of the command in my register. It's slightly faster though I think. When I try Suspecting that it should be |
My mistake. You need to set a value to the variable: :let b:ycm_largefile = 1 |
Yes! I believe that's done it! How do I go back? I tried |
You need to undefine the variable, that is:
|
Excellent. This does exactly what I want. Thanks very much for your help everyone! It would be good if this was mentioned somewhere in the Readme. |
What you're doing is just a hack using is an internal detail and not part of a public API, so mention it in the README is not a good idea, since we could change how we manage large files and that will not longer work as you expect. What seems strange to me is that even after |
Then perhaps I should reopen this issue and a more permanent solution On Wed, Oct 14, 2015 at 6:47 PM, Andrea Cedraro notifications@github.com
|
This is because |
If we want to support halting YCM, I think that all we need to do is return so all we need is: let s:halt_ycm = 0
function! youcompleteme#Halt()
call youcompleteme#DisableCursorMovedAutocommands()
let s:halt_ycm = 1
endfunction
function! youcompleteme#Resume()
call youcompleteme#EnableCursorMovedAutocommands()
let s:halt_ycm = 0
endfunction and add the check to if s:halt_ycm
return 0
endif The question here is if this is a valuable feature to implement and to support indefinitely. |
In all the use cases which I have personally wanted YCM to not run (for example, running something like |
@mispencer thanks for sharing your experience. I didn't thought of using |
Yes, through I normally use the |
My opinion on this is that we should keep things like they are and use |
Just weighing in on a slight tangent. I have long considered a |
@puremourning then how would you remember in which buffer you have YCM disabled? I see it like a flag in the statusline, but then I see that I'm overengeering this too much :P |
I'd know because when I type I'd be disappointed that YCM wasn't working |
@puremourning : Exactly, you don't really need to put it in the statusline |
@puremourning IMHO if we do it like that we would have different scenarios:
that is because disabling YCM in a singular buffer without a way to mark it IMHO is not a great experience. |
i mean we could have
Shrug. I think if I manually went to the trouble of disabling something I'd hope that I'd remember that I did so. But yeah, I'm not the sort to just raise a bug if I can't get sonething to work :) |
I'm having this issue with very large diffs opened by vim-fugitive. Browsing a commit, pressing "Enter" on a particular file will open the diff side-by-side. That is: you get two _new_ buffers with potentially large contents. What's more I don't think these buffers are backed by physical files, making the builting YCM protection for large files ineffective. This hangs up my vim for long periods of time (killed after 10 minutes) - seemingly even if the buffer contents is not a supported language by YCM. All the above suggestions that center on "disabling YCM for the current buffer" work, because they are new buffers. I've tried combining ideas above like
I suppose this is because Fugitive depends on autocommands to magically load the the diff if it detects the special filename. I have no solution for this, other than removing YCM from my vim runtime environment and restarting Vim. I'd be very much in favour for a GLOBAL |
@sehe for your particular use case what you can do is to set manually the autocmd BufReadPre fugitive:///* let b:ycm_largefile = 1 I know is a hack but until we figure out something valid is all I can provide... |
@vheon That's clever. Using the autocommands in our favour. Sadly, it doesn't work, I just tested it. I can interrupt the long running operation (after several minutes), but then YCM is stuck in an error state spewing error messages all the time, so I have to (Running without YCM has slowness for this large diff, but interrupting makes the fugitive buffer responsive and functional, showing that YCM /can/ cope) |
@Valloric make |
:YcmSuspend and :YcmResumecommand should be useful For some projects, I just want to turn off YCM. While in other prjs, keep it on. I would like to turn off/on in .vimrc in runtime. |
I can't see us working on this any time soon, unless someone from the community contributes a PR and tests. |
I've been finding lately, that when I have a command to format a bunch of lines of code, and that code involves a class of some sort, YouCompleteMe will attempt to recompile and present a list of suggestions after getting to the end of a pointer or what-have-you.
Unfortuantely, this greatly slows down vim.
We need a way to temporarily disable the autocompletion features while a large command block executes.
(for instance I'm often doing 200@z or something like it, and it takes a while with all the recompiles and suggestion boxes popping up.)
I looked, but didn't see anything which would help me in the documents.
The text was updated successfully, but these errors were encountered: