Skip to content
/ kak.el Public

An attempt to port Kakoune's multiple selections into Emacs

License

Notifications You must be signed in to change notification settings

aome510/kak.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kak.el

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.

Functions

The package's main functions:

Visual mode only 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. invert determines 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. keep determines whether the command should keep or remove the matching cursors.

Normal/Visual mode functions

  • kak-insert-index (base) insert an index after each cursor based on a base index and the cursor's position relative to other cursors.

Demo

demo

Usage

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)

About

An attempt to port Kakoune's multiple selections into Emacs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published