Completion styles and TAB completion
The bindings of the minibuffer-local-completion-map are not available in Vertico by default. This means that ‘TAB’ works differently from what you may expect from shells like Bash or the default Emacs completion system. In Vertico ‘TAB’ inserts the currently selected candidate.
If you prefer to have the default completion commands available you can add new bindings or even replace the Vertico bindings. For example you can use ‘M-TAB’ to expand the prefix of candidates (TAB completion) or cycle between candidates if completion-cycle-threshold is non-nil, with the following configuration.
;; Option 1: Additional bindings
(keymap-set vertico-map "M-?" #'minibuffer-completion-help)
(keymap-set vertico-map "M-RET" #'minibuffer-force-complete-and-exit)
(keymap-set vertico-map "M-TAB" #'minibuffer-complete)
;; Option 2: Replace `vertico-insert' to enable TAB prefix expansion.
;; (keymap-set vertico-map "TAB" #'minibuffer-complete)The command minibuffer-complete performs prefix expansion for the basic completion style, while the orderless and substring completion styles expand to the longest candidate substring. Alternatively you can use completion-styles like partial-completion, flex or initials, which perform different expansion and filtering. The partial-completion style is important if you want to open multiple files at once with find-file using wildcards. In order to open multiple files with a wildcard at once, you have to submit the prompt with ‘M-RET’. Alternative first move to the prompt and then press ‘RET’.
(setq completion-styles '(basic substring partial-completion flex))Because Vertico is fully compatible with Emacs default completion system, further customization of completion behavior can be achieved by setting the designated Emacs variables. For example, one may wish to disable case-sensitivity for file and buffer matching when built-in completion styles are used:
(setq read-file-name-completion-ignore-case t
read-buffer-completion-ignore-case t
completion-ignore-case t)