39

I want to have two Emacs windows on the screen: one for Dired and one for code. But when I click on a file in the Dired buffer the file opens in the the same window, in place of the Dired buffer. Can I change this behaviour?

Drew
  • 29,895
  • 7
  • 74
  • 104
ceth
  • 44,198
  • 62
  • 180
  • 289

2 Answers2

77

Why are you clicking on things with a mouse? I thought you're using Emacs?

Move point to the line you're interested in and press o to open it in another window or C-o to open the file but stay on Dired buffer.

If you must do it with the mouse, use middle-click to do the same thing.

semente
  • 7,265
  • 3
  • 34
  • 35
event_jr
  • 17,467
  • 4
  • 47
  • 62
  • `C-o` didn't work for me, but I think this was supposed to trigger `dired-display-file`. `o` is `dired-find-file-other-window`. – Felipe Cortez Aug 08 '22 at 01:15
2

S-Return works for me in spacemacs if anyone is interested.

dired-find-file-other-window is an interactive compiled Lisp function in
`dired.el'.

It is bound to <S-return>, g O, <normal-state> <S-return>, <normal-state> g O,
<menu-bar> <immediate> <find-file-other-window>.

(dired-find-file-other-window)

For more information check the manuals.

In Dired, visit this file or directory in another window.

[back]