Skip to content

Instantly share code, notes, and snippets.

@amirrajan
Created February 18, 2023 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirrajan/d7c3679a42dd2bba71bfbfe6a1310e9e to your computer and use it in GitHub Desktop.
Save amirrajan/d7c3679a42dd2bba71bfbfe6a1310e9e to your computer and use it in GitHub Desktop.
Split buffers and zooming in on focus change

Demo

splits.mp4

Configuration

(defun amir-zoom-buffer ()
  (interactive)
  (progn
    (evil-window-set-width (frame-width))
    (evil-window-set-height (frame-height))
    (redraw-display)))

(defun amir-resize-equal ()
  (interactive)
  (balance-windows)
  (redraw-display))

(defun amir-resize-window-dwim ()
  (interactive)
  (let ((maximize (< (window-width) (/ (frame-width) 2))))
    (cond ((< (window-width) 80) (evil-window-set-width 80))
          (maximize
           (progn
             (evil-window-set-width (frame-width))
             (evil-window-set-height (frame-height))
             (redraw-display)))
          ((not maximize) (evil-window-set-width 80)))))

(defun amir-resize-window-vertical+ ()
  (interactive)
  (evil-window-set-height (+ (window-height) 10)))

(defun amir-resize-window-vertical- ()
  (interactive)
  (evil-window-set-height (- (window-height) 10)))

(defun amir-resize-window-horizontal+ ()
  (interactive)
  (evil-window-set-width (+ (window-width) 10)))

(defun amir-resize-window-horizontal- ()
  (interactive)
  (evil-window-set-width (- (window-width) 10)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment