1

I am using Windows 10 and Emacs 26.1.

Suppose I open some file:

Enter image description here

And now I want fast open dired mode. The result must be like this:

Enter image description here

I want to do this by ONE hotkey direct from a buffer. E.g. C-x j. Is it possible?

a_subscriber
  • 3,854
  • 1
  • 17
  • 47

1 Answers1

6

You can use dired-jump from the builtin dired-x.el. I have it bound to C-x C-j, you can setup your own key binding.

C-x C-j runs the command dired-jump (found in global-map), which is an interactive autoloaded compiled Lisp function in dired-x.el.

It is bound to C-x C-j.

(dired-jump &optional OTHER-WINDOW FILE-NAME)

Jump to Dired buffer corresponding to current buffer. If in a file, Dired the current directory and move to file's line. If in Dired already, pop up a level and goto old directory's line. In case the proper Dired file line cannot be found, refresh the dired buffer and try again. When OTHER-WINDOW is non-nil, jump to Dired buffer in other window. When FILE-NAME is non-nil, jump to its line in Dired. Interactively with prefix argument, read FILE-NAME.

xuchunyang
  • 14,302
  • 1
  • 18
  • 39
  • Yes, this is the answer. But presumably the OP already knows about `dired-jump`, as he posted [this question](https://emacs.stackexchange.com/q/44498/105) about it a couple weeks ago. – Drew Sep 22 '18 at 18:53