Spacemacs cannot create a new file when a file with a similar name exists in the same directory

110 Views Asked by At

In spacemacs, a user can normally create a file using 'Ctrl-x Ctrl-f', and then entering a filename in the minibuffer.

However, if a file with a similar name exists, then spacemacs does not create a new file. It opens the existing file instead.

One workaround is to jump to a terminal and create the new file, then return to spacemacs and open that file.

But this interferes with the workflow.

This isn't how an editor should work, and I can't see how it isn't a bug. This behaviour does not exist in normal emacs.

Is there a way to disable this behaviour?

1

There are 1 best solutions below

0
eMMe On

It's not a bug... it's a feature of ivy completion. It happens when the file name is a prefix of an existing name, for example if you try to open a new file foo in a directory containing an existing file foobar. You can choose the current input (foo) instead of the current candidate (foobar) with C-M-j, see: https://elpa.gnu.org/devel/doc/ivy.html#Key-bindings-for-single-selection-action-then-exit-minibuffer