edkolev/evil-lion
{ "createdAt": "2017-03-09T11:31:44Z", "defaultBranch": "master", "description": "Evil align operator", "fullName": "edkolev/evil-lion", "homepage": "", "language": "Emacs Lisp", "name": "evil-lion", "pushedAt": "2024-11-20T13:52:01Z", "stargazersCount": 136, "topics": [ "emacs" ], "updatedAt": "2025-11-17T16:35:48Z", "url": "https://github.com/edkolev/evil-lion"}
evil-lion
Section titled “evil-lion”This package provides gl and gL align operators: gl MOTION CHAR and right-align gL MOTION CHAR.
Use CHAR / to enter regular expression if a single character wouldn’t suffice.
Use CHAR RET to align with align.el’s default rules for the active major mode.
Port of vim-lion

Installation
Section titled “Installation”(use-package evil-lion :ensure t :config (evil-lion-mode))M-x package-install RET evil-lion RET, then add in init.el:
(evil-lion-mode)
Align with gl MOTION CHAR or right-align with gL MOTION CHAR.
If the align separator is / you will be prompted for a regular expression instead of a plain character.
If the align separator is RET alignment will be performed with align.el’s rules specific for the major mode.
You can pass count 1 to align on the first occurrence of CHAR. To pass count, use: COUNT gl MOTION CHAR.
Example, left align gl:
Section titled “Example, left align gl:”After pressing glip= (gl is the operator, ip text object paragraph, = separator)
one = 1three = 3fifteen = 15will become:
one = 1three = 3fifteen = 15Example, right align with gL:
Section titled “Example, right align with gL:”After pressing gLip,
one, two, three,fifteen, sixteen, seventeenwill become:
one, two, three,fifteen, sixteen, seventeenExample, align with major mode’s alignment rules:
Section titled “Example, align with major mode’s alignment rules:”In perl-mode, after pressing glib RET (RET is return key, not individal keys):
my %hash = ( a => 1, bbb => 2, cccc => 3,
a => 1, bbb => 2, cccccc => 3);will become:
my $hash = ( a => 1, bbb => 2, cccc => 3,
a => 1, bbb => 2, cccccc => 3););Example, align on the first occurrence of CHAR:
Section titled “Example, align on the first occurrence of CHAR:”After pressing 1glip"
(red "red"(teal-green "#6fb593")(wheat "#b9c791")(blue "blue")(cyan "#54b6b6")will become:
(red "red"(teal-green "#6fb593")(wheat "#b9c791")(blue "blue")(cyan "#54b6b6")Customization
Section titled “Customization”Disable squeezing of spaces
Section titled “Disable squeezing of spaces”By default, evil-lion will remove unnecessary spaces if there are any. To disable this behaviour:
(setq evil-lion-squeeze-spaces nil) ;; default tChange the default keys
Section titled “Change the default keys”;; use `g a` (mnemonic `align`);; these variables should be changed before (evil-lion-mode) is called(setq evil-lion-left-align-key (kbd "g a"))(setq evil-lion-right-align-key (kbd "g A"))(evil-lion-mode)Or withuse-package and bind-key:
(use-package evil-lion :ensure t :bind (:map evil-normal-state-map ("g l " . evil-lion-left) ("g L " . evil-lion-right) :map evil-visual-state-map ("g l " . evil-lion-left) ("g L " . evil-lion-right)))Bind in prog modes only
Section titled “Bind in prog modes only”Bind evil-lion-left and evil-lion-right to your liking.
The evil-lion-mode is just a convenience mode and should not be enabled with this setup.
(evil-define-key 'normal prog-mode-map (kbd "g l") 'evil-lion-left (kbd "g L") 'evil-lion-right)
(evil-define-key 'visual prog-mode-map (kbd "g l") 'evil-lion-left (kbd "g L") 'evil-lion-right)