Closed daidodo closed 7 years ago
Thanks for the report. I can reproduce with this minimal vimrc:
set nocompatible
autocmd BufReadPre * call s:OnBufferReadPre()
function s:OnBufferReadPre()
endfunction
So it's not an issue with YCM but with the BufReadPre
autocommand. In fact, this bug is mentioned in the Vim todo list (:h todo
):
":pedit %" with a BufReadPre autocommand causes the cursor to move to the
first line. (Ingo Karkat, 2008 Jul 1) Ian Kelling is working on this.
Similar problem with ":e". (Marc Montu, 2014 Apr 22)
We could take care of it by dropping this autocommand and moving the s:OnBufferReadPre
logic in the s:OnBufferRead
function.
Issue Details
I'm new to YCM and trying to show
GoToDefinitionElseDeclaration
results in vim Preview window. But I found that when I enabled YCM plugin,:pedit
would reset bottom window's cursor position to the head of file no matter where it had been.Environment
OS:
Linux ubuntu 4.4.27-moby #1 SMP Wed Oct 26 14:21:29 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Vim 7.4:
Python:
.vimrc
:Steps to reproduce the problem
vim any.file
:1000<cr>
:ped
Now you should see that bottom window's cursor position is reset to the head of the file. If you comment
Plugin 'Valloric/YouCompleteMe'
in.vimrc
, the problem doesn't appear. So I believe this should be a bug from YCM.Addtion
I have also tested with the newest Vim 8.0, and the problem remains. Vim 8.0: