emacs create new file with ido enabled
Asked Answered
H

5

114

I reciently switched to emacs starter kit which includes the ido package.

ido has a nice feature that suggests paths when find-file which is usually very handy except when trying to create a new file. When the new file name matches a suggestion in another path ido automatically switches to that path assuming that's what I wanted, but usually its not and I find it annoying.

To workaround the issue I either touch newfile from shell, create a new buffer and save as, or M-x find-file to get the original behavior. I could of course rebind C-x C-f to find-file again but must of the time I like ido-find-file, I just want it to stop automatically switching paths when I type the path explicitly.

I figure there is probably some simple key I can press during ido-find-file to tell it that the file I'm looking for does not exist and to stop making suggestions, or some var I can set to get more desirable behavior?

Headwater answered 28/2, 2011 at 4:13 Comment(2)
Duplicate: #813024Rimbaud
See also #7480065Insomuch
S
153

Try:

C-x C-f C-f

It should kick you out of ido mode into "normal" find file mode

Spear answered 28/2, 2011 at 4:32 Comment(2)
For other commands/in general (e.g. C-x C-w), C-x C-f will go to the "normal" version of the command.Droll
This is the way to go (C-x C-f C-f) with C-j you have to be very quick and it often happens that another suggestion will have time to creep in and make a suggestion you do not want;)Prong
N
55

C-j is the key combination you are seeking.

Nekton answered 28/2, 2011 at 4:18 Comment(2)
C-j appears to immediately create new file with currently typed path. This skips the [Confirm] which is useful, but if ido detects a file with same name detected in another recently used path ido switches automatically so C-j opens the suggested path.Headwater
Cool, this is actually what I wanted.Selfacting
M
30

As mentioned: being fast, using C-j to confirm immediately, and using and additional C-f to temporarily switch to the traditional mode are all useful.

Also, when ido has already selected an alternate file path, you can hit C-z to return where you were and temporarily disable that behavior.

Myocardiograph answered 11/3, 2011 at 21:3 Comment(0)
E
2

A solution for a related problem - ido not asking overwrite confirmation.

http://lists.gnu.org/archive/html/bug-gnu-emacs/2010-11/msg00226.html

Elburt answered 31/12, 2011 at 12:21 Comment(0)
H
0

On Fido, M-j does the trick. It's bound to icomplete-fido-exit by default.

Hola answered 16/12, 2022 at 12:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.