I run into this issue from time to time when I want to create a new file but the new name matches a pattern already so my Ivy auto-complete setup will pick the matched option when I press Enter instead of just directly using the text I have entered and I am wondering if there is a solution for this that allows me to use what I have typed rather than the Ivy selected complete option.

See this example:

I have a directory with a file in it called file.txt. Now I want to make a new file that is just called file. So, C-f, then type file, but now Ivy has selected file.txt and I can't just create file this way by pressing enter.

enter image description here

Similarly, suppose I wanted to rename file.txt to file in Dired. I have exactly the same problem:

enter image description here

1 Answer 1


C-M-j (ivy-immediate-done) - exit with the current action, calling it on the current input instead of the current candidate. This is useful especially when creating new files or directories - often the input will match an existing file, which you don’t want to select.

source: https://github.com/abo-abo/swiper/blob/f0b2bc618a84d25c0b3d05314d5d5693c27b2d3e/doc/ivy-help.org#key-bindings-for-single-selection

  • 1
    Crazy key binding (( I which they had better defaults.
    – gavenkoa
    Commented Sep 30, 2020 at 10:25

Your Answer

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

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