3

How can I move a window from being a horizontal split down below all other windows to being a vertical split panel on the left? I don't want to move buffer contents - I want to move the actual window.

Drew
  • 77,472
  • 10
  • 114
  • 243
Martin
  • 143
  • 5
  • So I take it that something like evil-window-move-far-left isn't what you're looking for? Its docstring: "Closes the current window, splits the upper-left one vertically and redisplays the current buffer there." – eeowaa May 09 '19 at 17:09

1 Answers1

2

Emacswiki has a nice function for toggling horizontal to vertical split here

(defun toggle-window-split ()
  (interactive)
  (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
         (next-win-buffer (window-buffer (next-window)))
         (this-win-edges (window-edges (selected-window)))
         (next-win-edges (window-edges (next-window)))
         (this-win-2nd (not (and (<= (car this-win-edges)
                     (car next-win-edges))
                     (<= (cadr this-win-edges)
                     (cadr next-win-edges)))))
         (splitter
          (if (= (car this-win-edges)
             (car (window-edges (next-window))))
          'split-window-horizontally
        'split-window-vertically)))
    (delete-other-windows)
    (let ((first-win (selected-window)))
      (funcall splitter)
      (if this-win-2nd (other-window 1))
      (set-window-buffer (selected-window) this-win-buffer)
      (set-window-buffer (next-window) next-win-buffer)
      (select-window first-win)
      (if this-win-2nd (other-window 1))))))

In the emacswiki example the function is bind to C-x 4 map as t:

(define-key ctl-x-4-map "t" 'toggle-window-split)

There are a couple more implementations on that page you can try.

manandearth
  • 2,118
  • 1
  • 13
  • 23