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