Provide commands (easy-kill
, easy-mark
etc.) to let users kill
or mark things easily.
easy-kill
is a drop-in replacement for kill-ring-save
. It
saves something to kill-ring
in this order:
- current region if active
- url at point (snarf char properties
help-echo
,shr-url
,w3m-href-anchor
etc.) - email at point
- current line
Immediately following easy-kill
, the follow keys are temporarily
active:
w
-> word at points
-> sexp at pointf
-> file at pointl
-> list at pointd
-> defun at pointD
-> defun-name; works even when in a diff hunkb
->buffer-file-name
ordefault-directory
@
-> append selection to previous killC-w
-> kill selection+
,-
and0..9
-> expand/shrink selectionC-SPC
-> turn selection into an active regionC-g
-> abort
Any other keys exit the temporary keymap and automatically save
selection to the kill-ring
. See M-w l
(save list at point to
the kill ring) in action in screenshot:
easy-mark
is similar to easy-kill
but marks the region
immediately.
easy-mark-sexp
can be a handy replacement for mark-sexp
, which
allows +,=/- to do list-wise expanding/shrinking and marks the
whole sexp even when in the middle of one.
easy-kill
is available on MELPA.
(require 'easy-kill) (global-set-key [remap kill-ring-save] 'easy-kill) (global-set-key [remap mark-sexp] 'easy-mark-sexp)
New things can be defined by following package thingatpt.el
's
convention, or by defining new functions named like
easy-kill-on-THING-NAME
. See easy-kill-on-buffer-file-name
and
easy-kill-on-url
for examples.