When calling ido-find-file it's possible to type ~/ to replace the current working directory with your home directory automatically:

Find file: /etc/{...} # after typing ~/ becomes:
Find file: ~/{...}

How can I replicate this but for a custom directory such as user-emacs-directory and when pressing a key instead of inserting text in the minibuffer? For example:

Find file: /var/log/{...} # after pressing F6 becomes:
Find file: ~/.emacs.d/{...}

1 Answer 1


I was just about to make a blog post about this (I'll do it later anyway):

(defun oleh-ido-setup-hook ()
  (define-key ido-file-dir-completion-map "~"
    (lambda ()
      (ido-set-current-directory "~/")
      (setq ido-exit 'refresh)

(add-hook 'ido-setup-hook 'oleh-ido-setup-hook)

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.