]> code.delx.au - gnu-emacs-elpa/blob - packages/easy-kill/README.rst
ef660aa3ec8177064468b00e1a6ec39a975dcc10
[gnu-emacs-elpa] / packages / easy-kill / README.rst
1 ====================================
2 Kill & Mark Things Easily in Emacs
3 ====================================
4
5 Provide commands ``easy-kill`` and ``easy-mark`` to let users kill or
6 mark things easily.
7
8 Comments, bug reports and patches are highly appreciated.
9
10 easy-kill
11 ~~~~~~~~~
12
13 ``easy-kill`` is a drop-in replacement for ``kill-ring-save``. To Use:
14 ::
15
16 (global-set-key [remap kill-ring-save] 'easy-kill)
17
18 After this configuration, ``M-w`` serves as both a command and a
19 prefix key for other commands. ``M-w`` alone saves in the order of
20 active region, url, email and finally current line (See
21 ``easy-kill-try-things``). As a prefix key:
22
23 #. ``M-w w``: save word at point
24 #. ``M-w s``: save sexp at point
25 #. ``M-w l``: save list at point (enclosing sexp)
26 #. ``M-w d``: save defun at point
27 #. ``M-w f``: save file at point
28 #. ``M-w b``: save ``buffer-file-name`` or ``default-directory``.
29 ``-`` changes the kill to the directory name, ``+`` to full name
30 and ``0`` to basename.
31
32 The following keys modify the selection:
33
34 #. ``@``: append selection to previous kill and exit. For example,
35 ``M-w d @`` will append current function to last kill.
36 #. ``C-w``: kill selection and exit
37 #. ``+``, ``-`` and ``0..9``: expand/shrink selection
38 #. ``C-SPC``: turn selection into an active region
39 #. ``C-g``: abort
40
41 For example, ``M-w w`` saves current word, repeat ``w`` to expand the
42 kill to include the next word. ``5`` to include the next 5 words etc.
43 The other commands also follow this pattern.
44
45 ``+``/``-`` does expanding/shrinking according to the thing selected.
46 So for ``word`` the expansion is word-wise, for ``line`` line-wise,
47 for ``list`` or ``sexp``, list-wise.
48
49 ``list-wise`` expanding/shrinking work well in lispy modes (elisp,
50 Common Lisp, Scheme, Clojure etc.), smie-based modes (Prolog, SML,
51 Modula2, Shell, Ruby, Octave, CSS, SQL etc.), Nxml mode and Js2 mode.
52
53 To copy the enclosing list in lispy modes, I used to do a lot of
54 ``C-M-u C-M-SPC M-w``. Now the key sequence is replaced by ``M-w l``
55 (save list at point) as shown in `screenshot
56 <http://i.imgur.com/8TNgPly.png>`_:
57
58 .. figure:: http://i.imgur.com/8TNgPly.png
59 :target: http://i.imgur.com/8TNgPly.png
60 :alt: ``M-w l``
61
62 easy-mark
63 ~~~~~~~~~
64
65 ``easy-mark`` is similar to ``easy-kill`` but marks the region
66 immediately. It can be a handy replacement for ``mark-sexp`` allowing
67 ``+``/``-`` to do list-wise expanding/shrinking and marks the whole
68 sexp even when in the middle of one. ::
69
70 (global-set-key [remap mark-sexp] 'easy-mark)
71
72 Install
73 ~~~~~~~
74
75 ``easy-kill`` is part of GNU ELPA and is also available on `MELPA
76 <http://melpa.milkbox.net/#/easy-kill>`_.
77
78 Extensions
79 ~~~~~~~~~~
80
81 New things can be defined by following package ``thingatpt.el``'s
82 convention, or by defining new functions named like
83 ``easy-kill-on-THING-NAME``. See ``easy-kill-on-buffer-file-name`` and
84 ``easy-kill-on-url`` for examples.
85
86 NEWS
87 ~~~~
88
89 0.9.2
90 +++++
91
92 #. ``-`` can move pass the first selection.
93 #. ``+``/``-`` on ``sexp`` no longer change ``thing`` to ``list``
94 #. Mouse over the selection now shows description.
95 #. Echo js2 node name.
96 #. Append now uses sensible separator (customisable via
97 ``easy-kill-alist``).
98 #. The format of easy-kill-alist has changed. The old ``(CHAR .
99 THING)`` format is still supported but may be removed in future.
100
101 Bugs
102 ~~~~
103
104 https://github.com/leoliu/easy-kill/issues