• Stars
    star
    355
  • Rank 118,984 (Top 3 %)
  • Language
    Emacs Lisp
  • Created almost 7 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fixed and automatic balanced window layout for Emacs

MELPA Stable MELPA

Zoom

This minor mode takes care of managing the window sizes by enforcing a fixed and automatic balanced layout where the currently selected window is resized according to zoom-size which can be an absolute value in lines/columns, a ratio between the selected window and frame size or even a custom callback.

Screencast

Installation

MELPA package

M-x package-install RET zoom

Local package

M-x package-install-file RET /path/to/zoom.el

Manual

(require 'zoom "/path/to/zoom.el")

Usage

Enable Zoom with M-x zoom-mode otherwise use M-x zoom to manually rearrange windows just once.

Load it automatically with:

(custom-set-variables
 '(zoom-mode t))

See the FAQ.

Example configurations

For a complete reference see M-x customize-group RET zoom.


Resize the selected window using the golden ratio:

(custom-set-variables
 '(zoom-size '(0.618 . 0.618)))

Resize the selected window according to the frame width, for example:

  • 90 columns and 75% of the frame height if the frame width is larger than 1024 pixels;
  • half the frame size otherwise.
(defun size-callback ()
  (cond ((> (frame-pixel-width) 1280) '(90 . 0.75))
        (t                            '(0.5 . 0.5))))

(custom-set-variables
 '(zoom-size 'size-callback))

Override the key binding of balance-windows:

(global-set-key (kbd "C-x +") 'zoom)

Prevent some windows from being resized, for example:

  • dired and markdown major modes;
  • zoom.el init.el buffer names;
  • calculator-related windows;
  • any buffer containing less than 20 lines.
(custom-set-variables
 '(zoom-ignored-major-modes '(dired-mode markdown-mode))
 '(zoom-ignored-buffer-names '("zoom.el" "init.el"))
 '(zoom-ignored-buffer-name-regexps '("^*calc"))
 '(zoom-ignore-predicates '((lambda () (> (count-lines (point-min) (point-max)) 20)))))

(Please note that ignored windows are not resized when selected but all the windows are nevertheless arranged with balance-windows.)

FAQ

What about golden-ratio.el?

I have been a more or less happy golden-ratio.el user for some time when I stared noticing some bugs and sadly I discovered that it is apparently a dead project now, so I decided to write a new and improved minor mode from scratch that implements the same basic idea of automatic window layout as my first attempt at Emacs mode development.

Why when there are several horizontal splits the completions buffer is very small?

This happens when zoom-minibuffer-preserve-layout is non-nil (the default) because most of the space is probably occupied by the zoomed window. The solution (apart from setting the aforementioned variable to nil) is to enable the temp-buffer-resize-mode minor mode:

(custom-set-variables
 '(temp-buffer-resize-mode t))

Why windows are resized even when they are ignored?

When a window is ignored it is simply not resized when the user selects it.

In order to maintain a stable layout, windows are always balanced, then the selected window, unless ignored, is zoomed according to the user preference.

This may cause weird layouts with windows that are designed to be small, e.g., imenu-list. Unfortunately there is no universal solution to this.

The workaround is to set window-size-fixed to t for the buffers whose window must preserve the current size, for example the following fixes the size of the imenu-list window to 30 columns:

(defun my/fix-imenu-size ()
  (with-selected-window (get-buffer-window "*Ilist*")
    (setq window-size-fixed t)
    (window-resize (selected-window) (- 30 (window-total-width)) t t)))

(add-hook 'imenu-list-update-hook 'my/fix-imenu-size)

More Repositories

1

gdb-dashboard

Modular visual interface for GDB in Python
Python
10,856
star
2

chrome-remote-interface

Chrome Debugging Protocol interface for Node.js
JavaScript
4,235
star
3

chrome-har-capturer

Capture HAR files from a Chrome instance
JavaScript
527
star
4

zizzania

Automated DeAuth attack
C
275
star
5

fracker

PHP function tracker
JavaScript
241
star
6

mysql-unsha1

Authenticate against a MySQL server without knowing the cleartext password
C
222
star
7

prof

Self-contained C/C++ profiler library for Linux
C
177
star
8

gdb

Go GDB/MI interface
Go
79
star
9

comb

Interactive code auditing and grep tool in Emacs Lisp
Emacs Lisp
74
star
10

httpfs

Remote FUSE filesystem via server-side script
C
61
star
11

gproxy

googleusercontent.com as HTTP(S) proxy
JavaScript
54
star
12

trace

Start or attach to a process and monitor a customizable set of metrics (CPU, I/O, etc.)
Shell
34
star
13

chrome-page-graph

Chrome extension to generate interactive page dependency graphs
JavaScript
32
star
14

xkeylogger

Rootless keylogger for X
C
32
star
15

signal-wont-let-me-attach

Store arbitrary files inside PNGs to overcome nonsensical file type restrictions
Python
30
star
16

iq

I/Q file analysis toolkit in R
R
25
star
17

ratty

Record and replay terminal sessions
JavaScript
10
star
18

httpool

Go HTTP wrapper for limited concurrency handlers
Go
9
star
19

cyrus-and.github.io

Personal website
SCSS
7
star
20

lorem

Lorem ipsum generator as a Linux kernel module
C
6
star
21

biscuit

Modular HTTP cookie parser
Python
5
star
22

stash

Shell I/O clipboard
Shell
5
star
23

dotfiles

Personal dotfiles
Emacs Lisp
5
star
24

signal-desktop-docker

Scaffold to run Signal Desktop in a Docker container and persist data
Dockerfile
4
star
25

playground

Disposable Docker sandbox for quick isolated testing with X support
Dockerfile
4
star
26

dry-makefile

Opinionated Makefile for simple C/C++ projects
Makefile
3
star
27

synchttp

Synchronous Node.js HTTP and WebSocket library for API testing, scripting or automation
JavaScript
2
star