2

Usually, in Vim, pressing <TAB> autocompletes a command. For example, typing

:set <TAB>

will autocomplete to :set all. Pressing <TAB> again will autocomplete to :set termcap.

However, on one specific Kubuntu 17.04 machine I own, pressing tab shows something like this: Gray bar with list of options and highlighted yellow selection.

How can I enable/disable this functionality in Vim? What is this feature called?

My vim --version is this:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 17 2017 12:13:35)
Included patches: 1-95
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
-clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        -perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            -ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   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-8krYYf/vim-8.0.0095=. -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl     -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm

My system vimrc is this (comments removed for brevity):

runtime! debian.vim
if has("syntax")
  syntax on
endif
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif

I don't have a user vimrc. As far as I know, this is the stock install of vim for Ubuntu 17.04 (sudo apt-get install vim) with no extra options or added plugins. It's possible that Ubuntu ships Vim with plugins.

2 Answers 2

3

It's the wildmenu setting that lists all the options. The wildmode setting can also affect the specific behavior of completion in command-line mode, including when the wildmenu will appear.

wildmenu requires that Vim was compiled with the +wildmenu option, which appears to be the case for the particular version text you've provided. wildmode does not appear to be dependent on any compilation flags, so there may be some builds of Vim that can do command-line completion, but cannot show the full menu.

You can use :verbose set wildmenu? to see where wildmenu was last set from.

1
  • Thank you some much for this! Looking for this ultra-cool feature was driving me crazy. This is my first question on Vi/Vim Stack Exchange. Jul 8, 2017 at 0:24
2

I think this is enabled by the wildmenu setting which is enabled in the defaults.vim file. So if you do not have a vimrc file, vim will automatically load the defaults.vim file, which sets some options to enable an easier Vim experience.

Read the help at :h defaults.vim for all the details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.