0

I am using find-file with vertico. After running find-file and typing filename and when I press <TAB> it selects the current line.

TAB runs the command vertico-insert (found in vertico-map), which is an
interactive byte-compiled Lisp function in ‘vertico.el’.

It is bound to TAB.

(vertico-insert)

enter image description here

Instead, is it possible to bing <TAB> as to toggle inside the list of find filenames?

Drew
  • 75,699
  • 9
  • 109
  • 225
alper
  • 1,238
  • 11
  • 30

2 Answers2

1

Try TAB instead of <tab> and it will work.

(define-key vertico-map (kbd "TAB") 'vertico-next)

Since TAB (not <tab>) is used in the source (defvar-keymap vertico-map ...), this should overwrite it correctly. I just learned for the first time that TAB and <tab> are different things...

  1. <tab> = Tab (GUI only)

  2. TAB = C-i = Tab (Terminal, or GUI if <tab> is not set)

They say it's for historical reasons, see StreakyCobra's comment (referred by another questioner @Håkon Hægland on this site: What is the difference between TAB and <tab>?)

roomworoof
  • 394
  • 2
  • 9
1

If you don't want to go back to the prompt line by setting vertico-cycle, define another function like this:

(defun my-vertico-next (&optional n)
  "Circulate without returning to the prompt line"
  (interactive "p")
  (let ((index (+ vertico--index (or n 1))))
    (vertico--goto
     (if (= vertico--total 0) -1 (mod index vertico--total)))))

(define-key vertico-map (kbd "TAB") 'my-vertico-next)
roomworoof
  • 394
  • 2
  • 9