YouCompleteMe
YouCompleteMe copied to clipboard
[Feature request]: API/mapping to manually trigger completions
Issue Prelude
Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:
- [x] I have read and understood YCM's CONTRIBUTING document.
- [x] I have read and understood YCM's CODE_OF_CONDUCT document.
- [x] I have read and understood YCM's README, especially the Frequently Asked Questions 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.)
- [x] If filing a bug report, I have included the output of
vim --version. - [x] If filing a bug report, I have included the output of
:YcmDebugInfo. - [x] If filing a bug report, I have attached the contents of the logfiles using
the
:YcmToggleLogscommand. - [x] If filing a bug report, I have included which OS (including specific OS version) I am using.
- [x] If filing a bug report, I have included a minimal test case that reproduces
my issue, using
vim -Nu /path/to/YCM/vimrc_ycm_minimal, including what I expected to happen and what actually happened. - [x] If filing a installation failure report, I have included the entire output
of
install.py(orcmake/make/ninja) including its invocation - [x] 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.
- [x] I understand my issue may be closed if it becomes obvious I didn't actually perform all of these steps.
Thank 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
Is there a way YCM shows suggestions only if I press tab and not as I type. I have searched and tried a bunch of things but can't seem to find it.
Output of vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 3 2021 07:02:32)
Included patches: 1-2562
Compiled by nikhil.mundra@nikhil-mundra
Huge version without GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 +perl +title
-clientserver +job +persistent_undo -toolbar
-clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall +python +visual
+conceal +linebreak -python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape +lua +ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
-dnd +mouse -sound -xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval -mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -std=gnu99 -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -std=gnu99 -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -ldl -L/usr/lib -llua -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE -fstack-protector -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -L/usr/lib64/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib64
Not currently, but you can try the following diff:
diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim
index cf3f3f41..dfab8c0e 100644
--- a/autoload/youcompleteme.vim
+++ b/autoload/youcompleteme.vim
@@ -855,7 +855,7 @@ function! s:OnTextChangedInsertMode( popup_is_visible )
\ ( g:ycm_auto_trigger || s:force_semantic ) &&
\ !s:InsideCommentOrStringAndShouldStop() &&
\ !s:OnBlankLine()
- " The call to s:Complete here is necessary, to minimize flicker when we
+ " The call to youcompleteme#Complete here is necessary, to minimize flicker when we
" close the pum on every keypress. In that case, we try to quickly show it
" again with whatver the latest completion result is. When using complete(),
" we don't need to do this, as we only close the pum when there are no
@@ -864,7 +864,7 @@ function! s:OnTextChangedInsertMode( popup_is_visible )
" keys to filter (that are not a prefix of the completion), then deleting a
" character. Normally Vim would re-filter based on the new "query", but we
" don't want that.
- call s:Complete()
+ call youcompleteme#Complete()
call s:RequestCompletion()
call s:UpdateSignatureHelp()
@@ -1030,7 +1030,7 @@ function! s:PollCompletion( ... )
endif
let s:completion = py3eval( 'ycm_state.GetCompletionResponse()' )
- call s:Complete()
+ call youcompleteme#Complete()
endfunction
@@ -1106,7 +1106,7 @@ function! s:PollSignatureHelp( ... )
call s:UpdateSignatureHelp()
endfunction
-function! s:Complete()
+function! youcompleteme#Complete()
" It's possible for us to be called (by our timer) when we're not _strictly_
" in insert mode. This can happen when mode is temporarily switched, e.g.
" due to Ctrl-r or Ctrl-o or a timer or something. If we're not in insert
Then:
- Set
g:ycm_min_num_of_chars_for_completionto 99999999999999999 - Map
<Tab>tocall youcompleteme#Complete()in insert mode.
I’d be happy to add this api. When we stopped using completefunc we sort of regressed this capability.
Yeah, it would be good to have this functionality for those who don't want suggestions all the time.
@puremourning s/s:Complete/youcompleteme#Complete/ is simple enough. Do we also want some <Plug> map?
Yeah plug map would be good.
Like I said, my approach didn't work, because it doesn't actually send the completion request. It just checks if a response arrived.
Thumbing up this issue. I don't get why the fact that we don't have to press a shortcut to get completions is listed on main page as an advantage. It's advantage in the sense that it's not mandatory, but we still have to have an ability to set up keybinding for completion activation.
please can you try PR #4097 ?