All Projects → mpwang → Perfect Margin

mpwang / Perfect Margin

[emacs] auto center emacs windows, work with minimap and/or linum-mode

Projects that are alternatives of or similar to Perfect Margin

Elpa
Emacs China ELPA 镜像
Stars: ✭ 137 (+426.92%)
Mutual labels:  emacs, emacs-packages
Super Save
Save Emacs buffers when they lose focus
Stars: ✭ 184 (+607.69%)
Mutual labels:  emacs, emacs-packages
Borg
Assimilate Emacs packages as Git submodules
Stars: ✭ 145 (+457.69%)
Mutual labels:  emacs, emacs-packages
Org Pandoc Import
Save yourself from non-org formats, thanks to pandoc
Stars: ✭ 111 (+326.92%)
Mutual labels:  emacs, emacs-packages
Uncledavesemacs
My personal ~/.emacs.d
Stars: ✭ 204 (+684.62%)
Mutual labels:  emacs, emacs-packages
Emacs Solaire Mode
If only certain buffers could be so grossly incandescent.
Stars: ✭ 129 (+396.15%)
Mutual labels:  emacs, emacs-packages
Emacs Vdiff
Like vimdiff for Emacs
Stars: ✭ 165 (+534.62%)
Mutual labels:  emacs, emacs-packages
Org Msg
OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
Stars: ✭ 153 (+488.46%)
Mutual labels:  emacs, emacs-packages
Smart Mode Line
A powerful and beautiful mode-line for Emacs.
Stars: ✭ 809 (+3011.54%)
Mutual labels:  emacs, emacs-packages
Evil Multiedit
Multiple cursors for evil-mode, based on iedit
Stars: ✭ 200 (+669.23%)
Mutual labels:  emacs, emacs-packages
Emacs Which Key
Emacs package that displays available keybindings in popup
Stars: ✭ 1,136 (+4269.23%)
Mutual labels:  emacs, emacs-packages
Frontmacs
Package-based, web-centric, customizable, awesome-by-default, acceptance-tested Emacs distribution
Stars: ✭ 445 (+1611.54%)
Mutual labels:  emacs, emacs-packages
Emacs.g
The Emacs Collective
Stars: ✭ 51 (+96.15%)
Mutual labels:  emacs, emacs-packages
Emacs Gdscript Mode
An Emacs package to get GDScript support and syntax highlighting.
Stars: ✭ 132 (+407.69%)
Mutual labels:  emacs, emacs-packages
Evil Snipe
2-char searching ala vim-sneak & vim-seek, for evil-mode
Stars: ✭ 196 (+653.85%)
Mutual labels:  emacs, emacs-packages
Academic Phrases
Bypass that mental block when writing your papers.
Stars: ✭ 244 (+838.46%)
Mutual labels:  emacs, emacs-packages
God Mode
Minor mode for God-like command entering
Stars: ✭ 570 (+2092.31%)
Mutual labels:  emacs, emacs-packages
Awesome Emacs
A community driven list of useful Emacs packages, libraries and others.
Stars: ✭ 6,732 (+25792.31%)
Mutual labels:  emacs
Yasnippet Snippets
a collection of yasnippet snippets for many languages
Stars: ✭ 831 (+3096.15%)
Mutual labels:  emacs
Sly
Sylvester the Cat's Common Lisp IDE
Stars: ✭ 766 (+2846.15%)
Mutual labels:  emacs

perfect-margin

Perfect-margin is a global minor mode to auto center windows, work with minimap and/or linum-mode.

A picture is more than one thousand words, here is how it looks like with minimap and linum-mode.

perfect-margin

theme: doom-dracula from beautiful doom-themes

minimap from MELPA

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)

Important Note

when using together with minimap or linum, 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)

Customize what window to ignore setting margins

perfect-margin by default ignore setting margins for minibuffer window and any window whos name starts with "*". Many of them are for special purpose.

You can change this behavior by setting perfect-margin-ignore-regexps and perfect-margin-ignore-filters.

(defcustom perfect-margin-ignore-regexps
  '("^minibuf" "^[*]")
  "List of strings to determine if window is ignored.
Each string is used as regular expression to match the window buffer name."
  :group 'perfect-margin)

(defcustom perfect-margin-ignore-filters
  '(window-minibuffer-p)
  "List of functions to determine if window is ignored.
Each function is called with window as its sole arguemnt, returning a non-nil value indicate to ignore the window."
  :group 'perfect-margin)

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 '("<left-margin> " "<right-margin> "))
  (global-set-key (kbd (concat margin "<mouse-1>")) 'ignore)
  (global-set-key (kbd (concat margin "<mouse-3>")) '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)))

for use-package user

(use-package perfect-margin
  :custom
  (perfect-margin-visible-width 128)
  :config
  ;; enable perfect-mode
  (perfect-margin-mode t)
  
  ;; add additinal bding on margin area
  (dolist (margin '("<left-margin> " "<right-margin> "))
  (global-set-key (kbd (concat margin "<mouse-1>")) 'ignore)
  (global-set-key (kbd (concat margin "<mouse-3>")) '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))))

Emacs Rocks and happy hacking!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].