James
James

Reputation: 1678

Emacs: open file in new window in vertical split

I'm new to Emacs.

When using Emacs to write text, I often have one window open in a frame.

When I want to open a second file in a new window within the frame, I want to vertically split the frame and open a new window at right (not split horizontally and open at bottom, etc.) How do I do that?

I know that C-x 3 opens a new vertically split buffer window at right, and C-x 4 f opens a file at bottom (a horizontal split). That's not what I'm looking for.

Upvotes: 11

Views: 6318

Answers (1)

Oliver Taylor
Oliver Taylor

Reputation: 208

There are a number of different ways to do this, but this works:

(defun find-file-other-window-vertically nil
  "Edit a file in another window, split vertically."
  (interactive)
  (let ((split-width-threshold 0)
        (split-height-threshold nil))
    (call-interactively 'find-file-other-window)))

Upvotes: 1

Related Questions