evil-insert-plus transforms the standard evil-mode insertion commands into operators.
In standard Vim/Evil, i and a are simple commands that act on the current cursor position. This package redefines them as evil operators, allowing you to combine them with the full power of Evil motions and text objects.
- Grammatical Insertion: Use patterns like
[prefix] i [motion](e.g., "Insert at start of paragraph"). - Visual Block Support: Intelligent line-counting ensures multi-line insertions (via Visual Block) work seamlessly.
- Motion Awareness: Automatically switches to line-insertion or character-insertion based on the motion type.
- Repeatability: Like delete and update operations, Repeat executing your insert and append commands.
- Minimal Dependencies: Requires only
evil.
use-package with Melpa
(use-package evil-insert-plus
:bind (:map evil-normal-state-map
("I" . evil-insert-plus)
("A" . evil-append-plus)
:map evil-visual-state-map
("I" . evil-insert-plus)
("A" . evil-append-plus)))If you have cloned the repo locally to ~/.emacs.d/lisp/evil-insert-plus, then
(add-to-list 'load-path "/path/to/evil-insert-plus")
(require 'evil-insert-plus)
;; Replace default I/A with operator versions in Normal and Visual states
(with-eval-after-load 'evil
(define-key evil-normal-state-map (kbd "I") 'evil-insert-plus)
(define-key evil-normal-state-map (kbd "A") 'evil-append-plus)
(define-key evil-visual-state-map (kbd "I") 'evil-insert-plus)
(define-key evil-visual-state-map (kbd "A") 'evil-append-plus))You may also use 'package-use' as showing below:
(use-package evil-insert-plus
:load-path "~/.emacs.d/lisp/evil-insert-plus"
:bind (:map evil-normal-state-map
("I" . evil-insert-plus)
("A" . evil-append-plus)
:map evil-visual-state-map
("I" . evil-insert-plus)
("A" . evil-append-plus)))By binding these operators to I and A, you retain standard Vim behavior through "double-tapping" while gaining the ability to target specific motions and text objects.
Because I and A are now operators, applying them to the current line (the default behavior of the original keys) is as simple as hitting the key twice or using line motions.
- Standard Logic:
I Iperforms the traditional "Insert at start of line." - Operator Logic:
I wperforms "Insert at start of current word."
| Key Sequence | Description |
|---|---|
I b |
Jump to the beginning of the current word and insert. |
A e |
Jump to the end of the current word and insert. |
A i W |
Jump to the end of the current WORD and insert. |
I i ( |
Jump to the inner start of the parentheses and insert. |
I i p |
Jump to the start of the paragraph and insert. |
A G |
Jump to the end of of the buffer and insert. |
A g n |
Insert to the end of the next evil-ex match. |
I g p |
Insert to the start of the previous evil-ex match. |
This package is particularly powerful in Visual Block mode (Ctrl-v).
When you have a block selected:
- Press
IorA. - Type your text.