In all the following examples, the character |
denotes the point.
command | binding |
---|---|
vilpy-special |
backtab |
vilpy-ace-paren |
q |
vilpy-ace-subword |
- |
vilpy-ace-symbol |
f |
vilpy-beginning-of-defun |
I |
vilpy-delete |
C-d |
vilpy-down |
j |
vilpy-eval-buffer |
B |
vilpy-eval |
e |
vilpy-step-in |
l |
We will start with the following snippet:
(defun plus-one (n)
(+ 1 n)
(message "debug"))
(plus-one 2)
This will be the final result:
(def plus-two (n)
(+ 2 n))
We start with this code. Note that the point is in the middle of defun
.
(de|fun plus-one (n)
(+ 1 n)
(message "done"))
(plus-one 2)
Evaluating (plus-one 2)
- Press backtab (that is, shift and tab) to move the point to the beginning of the defun and enter special mode.
- First, evaluate the defun with e (
vilpy-eval
). - Then, use j (
vilpy-down
) and e for evaluating(plus-one 2)
and getting 3. - Use k for getting back to the defun. Note that this entire sequence is equivalent to simply using B (
vilpy-eval-buffer
).
Change plus-one
to plus-two
- With the point in the beginning of the defun, press - (
vilpy-ace-subword
). This will display a letter in each subword, alphabetically, like(adefun bplus-cone ...)
. Pressc
for jumping toone
, which will be marked. - Then, use C-d (
vilpy-delete
) for removingone
and writetwo
. - Press backtab for getting back to special mode.
Remove message
- Use l (
vilpy-step-in
) three times for getting to themessage
form. This is equivalent to 3l. Alternatively, use q (vilpy-ace-paren
) andd
for directly jumping tomessage
. - Then, press C-d (
vilpy-delete
) twice for removing the form and the blank line. The point will jump to the beginning of the defun.
Change (+ 1 n)
to (+ 2 n)
- Press f (
vilpy-ace-symbol
). This command will add a letter before each symbol. Usee
for directly jumping to1
. - Use C-d for deleting it and write
2
. - Use backtab for getting back to special mode.
- I (
vilpy-beginning-of-defun
) for jumping to the beginning of the defun. - e for evaluating it.
Deleting (plus-one 2)
- Finally, press j for moving the point to
(plus-one 2)
. - C-d for deleting it.
command | binding |
---|---|
vilpy-step-in |
l |
vilpy-clone |
w |
vilpy-down |
j |
vilpy-ace-subword |
- |
vilpy-special |
backtab |
vilpy-up |
k |
forward-char |
a |
vilpy-space |
SPC |
vilpy-kill |
C-k |
vilpy-step-out |
h |
vilpy-open-line-below |
o |
We will starting with this snippet of code:
(defun foo
()
(do-bar)
(do-baz (a) (b) (c)))
This will be the result:
(defun foo
()
(with-foo do-bar)
(do-foo)
(do-baz (a))
(a)))
Consider that the point starts just before defun
, in special mode.
Insert (do-foo)
- First, let's insert
(do-foo)
by duplicating(do-bar)
and replacingbar
. - Use l (
vilpy-step-in
) twice for getting todo-bar
. This is equivalent to 2l or qc (vilpy-ace-paren
followed byc
). - Then, press w (
vilpy-clone
), which will duplicate(do-foo)
. - Use j (
vilpy-down
) for moving to the second(do-bar)
. - Press -b for marking
bar
and delete it with C-d. Typefoo
- Use backtab for getting back to special mode (that is, shift and tab).
Change (do-bar)
to (with-foo do-bar)
- Use k (
vilpy-up
) for getting todo-bar
. - Then, press a (
forward-char
).This is equivalent to the usualC-f
Emacs binding. The point will be just after the paren:(|do-bar)
. - Press SPC (
vilpy-space
) for inserting a whitespace character and typewith-foo
. - Use backtab (
vilpy-special
) for getting back to special mode. The point will be just before the paren, like this:|(with-foo do-bar)
.
Remove (b)
and (c)
from do-baz
- Press j for getting to
do-baz
. - Use l twice for getting to
(b)
. - Then, use C-k (
vilpy-kill
) for killing until the end of the parent sexp.
Copy (a)
to the line below
- Use backtab for getting back to special mode.
- y for copying
(a)
. - Press h (
vilpy-step-out
) for getting to the paren sexp. - Use backtab for switching to the matching paren and RET for opening a new line. This is equivalent to just using o (
vilpy-open-line-below
). - Finally, press C-y (the standard
yank
command) for pasting the previously copied sexp.