An attempt to port Kakoune's multiple selections into Emacs.
This package provides functions that simulate Kakoune's multiple selection commands.
It's built on top of evil-mc's multiple cursors and evil's functions.
The package's main functions:
|(Kakoune) -kak-exec-shell-command (command)(Emacs): execute a shell command using each cursor's region as the standard input and replace the region's content with the standard output.s/S(Kakoune) -kak-select (beg end invert)(Emacs): split/select a given region into multiple matching regions.invertdetermines whether the command should do a split (inver match).M-s(Kakoune) -kak-split-lines (beg end)(Emacs): split a given region into multiple lines. There will be a cursor each line.M-k/M-K(Kakoune) -kak-filter (keep)(Emacs): filter/keep all active cursors.keepdetermines whether the command should keep or remove the matching cursors.
kak-insert-index (base)insert an index after each cursor based on abaseindex and the cursor's position relative to other cursors.
To install using Doom Emacs's package! macro:
(package! kak
:recipe (:host github :repo "aome510/kak.el"))To use the package after installation
(use-package kak)An example mapping using Doom Emacs's map! macro:
(map!
:v "|" #'kak-exec-shell-command
:v "s" (lambda (beg end) (interactive "r") (kak-select beg end nil))
:v "S" (lambda (beg end) (interactive "r") (kak-select beg end t))
:v "M-s" #'kak-split-lines
:v "M-k" (lambda () (interactive) (kak-filter t))
:v "M-K" (lambda () (interactive) (kak-filter nil))
:v ". #" #'kak-insert-index)