Open Aster89 opened 1 year ago
The reason for this is fairly obvious, if you remove most of your customisations and make it actually minimal.
When you do "YcmCompleter GoToSymbol find", YCM opens the quick fix window to fill the screen:
Your auto command, invoked after the quick fix window is opened, then shrinks it.
One solution is to to set b:ycm_no_resize
to 1 in the quick fix buffer using an autocmd, which prevents the initial auto-sizing of the quickfix/location list window. Its purpose is to do exactly what you want, which is allow your autocommand/quickfixheight settings to specify the quick fix height. I added this for my VerticalQuickFix plugin
So this will work for you:
augroup DisableYcmResizeInQuickFix
au!
autocmd FileType qf let b:ycm_no_resize=1
augroup END
Admittedly, that's a) undocumented and b) super fiddly, but hopefully it's enough for now.
We may be able to do something clever with winsaveview()
and winrestview()
but that will require some careful testing and investigation.
I don't see b:ycm_no_resize
in the YCM doc. Is that the thing you say is undocumented?
I don't see
b:ycm_no_resize
in the YCM doc. Is that the thing you say is undocumented?
Yes
Sorry to come back to this, but I think the main problem is that I have set noequalalways
in my vimrc. I like to have it, but I see that it affects what happens when the quickfix in question is closed. Do you have any suggestions?
In any case, even with the following vimrc, after closing GoToSymbol
's quickfix window, the original layout is not recovered, as the console which occupied only a few lines now occupies half of the space.
let maplocalleader = "\<Backspace>"
let mapleader = "\<Space>"
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
au VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'Valloric/YouCompleteMe'
Plug 'puremourning/vimspector'
call plug#end()
syntax enable " move this somewhere more appropriate
nnoremap <leader>ygs :YcmCompleter GoToSymbol<Space>
let g:vimspector_toggle_disables_breakpoint = 1
let g:vimspector_base_dir = environ().HOME .. '/.vim/plugged/vimspector'
nnoremap <leader>ds :call vimspector#Launch()<CR>
nnoremap <leader>dq :VimspectorReset<CR>
nmap <leader>dS <Plug>VimspectorStop
nmap <leader>dr <Plug>VimspectorRestart
nmap <leader>db <Plug>VimspectorToggleBreakpoint
augroup DisableYcmResizeInQuickFix
au!
autocmd FileType qf let b:ycm_no_resize=1
augroup END
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
inside the brackets) before filing your issue:vim --version
.:YcmDebugInfo
.:YcmToggleLogs
command.vim -Nu /path/to/YCM/vimrc_ycm_minimal
, including what I expected to happen and what actually happened.install.py
(orcmake
/make
/ninja
) including its invocationThank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.
Issue Details
vim -Nu /path/to/YCM/ycm_vimrc_minimal someNewFile.cpp
where the content of the file is below (yeah, the file is not new, ahah):tabe minimalVimrc.vim
, where the content of this file is below:so %
:YcmCompleter GoToSymbol find
:set noequalalways
Resizing more friendly towards existing windows layout
Windows are messed up.
See screencast:
Diagnostic data
Output of
vim --version
Output of
YcmDebugInfo
Output of
YcmDiags
Output of
git rev-parse HEAD
in YouCompleteMe installation directoryContents of YCM, ycmd and completion engine logfiles
OS version, distribution, etc.
Up-to-date ArchLinux
Output of build/install commands