Dired rename file without autosuggestion

What happened?

The autosuggestion gets in the way of the command M-x dired-do-rename when renaming with a very similar name.

What did you expect to happen?

I’d like a way to ignore any name suggestion

Steps to reproduce

To reproduce:

  • touch rfc2229a.org
  • open doom in current dir
  • M-x dired-do-rename and try to rename rfc2229a.org into rfc2229.org

The current name rfc2229a.org is suggested and autoselected, cannot deselect it.

System information


Loading data dump...

I used to have the same problem as yours so I decided to write a function:


;;;###autoload
(defun my-dired-do-rename (&optional arg)
  "Rename/move the file at point with itself as the initial input.
Doesn't include other regular file names while `completing-read'."
  (interactive "P")
  (let* ((old-file (directory-file-name (dired-file-name-at-point)))
           (new-file
            (read-directory-name "Rename or move to: "
                                 nil nil nil
                                 (file-name-nondirectory old-file))))
      (dired-rename-file old-file new-file nil)))

(define-key dired-mode-map (kbd "r") #'my-dired-do-rename)

Alternatively, you can wrap dired-do-rename around an advice that disables vertico-mode, but that will give up the ability to easily choose another directory to move to.

If I’m understanding you correctly, C-k or C-p (i.e. move up) should solve this as it selects the text you’ve written verbatim.

4 Likes

thanks but now I feel so dumb :joy:

@daanturo: thanks for the suggestion either way!

2 Likes

Or just use M-RET / vertico-exit-input.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.