• Stars
    star
    258
  • Rank 158,189 (Top 4 %)
  • Language
    Emacs Lisp
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kill & Mark Things Easily in Emacs

Kill & Mark Things Easily in Emacs

Travis CI build status

Provide commands easy-kill and easy-mark to let users kill or mark things easily.

Comments, bug reports and patches are highly appreciated.

easy-kill

easy-kill is a drop-in replacement for kill-ring-save. To Use:

(global-set-key [remap kill-ring-save] 'easy-kill)

After this configuration, M-w serves as both a command and a prefix key for other commands. M-w alone saves in the order of active region, url, email and finally current line (See easy-kill-try-things). As a prefix key:

  1. M-w w: save word at point
  2. M-w s: save sexp at point
  3. M-w l: save list at point (enclosing sexp)
  4. M-w d: save defun at point
  5. M-w D: save current defun name
  6. M-w f: save file at point
  7. M-w b: save buffer-file-name or default-directory. - changes the kill to the directory name, + to full name and 0 to basename.

The following keys modify the selection:

  1. @: append selection to previous kill and exit. For example, M-w d @ will append current function to last kill.
  2. C-w: kill selection and exit
  3. +, - and 1..9: expand/shrink selection
  4. 0 shrink the selection to the initial size i.e. before any expansion
  5. SPC: cycle through things in easy-kill-alist
  6. C-SPC: turn selection into an active region
  7. C-g: abort
  8. ?: help

For example, M-w w saves current word, repeat w to expand the kill to include the next word. 5 to include the next 5 words etc. The other commands also follow this pattern.

+/- does expanding/shrinking according to the thing selected. So for word the expansion is word-wise, for line line-wise, for list or sexp, list-wise.

list-wise expanding/shrinking work well in lispy modes (elisp, Common Lisp, Scheme, Clojure etc.), smie-based modes (Prolog, SML, Modula2, Shell, Ruby, Octave, CSS, SQL etc.), Org mode, Nxml mode and Js2 mode.

To copy the enclosing list in lispy modes, I used to do a lot of C-M-u C-M-SPC M-w. Now the key sequence is replaced by M-w l (save list at point) as shown in screenshot:

``M-w l``

easy-mark

easy-mark is similar to easy-kill but marks the region immediately. It can be a handy replacement for mark-sexp allowing +/- to do list-wise expanding/shrinking and marks the whole sexp even when in the middle of one.

(global-set-key [remap mark-sexp] 'easy-mark)

Install

easy-kill is part of GNU ELPA and is also available on MELPA.

Extensions

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.

NEWS

0.9.5

  1. [BREAKING] Emacs >= 25 required.
  2. [BREAKING] Remove deprecated format for easy-kill-alist.
  3. Include uuid in easy-kill-try-things and easy-mark-try-things.

0.9.4

  1. New user variable easy-kill-unhighlight-key.
  2. key D selects current defun name.
  3. Key SPC selects things in easy-kill-alist in turn.

0.9.3

  1. Key ? in easy-kill or easy-mark prints help info.
  2. M-w l can select the enclosing string.
  3. easy-mark learns exchanging point & mark.
  4. Key 0 now sets the selection to its initial size before any expansion.
  5. M-w l, M-w s and list-wise +/- now work in Org mode.

0.9.2

  1. - can move pass the first selection.
  2. +/- on sexp no longer change thing to list
  3. Mouse over the selection now shows description.
  4. Echo js2 node name.
  5. Append now uses sensible separator (customisable via easy-kill-alist).
  6. The format of easy-kill-alist has changed. The old (CHAR . THING) format is still supported but may be removed in future.

Bugs

https://github.com/leoliu/easy-kill/issues

More Repositories

1

ggtags

Emacs frontend to GNU Global source code tagging system.
Emacs Lisp
570
star
2

ack-el

Emacs Interface to Ack-like Tools
Emacs Lisp
60
star
3

play-sound-osx

Implement play-sound-internal on osx using aplay
Emacs Lisp
13
star
4

osascripts

Apple OSA scripts
Emacs Lisp
10
star
5

applescripts

AppleScript-based elisp packages
Emacs Lisp
10
star
6

pcmpl-git-el

Emacs pcomplete for git
Emacs Lisp
9
star
7

sokoban

Sokoban for GNU Emacs ported from XEmacs
Emacs Lisp
8
star
8

docsetutil-el

Use Cocoa/iOS documentations in emacs
Emacs Lisp
8
star
9

rebar.el

emacs wrapper for the erlang rebar tool - https://github.com/rebar/rebar
Emacs Lisp
7
star
10

repeatable.el

make repeatable commands
Emacs Lisp
5
star
11

python-el

Dave Love's python.el as was included in GNU Emacs
Emacs Lisp
5
star
12

pcmpl-tlmgr

Shell completion for tlmgr in emacs
Emacs Lisp
3
star
13

qrencode.el

A wrapper for command line tool qrencode
Emacs Lisp
3
star
14

sloc.el

Source lines of code for emacs
Emacs Lisp
3
star
15

bbdb-attach

Attach bbdb records as vCard, HTML, QR code image etc.
Emacs Lisp
3
star
16

register-jump.el

jump-to-register with preview
Emacs Lisp
3
star
17

caffeine.el

Control Caffeine from Emacs
Emacs Lisp
2
star
18

cal-china-plus

Easy insertion of Chinese dates
Emacs Lisp
2
star
19

osx-dictionary

use Mac OSX's builtin dictionary in emacs
Emacs Lisp
1
star
20

swipe.el

swipe sensibly in emacs
Emacs Lisp
1
star
21

texinfo-files

Some texinfo files
1
star
22

backup-diff

backup-diff command
Emacs Lisp
1
star
23

minibuffer-query

A powerful minibuffer query function
Emacs Lisp
1
star
24

emacs-process

Implement Emacs's primitive list-processes in elisp
Emacs Lisp
1
star
25

scratch.el

scratch buffers for emacs
Emacs Lisp
1
star
26

column-overflow.el

column overflow mode
Emacs Lisp
1
star
27

temp-buffer-browse

Temp Buffer Browse Mode for Emacs
Emacs Lisp
1
star
28

gtags-el

A personal modified gtags.el (originally from GNU Global)
Emacs Lisp
1
star