perfect-margin

Homepage: https://github.com/mpwang/perfect-margin

Author: Randall Wang

Updated:

Summary

Auto center windows, works with line numbers

Commentary

# Usage

Put perfect-margin under your Emacs load path, and add this to your init.el

(require 'perfect-margin)

Use `M-x perfect-margin-mode` to turn on/off perfect-margin.

To make it permanent add this to your init.el after require.

(perfect-margin-mode 1)

Note: when using together with minimap or linum/display-line-numbers,
make sure you place config for perfect-margin *AFTER* minimap and linum.

# Customization

Via `M-x customize-group` and enter perfect-margin.

Change `perfect-margin-visible-width` and `Apply and Save`. That's it.

*Or* you can change the visible window width by setup `perfect-margin-visible-width` on the init.el.

(setq perfect-margin-visible-width 128)

By default both left and right margins are set, enable this option to only set the left margin of windows.

(setq perfect-margin-only-set-left-margin t)

# Additional binding on margin area

You can place this in your init.el to make mouse wheel scroll on margin area just like it scroll on the visible window.

(dolist (margin '(" " " "))
  (global-set-key (kbd (concat margin "")) 'ignore)
  (global-set-key (kbd (concat margin "")) 'ignore)
  (dolist (multiple '("" "double-" "triple-"))
    (global-set-key (kbd (concat margin "<" multiple "wheel-up>")) 'mwheel-scroll)
    (global-set-key (kbd (concat margin "<" multiple "wheel-down>")) 'mwheel-scroll)))

Dependencies