ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.44k stars 2.81k forks source link

Cannot use backtick ('`') as a key completion #3386

Closed hyche closed 5 years ago

hyche commented 5 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Issue Details

I set up my ycm_key_list_select_completion like this

let g:ycm_key_list_select_completion = ['`', '<DOWN>']

When the completion window pop up, press ` doesn't move down the completion line. Work normally with other characters (tested with '#', '$', '~', etc)

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
Included patches: 1-1453
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               -perl              +vertsplit
-clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               -ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              +mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   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/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-NQEcoP/vim-8.0.1453=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl     -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_satrdchd.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.6.7
-- Server has Clang support compiled in: True
-- Clang version: clang version 8.0.0 (tags/RELEASE_800/final)
-- No extra configuration file found
-- Python completer debug information:
--   Python interpreter: /usr/bin/python3
--   Python path: ['/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/user/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/pyth
on3/dist-packages']
--   Python version: 3.6.7
--   Jedi version: 0.13.3
--   Parso version: 0.3.4
-- Server running at: http://127.0.0.1:47399
-- Server process ID: 14533
-- Server logfiles:
--   /tmp/ycmd_47399_stdout_u8tbzyzk.log
--   /tmp/ycmd_47399_stderr__b8yjt0q.log

Contents of YCM, ycmd and completion engine logfiles

OS version, distribution, etc.

Ubuntu 18.04

Output of build/install commands

bstaletic commented 5 years ago

With let g:ycm_key_list_select_completion = ['', '']` in your .vimrc, what's the output of the following lines:

verbose imap `
verbose imap <Down>
hyche commented 5 years ago

you mean let g:ycm_key_list_select_completion = ['`', ''] ? They both show No mapping found

bstaletic commented 5 years ago

Sorry, markdown formatting... let g:ycm_key_list_select_completion = ['`', '<Down>'] then try the verbose commands.

hyche commented 5 years ago

The result is still the same

No mapping found
No mapping found
micbou commented 5 years ago

This should return something like

i  `           * pumvisible() ? "\<C-N>" : "\`"
        Last set from ~\projects\YouCompleteMe\autoload\youcompleteme.vim line 291
i  <Down>      * pumvisible() ? "\<C-N>" : "\<Down>"
        Last set from ~\projects\YouCompleteMe\autoload\youcompleteme.vim line 291

Does it work if you manually set the mapping:

:inoremap <expr> ` pumvisible() ? "\<C-n>" : "\`"

?

hyche commented 5 years ago

:inoremap <expr> ` pumvisible() ? "\<C-n>" : "\`"

This works for me. But I still don't know setting via ycm_key_list_select_completion doesn't work, I even changed it to "\`".

micbou commented 5 years ago

What's the output of

:echo g:ycm_key_list_select_completion

?

hyche commented 5 years ago

This ['`', '<DOWN>']

micbou commented 5 years ago

Does it work with the following vimrc

set nocompatible

set rtp+=~/.vim/bundle/YouCompleteMe

filetype plugin indent on

let g:ycm_key_list_select_completion = ['`', '<DOWN>']

(replace ~/.vim/bundle/YouCompleteMe with the right path if YCM is installed somewhere else)? You can use a custom vimrc by starting Vim with the -u option:

vim -u /path/to/vimrc
hyche commented 5 years ago

Does it work with the following vimrc

Yes...

micbou commented 5 years ago

So it's probably an issue with your vimrc. Do you mind sharing its contents?

hyche commented 5 years ago

vimrc Here, there are lots of thing need to be cleaned up since I wrote it long time ago (actually copied from many places...).

micbou commented 5 years ago

Sorry, I don't see anything wrong in your vimrc. You'll have to figure it yourself.