YCMFindSymbolInWorkspace Ctrl-w not working in prompt buffer + UI suggestions
stonebrakert6 opened this issue · 3 comments
Issue Prelude
- [x ] I have read and understood YCM's [CONTRIBUTING][cont] document.
- [ x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
- [ x] I have read and understood YCM's [README][readme], especially the
[Frequently Asked Questions][faq] section. - [ ]x I have searched YCM's issue tracker to find issues similar to the one I'm
about to report and couldn't find an answer to my problem. ([Example Google
search.][search]) - If filing a bug report, I have included the output of
vim --version
. - If filing a bug report, I have included the output of
:YcmDebugInfo
. - If filing a bug report, I have attached the contents of the logfiles using
the:YcmToggleLogs
command. - If filing a bug report, I have included which OS (including specific OS
version) I am using. - If filing a bug report, I have included a minimal test case that reproduces
my issue, usingvim -Nu /path/to/YCM/vimrc_ycm_minimal
, including what I
expected to happen and what actually happened. - If filing a installation failure report, I have included the entire output
ofinstall.py
(orcmake
/make
/ninja
) including its invocation - I understand this is an open-source project staffed by volunteers and
that any help I receive is a selfless, heartfelt gift of their free time. I
know I am not entitled to anything and will be polite and courteous. - I understand my issue may be closed if it becomes obvious I didn't
actually perform all of these steps.
Issue Details
First of all thanks a lot for this plugin. I've been using it for years and this is the first time I am creating an issue. Thank you for all your work and patience.
I am using the mapping
au FileType c,cpp,python nnoremap <Leader>x <Plug>(YCMFindSymbolInWorkspace)
in my .vimrc
This opens a prompt buffer and puts me in insert mode of that prompt buffer when I press <Leader>x
There are 2 minor issues I have
- While I am in the insert mode, I expect
<Ctrl-w>
to work(It should delete a word)
You can check:h i_CTRL-W
. I know I can go into normal mode and delete the word and then come back into insert mode to add a new word but this is awkward. Consider an additional mapping I've
au FileType c,cpp,python nnoremap <Leader>c :let @"=expand('<cword>')<CR> <Plug>(YCMFindSymbolInWorkspace)<C-r>"
This directly searches for the word under the cursor in the Workspace(skipping the typing step) and occasionaly I've to delete the word and Ctrl-w
not working is certainly problematic for this workflow. So instead I've to use <Esc>bcw
- Second issue is about the UI. Due to my vim colorscheme, the selector line(to select the entries populated by
YCMFindSymbolInWorkspace
) is completely invisible and I am unable to decipher which entry is currently highlighted
I am attaching a screenshot. It may not be visible to you, but the entry highlighted is 5th/last one.
Now consider this screenshot which uses the fzf vim plugin
where I can clearly see the entry selected, because of the red > and bold white colors of selected line.
Both of these issues are non-existent with fzf but certainly YCMFindSymbolInWorkspace
is better for symbol search.
The ability to search for the symbol using YCMFindSymbolInWorkspace
is a great feature, but I am unable to use it because of these minor issues.
Even if you decide not to fix these, I would be grateful if you can help me with workarounds to fix this
References : PR-3859
CC: @puremourning who implemented this
- see :help prompt-buffer.
It says:
The CTRL-W key can be used to start a window command, such as CTRL-W w to
switch to the next window. This also works in Insert mode (use Shift-CTRL-W
to delete a word). When leaving the window Insert mode will be stopped. When
coming back to the prompt window Insert mode will be restored.
- the problem is the 'CursorLine' highlight in your colourscheme. I imagine you'd have the same issue if you
:set cursorline
in a normal buffer. Best to raise this with the author of your colourscheme. All YCM does isset cursorline
within the window displaying the popup buffer.
Thanks a lot @puremourning. Fixed 2 by using
hi CursorLine ctermbg=NONE ctermfg=NONE guibg=#303030 guifg=NONE cterm=bold gui=NONE
Regarding 1
Even though the documentation says that Shift-CTRL-W
would delete the word, it is not working for me
Tested on
- My linux machine
- Macbook pro laptop
- Tested with
vim -u NONE
and then:new | set buftype=prompt | startinsert
Ctrl-Shift-W just switches the window, which I believe is because of the fact that it behaves identically to Ctrl-W
This is not related to YouCompleteMe. Can someone just confirm this? Does it work for you? - I also tried a lot of things for a couple of hours, including insert mode keybindings using
inoremap
in that prompt-buffer but they don't seem to gel well with the implementation
Maybe I a missing something very basic. Would be grateful if someone could give a nudge in the right direction.
If someone can confirm that after setting buftype=prompt
in a buffer, Ctrl-Shift-w
doesn't delete the previous word in insert mode, then I would most likely file a bug report in vim.
Seems like it is not a vim bug but due to fact that I am using gnome terminal