lispy 0.25.0 is out
01 Apr 2015Seriously, check the release notes if you don't believe me.
Fixes
- Add
minibuffer-inactive-mode
to thelispy-elisp-modes
list. It means that you can eval there if you want. - V (
lispy-visit
) should turn onprojectile-global-mode
if it's not on. - M (
lispy-multiline
) works better for Clojure: the regexes for vectors, maps and sets have been improved. - C-k should not delete only the string when located at start of string.
- M will not turn vectors into lists any more.
- the backquote bug for i and M was fixed.
- you can flatten Elisp closures as well, at least the plain ones.
New Features
b calls lispy-back
The movement commands, such as:
- the arrows hjkl (
lispy-left
,lispy-down
etc.) - f (
lispy-flow
) - q (
lispy-ace-paren
) - i (
lispy-tab
), only when called for an active region
will not store each movement in the point-and-mark history. You can press b to go back in history. This is especially useful for h, l, and f, since they are not trivially reversible.
b was previously bound to lispy-store-region-and-buffer
, so you could do Ediff with
b and B. Now it's bound to xB.
Hungry comment delete
C-d (lispy-delete
) when positioned at the start of a comment, and with only whitespace
before the start of the line, will delete the whole comment.
If you want to un-comment, just use C-u ; from any point in the comment.
Added flatten operation for Clojure
xf (lispy-flatten
) now also works for Clojure, before it was only for Elisp.
Example 1 (flatten a macro):
|(->> [1 2 3 4 5]
(map sqr)
(filter odd?))
When you press xf you get this:
|(filter odd? (map sqr [1 2 3 4 5]))
Example 2 (flatten a standard function):
Start with:
|(map odd? [1 2 3 4 5])
After xf:
(let [f odd? coll [1 2 3 4 5]]
(lazy-seq (when-let [s (seq coll)]
(if (chunked-seq? s)
(let [c (chunk-first s)
size (int (count c))
b (chunk-buffer size)]
(dotimes [i size]
(chunk-append b (f (.nth c i))))
(chunk-cons (chunk b)
(map f (chunk-rest s))))
(cons (f (first s))
(map f (rest s)))))))
A bit of a gibberish, but at least we can confirm that map
is indeed lazy.
Example 3 (flatten your own function):
Example function:
(defn sqr [x]
(* x x))
This one requires the function to be properly loaded with C-c C-l (cider-load-file
),
otherwise Clojure will not know the location of the function.
Example statement:
(+ |(sqr 10) 20)
After xf:
(+ |(let [x 10]
(* x x)) 20)
Added lax eval for Clojure
This is similar to the lax eval for Elisp. If you mark an expression with a region:
asdf [1 2 3]
and press e, you will actually eval this:
(do (def asdf [1 2 3])
asdf)
You can do this for let bindings, it's super-useful for debugging. The rule is that if the first element of the region is a symbol, and there's more stuff in the region besides the symbol, a lax eval will be performed.
e will auto-start CIDER
If CIDER isn't live, e will start it and properly eval the current statement.
2F will search for variables first
Since Elisp is a LISP-2, there can be a function and a variable with the same name. F
(lispy-follow
) prefers functions, but now 2F will prefer variables.
2e will eval and insert the commented result
Starting with:
|(filter odd? (map sqr [1 2 3 4 5]))
Pressing 2e gives:
(filter odd? (map sqr [1 2 3 4 5]))
;; =>
;; (1 9 25)
This works for all dialects, so you can also have:
(symbol-function 'exit-minibuffer)
;; =>
;; (closure (t)
;; nil "Terminate this minibuffer argument." (interactive)
;; (setq deactivate-mark nil)
;; (throw (quote exit)
;; nil))
or
*MODULES*
;; =>
;; ("SWANK-ARGLISTS" "SWANK-FANCY-INSPECTOR" "SWANK-FUZZY"
;; "SWANK-UTIL" "SWANK-PRESENTATIONS"
;; "SWANK-TRACE-DIALOG" "SB-CLTL2")
To do the last eval you need to be in special.
It means that you first have to mark the symbol *MODULES*
with a region.
A convenient function to mark the current symbol is M-m (lispy-mark-symbol
).
y (lispy-occur
) now has an ivy
back end
lispy-occur
launches an interactive search within the current top-level expression, usually a
defun. This is useful to see where a variable is used in a function, or to quickly navigate to a
statement.
You can customize lispy-occur-backend
to either ivy
(the default) or helm
(if you have it,
since it's no longer a dependency of lispy
).
Add ivy back end to lispy-completion-method
Now it's the default one for navigating to tags. You can select alternatively helm
or ido
if you
wish.
Remove the dependency on ace-jump-mode
Instead the dependency on ace-window
will be re-used. This allows for a lot of code
simplifications and better tests.
New custom variables:
lispy-avy-style-char
: choose where the overlay appears for Q (lispy-ace-char
)lispy-avy-style-paren
: choose where the overlay appears for q (lispy-ace-paren
)lispy-avy-style-symbol
: choose where the overlay appears for a (lispy-ace-symbol
) and - (lispy-ace-subword
) and H (ace-symbol-replace
).
There's also lispy-avy-keys
, which is a
... z
by default.
Add lispy-compat
This is a list of compatibility features with other packages, such as edebug
and god-mode
.
They add overhead, so you might want to turn them off if you don't use the mentioned packages.
F works for Scheme
You can navigate to a symbol definition in Scheme with F. This feature was already in place for Elisp, Clojure and CL.
Outro
Looks like a great batch of features, but I'm the most happy about the stupid backquote bug being fixed.
Up next: pre-defined key binding themes, featuring:
- the beloved
default
. - the old-school
paredit
. - the special-only
minimal
. - and maybe one more.
Feel free to chime in, if you've got a key setup that you think other people will like. Happy hacking!