0

I am looking to open a full path as fast as possible.Using ido-find-file makes it difficult. When I apply ido-find-file, following line show up.

Find file: ~/folder/work

Here I have a full path(ex: /home/user/folder_1/work/file.py) and I want to open it.

In helm-find-files I can do C-a , C-k and paste the full path and enter to open it. But in ido-find-file, C-a does not jump to beginning of the line. Also when I remove everything / at the beginning remains, so pasting full path causes: //home/user/folder_1/work/file.py

When I play around, I found out C-e opens [EDIT] section and I can do C-a, C-k and paste full line. Than enter does not open the file right away, it jumps to ido selection menu and I have to press enter again. Maybe can it open the file right away on the EDIT section.


enter image description here

RET

enter image description here

RET

2
  • Try additional C-f (open file with C-x C-f C-f), then C-a and C-k will work as usual.
    – Y. E.
    Sep 13 at 15:04
  • @Y.E. Thanks, it is excatly what I was looking for! Is it possible to make C-x C-f to run C-x C-f C-f?
    – alper
    Sep 13 at 18:47
1

I'm turning my own comment and answer to the follow-up question into this post.

ido-mode, among other things, remaps Emacs default key binding C-x C-f (M-x find-file) to its own function for files opening M-x ido-find-file.

With all the conveniences provided by ido-find-file, there're still cases when this function "gets in the way". One of such cases you had described.

To overcome such obstacles, ido-mode allows to fallback to the Emacs default (non-Ido) find-file, by hitting additional C-f. Hence, the full key binding for opening a file with find-file when ido-mode is enabled would be C-x C-f C-f.

Note, that you could achieve the same result by calling M-x find-file directly (without a key binding).

To learn more about the bindings for falling back (and other, as they call it, "magic" actions) in ido-mode see C-h f ido-magic-(forward|backward|delete)-char.

Answering your comment

Is it possible to make C-x C-f to run C-x C-f C-f?

supposedly it's more clear now this, kind of, wouldn't make sense with enabled ido-mode. I'd suggest using one of the methods described above or disabling ido-mode when you don't need it.

5
  • I am not sure why but on my end M-x find-file does not open the same fallback when I do C-x C-f C-f :-( // Please see my ido-setup: gist.github.com/avatar-lavventura/…
    – alper
    Sep 14 at 8:59
  • Hm, I don't know. Might be take a look at ido-everywhere and C-h f find-file. And then, if that shows nothing interesting, start with emacs -Q and add settings one by one. Let know if you find the cause ;-)
    – Y. E.
    Sep 14 at 10:09
  • Ah, and note there might be discrepancies in our experiences according to the Emacs version used. (I'm on the (almost) latest source.). In my setup I currently only configure for ido (setq ido-default-file-method 'selected-window ido-default-buffer-method 'selected-window). So starting debugging with the ido default configs might give some results too.
    – Y. E.
    Sep 14 at 10:17
  • We need to add (require 'ido) before (setq ido..., right?
    – alper
    Sep 14 at 13:19
  • Yes, sure, that would be a preferred way (I omitted it from the snippet I sent before). Though ido is a built-in package in the most recent Emacs versions, so, technically, it should be loaded even without explicitly requiring it (in those versions). We'd also need (ido-mode 1) to switch the mode on.
    – Y. E.
    Sep 15 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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