diff --git a/doc/DOCUMENTATION.md b/doc/DOCUMENTATION.md
index 2e2bb91ad..db863b3cb 100644
--- a/doc/DOCUMENTATION.md
+++ b/doc/DOCUMENTATION.md
@@ -1662,44 +1662,38 @@ the commands can be repeated without pressing on SPC m.
When in `lisp state` the color of the mode-line changes to pink.
Examples:
-- to slurp three times while in normal state: SPC m n n n
-- to wrap a symbol in parenthesis then slurping two times: SPC m w n n
+- to slurp three times while in normal state: SPC m 3 n
+- to wrap a symbol in parenthesis then slurping two times: SPC m w 2 n
-#### hjkl keys for quickly editing lisp code
-
-Evil Lisp state binds the most common commands on hjkl:
-
-Key Binding | Function
---------------------|------------------------------------------------------------
-SPC m h | previous symbol
-SPC m H | forward barf sexp (move the current symbol or sexp outside)
-SPC m j | next closing parenthesis
-SPC m J | wrap symbol with parenthesis (down one level)
-SPC m k | previous opening parenthesis
-SPC m K | unwrap current sexp (up one level)
-SPC m l | next symbol
-SPC m L | forward slurp sexp (move next outside sexp into current one)
-
-So with just hjkl keys you can:
-- navigate between symbols and sexps
-- slurp and barf symbols and sexps
-- wrap and unwrap symbols and sexps
-
-**Notes:**
-Slurping, barfing and wrapping are also bound on other keys, see below.
-
-### Other commands:
+### Commands:
Key Binding | Function
---------------------|------------------------------------------------------------
+SPC m % | evil jump item
+SPC m : | ex command
SPC m ( | insert expression before (same level as current one)
SPC m ) | insert expression after (same level as current one)
+SPC m $ | go to the end of current sexp
+SPC m 0 | go to the beginning of current sexp
SPC m a | absorb expression
SPC m b | forward barf expression
SPC m B | backward barf expression
SPC m c | convolute expression
+SPC m d | describe elisp thing at point (show documentation)
+SPC m e $ | go to end of line and evaluate last sexp
+SPC m e e | evaluate last sexp
+SPC m e f | evaluate current defun
+SPC m g | go to definition
+SPC m h | backward char
+SPC m H | previous symbol
SPC m i | switch to `insert state`
SPC m I | go to beginning of current expression and switch to `insert state`
+SPC m j | next visual line
+SPC m J | next closing parenthesis
+SPC m k | previous visual line
+SPC m K | previous opening parenthesis
+SPC m l | forward char
+SPC m L | next symbol
SPC m m | merge (join) expression
SPC m n | forwared slurp expression
SPC m N | backward slurp expression
@@ -1708,6 +1702,8 @@ Key Binding | Function
SPC m q | unwrap current expression and kill all symbols after point
SPC m Q | unwrap current expression and kill all symbols before point
SPC m r | raise expression (replace parent expression by current one)
+SPC m t b | execute buffer tests
+SPC m t q | ask for test function to execute
SPC m T | transpose expression
SPC m u | undo
SPC m C-r | redo
diff --git a/spacemacs/extensions/evil-lisp-state/README.md b/spacemacs/extensions/evil-lisp-state/README.md
index d96ed6aab..680d3eb8b 100644
--- a/spacemacs/extensions/evil-lisp-state/README.md
+++ b/spacemacs/extensions/evil-lisp-state/README.md
@@ -13,8 +13,6 @@ using mnemonic key bindings.
- [Manually](#manually)
- [Principle](#principle)
- [Commands and key bindings](#commands-and-key-bindings)
- - [hjkl](#hjkl)
- - [Other commands:](#other-commands)
- [Configuration](#configuration)
@@ -52,49 +50,42 @@ Examples:
- to slurp three times while in normal state:
- m s s s
+ m 3 n
- to wrap a symbol in parenthesis then slurping two times:
- m w s s
+ m w 2 n
## Commands and key bindings
-### hjkl
-
-Evil Lisp state binds the most common commands on hjkl:
-
-Key Binding | Function
----------------------------|------------------------------------------------------------
-\ m h | previous symbol
-\ m H | forward barf sexp (move the current symbol or sexp outside)
-\ m j | next closing parenthesis
-\ m J | wrap symbol with parenthesis (down one level)
-\ m k | previous opening parenthesis
-\ m K | unwrap current sexp (up one level)
-\ m l | next symbol
-\ m L | forward slurp sexp (move next outside sexp into current one)
-
-So with just hjkl keys you can:
-- navigate between symbols and sexps
-- slurp and barf symbols and sexps
-- wrap and unwrap symbols and sexps
-
-**Notes:**
-Slurping, barfing and wrapping are also bound on other keys.
-
-### Other commands:
-
Key Binding | Function
----------------------------|------------------------------------------------------------
+\ | evil leader
+\ m % | evil jump item
+\ m : | ex command
\ m ( | insert expression before (same level as current one)
\ m ) | insert expression after (same level as current one)
+\ m $ | go to the end of current sexp
+\ m 0 | go to the beginning of current sexp
\ m a | absorb expression
\ m b | forward barf expression
\ m B | backward barf expression
\ m c | convolute expression
+\ m d | describe elisp thing at point (show documentation)
+\ m e $ | go to end of line and evaluate last sexp
+\ m e e | evaluate last sexp
+\ m e f | evaluate current defun
+\ m g | go to definition
+\ m h | backward char
+\ m H | previous symbol
\ m i | switch to `insert state`
\ m I | go to beginning of current expression and switch to `insert state`
+\ m j | next visual line
+\ m J | next closing parenthesis
+\ m k | previous visual line
+\ m K | previous opening parenthesis
+\ m l | forward char
+\ m L | next symbol
\ m m | merge (join) expression
\ m n | forwared slurp expression
\ m N | backward slurp expression
@@ -103,6 +94,8 @@ Key Binding | Function
\ m q | unwrap current expression and kill all symbols after point
\ m Q | unwrap current expression and kill all symbols before point
\ m r | raise expression (replace parent expression by current one)
+\ m t b | execute buffer tests
+\ m t q | ask for test function to execute
\ m T | transpose expression
\ m u | undo
\ m C-r | redo
diff --git a/spacemacs/extensions/evil-lisp-state/evil-lisp-state.el b/spacemacs/extensions/evil-lisp-state/evil-lisp-state.el
index dd596de96..a794adfb7 100644
--- a/spacemacs/extensions/evil-lisp-state/evil-lisp-state.el
+++ b/spacemacs/extensions/evil-lisp-state/evil-lisp-state.el
@@ -5,7 +5,7 @@
;; Author: Sylvain Benner
;; Keywords: convenience editing evil smartparens lisp mnemonic
;; Created: 9 Oct 2014
-;; Version: 5.1.0
+;; Version: 6.1
;; Package-Requires: ((evil "1.0.9") (evil-leader "0.4.3") (smartparens "1.6.1"))
;; URL: https://github.com/syl20bnr/evil-lisp-state
@@ -36,64 +36,63 @@
;; By default, the prefix for each command is ` m`.
;; Each command when executed set the current state to `lisp state`.
;; By example, to slurp three times while in normal state:
-;; m s s s
+;; m 3 n
;; Or to wrap a symbol in parenthesis then slurping two times:
-;; m w s s
+;; m w 2 n
;; Commands and key bindings:
;; --------------------------
-;; Evil Lisp state binds the most common commands on hjkl:
-;;
-;; Key Binding | Function
-;; ----------------|------------------------------------------------------------
-;; ` m h` | previous symbol
-;; ` m H` | forward barf sexp (move the current symbol or sexp outside)
-;; ` m j` | next closing parenthesis
-;; ` m J` | wrap symbol with parenthesis (down one level)
-;; ` m k` | previous opening parenthesis
-;; ` m K` | unwrap current sexp (up one level)
-;; ` m l` | next symbol
-;; ` m L` | forward slurp sexp (move next outside sexp into current one)
-;;
-;; So with just hjkl keys you can:
-;; - navigate between symbols and sexps
-;; - slurp and barf symbols and sexps
-;; - wrap and unwrap symbols and sexps
-
-;; Slurping, barfing and wrapping are also bound on other keys.
-;; All the other commands are:
-
-;; Key Binding | Function
-;; ----------------|------------------------------------------------------------
-;; ` m (` | insert expression before (same level as current one)
-;; ` m )` | insert expression after (same level as current one)
-;; ` m a` | absorb expression
-;; ` m b` | forward barf expression
-;; ` m B` | backward barf expression
-;; ` m c` | convolute expression
-;; ` m i` | switch to `insert state`
-;; ` m I` | go to beginning of current expression and switch to `insert state`
-;; ` m m` | merge (join) expression
-;; ` m n` | forwared slurp expression
-;; ` m N` | backward slurp expression
-;; ` m p` | paste after
-;; ` m P` | paste before
-;; ` m q` | unwrap current expression and kill all symbols after point
-;; ` m Q` | unwrap current expression and kill all symbols before point
-;; ` m r` | raise expression (replace parent expression by current one)
-;; ` m T` | transpose expression
-;; ` m u` | undo
-;; ` m C-r`| redo
-;; ` m v` | switch to `visual state`
-;; ` m V` | switch to `visual line state`
-;; ` m C-v`| switch to `visual block state`
-;; ` m w` | wrap expression with parenthesis
-;; ` m W` | unwrap expression
-;; ` m xs` | delete symbol
-;; ` m xw` | delete word
-;; ` m xx` | delete expression
-;; ` m y` | copy expression
+;; Key Binding | Function
+;; ---------------|------------------------------------------------------------
+;; `leader' | evil leader
+;; `leader m %' | evil jump item
+;; `leader m :' | ex command
+;; `leader m (' | insert expression before (same level as current one)
+;; `leader m )' | insert expression after (same level as current one)
+;; `leader m $' | go to the end of current sexp
+;; `leader m 0' | go to the beginning of current sexp
+;; `leader m a' | absorb expression
+;; `leader m b' | forward barf expression
+;; `leader m B' | backward barf expression
+;; `leader m c' | convolute expression
+;; `leader m d' | describe elisp thing at point (show documentation)
+;; `leader m e $' | go to end of line and evaluate last sexp
+;; `leader m e e' | evaluate last sexp
+;; `leader m e f' | evaluate current defun
+;; `leader m g' | go to definition
+;; `leader m h' | backward char
+;; `leader m H' | previous symbol
+;; `leader m i' | switch to `insert state`
+;; `leader m I' | go to beginning of current expression and switch to `insert state`
+;; `leader m j' | next visual line
+;; `leader m J' | next closing parenthesis
+;; `leader m k' | previous visual line
+;; `leader m K' | previous opening parenthesis
+;; `leader m l' | forward char
+;; `leader m L' | next symbol
+;; `leader m m' | merge (join) expression
+;; `leader m n' | forwared slurp expression
+;; `leader m N' | backward slurp expression
+;; `leader m p' | paste after
+;; `leader m P' | paste before
+;; `leader m q' | unwrap current expression and kill all symbols after point
+;; `leader m Q' | unwrap current expression and kill all symbols before point
+;; `leader m r' | raise expression (replace parent expression by current one)
+;; `leader m t b' | execute buffer tests
+;; `leader m t q' | ask for test function to execute
+;; `leader m T' | transpose expression
+;; `leader m u' | undo
+;; `leader m C-r' | redo
+;; `leader m v' | switch to `visual state`
+;; `leader m V' | switch to `visual line state`
+;; `leader m C-v' | switch to `visual block state`
+;; `leader m w' | wrap expression with parenthesis
+;; `leader m W' | unwrap expression
+;; `leader m xs' | delete symbol
+;; `leader m xw' | delete word
+;; `leader m xx' | delete expression
+;; `leader m y' | copy expression
;; Configuration:
;; --------------
@@ -159,10 +158,25 @@
(evil-normal-state)
(call-interactively ',command)))
+;; escape
(define-key evil-lisp-state-map [escape] 'evil-normal-state)
+
+;; toggle lisp state
+(define-key evil-lisp-state-map ",," 'lisp-state-toggle-lisp-state)
+(dolist (mm evil-lisp-state-major-modes)
+ (evil-leader/set-key-for-mode mm "m," 'lisp-state-toggle-lisp-state))
+
+;; leader
+(define-key evil-lisp-state-map (kbd evil-leader/leader) evil-leader--default-map)
+
+;; auto-switch to lisp state commands
(defconst evil-lisp-state-commands
- `(("(" . lisp-state-insert-sexp-before)
+ `(("%" . evil-jump-item)
+ (":" . evil-ex)
+ ("(" . lisp-state-insert-sexp-before)
(")" . lisp-state-insert-sexp-after)
+ ("$" . sp-end-of-sexp)
+ ("0" . lisp-state-beginning-of-sexp)
("1" . digit-argument)
("2" . digit-argument)
("3" . digit-argument)
@@ -176,16 +190,21 @@
("b" . sp-forward-barf-sexp)
("B" . sp-backward-barf-sexp)
("c" . sp-convolute-sexp)
- ("h" . sp-backward-symbol)
- ("H" . sp-forward-barf-sexp)
+ ("d" . elisp-slime-nav-describe-elisp-thing-at-point)
+ ("e$" . lisp-state-eval-sexp-end-of-line)
+ ("ee" . eval-last-sexp)
+ ("ef" . eval-defun)
+ ("g" . elisp-slime-nav-find-elisp-thing-at-point)
+ ("h" . evil-backward-char)
+ ("H" . sp-backward-symbol)
("i" . evil-insert-state)
("I" . evil-insert-line)
- ("j" . lisp-state-next-closing-paren)
- ("J" . lisp-state-wrap)
- ("k" . lisp-state-prev-opening-paren)
- ("K" . sp-unwrap-sexp)
- ("l" . lisp-state-forward-symbol)
- ("L" . sp-forward-slurp-sexp)
+ ("j" . evil-next-visual-line)
+ ("J" . lisp-state-next-closing-paren)
+ ("k" . evil-previous-visual-line)
+ ("K" . lisp-state-prev-opening-paren)
+ ("l" . evil-forward-char)
+ ("L" . lisp-state-forward-symbol)
("m" . sp-join-sexp)
("n" . sp-forward-slurp-sexp)
("N" . sp-backward-slurp-sexp)
@@ -194,7 +213,9 @@
("q" . sp-splice-sexp-killing-forward)
("Q" . sp-splice-sexp-killing-backward)
("r" . sp-raise-sexp)
- ("T" . sp-transpose-sexp)
+ ("tb" . spacemacs/ert-run-tests-buffer)
+ ("tq" . ert)
+ ("T" . sp-transpose-sexp)
("u" . undo-tree-undo)
("C-r" . undo-tree-redo)
("v" . evil-visual-char)
@@ -221,6 +242,14 @@
,(kbd (concat evil-lisp-state-leader-prefix key))
(evil-lisp-state-enter-command ,cmd)))))))
+(defun lisp-state-toggle-lisp-state ()
+ "Toggle the lisp state."
+ (interactive)
+ (message "state: %s" evil-state)
+ (if (eq 'lisp evil-state)
+ (evil-normal-state)
+ (evil-lisp-state)))
+
(defun lisp-state-wrap (&optional arg)
"Wrap a symbol with parenthesis."
(interactive "P")
@@ -276,6 +305,20 @@
(sp-insert-pair "(")
(indent-for-tab-command)))
+(defun lisp-state-eval-sexp-end-of-line ()
+ "Evaluate the last sexp at the end of the current line."
+ (interactive)
+ (save-excursion
+ (end-of-line)
+ (eval-last-sexp nil)))
+
+(defun lisp-state-beginning-of-sexp (&optional arg)
+ "Go to the beginning of current s-exp"
+ (interactive "P")
+ (sp-beginning-of-sexp)
+ (evil-backward-char))
+
+
(provide 'evil-lisp-state)
;;; evil-lisp-state.el ends here
diff --git a/spacemacs/funcs.el b/spacemacs/funcs.el
index 2e5e24611..d5bd9e25e 100644
--- a/spacemacs/funcs.el
+++ b/spacemacs/funcs.el
@@ -869,13 +869,6 @@ If ASCII si not provided then UNICODE is used instead."
"Return the line at point as a string."
(buffer-substring (line-beginning-position) (line-end-position)))
-(defun spacemacs/eval-sexp-end-of-line ()
- "Evaluate the last sexp at the end of the current line."
- (interactive)
- (save-excursion
- (evil-end-of-line)
- (eval-last-sexp nil)))
-
(defun spacemacs/toggle-tool-bar ()
"Toggle the tool bar.
It has no effect in a terminal."
diff --git a/spacemacs/keybindings.el b/spacemacs/keybindings.el
index c51e73572..1c6295b5b 100644
--- a/spacemacs/keybindings.el
+++ b/spacemacs/keybindings.el
@@ -208,12 +208,3 @@
;; google translate -----------------------------------------------------------
(evil-leader/set-key
"xgl" 'set-google-translate-languages)
-;; Lisps ----------------------------------------------------------------------
-(evil-leader/set-key-for-mode 'emacs-lisp-mode
- "me$" 'spacemacs/eval-sexp-end-of-line
- "mee" 'eval-last-sexp
- "mef" 'eval-defun
- "md" 'elisp-slime-nav-describe-elisp-thing-at-point
- "mg" 'elisp-slime-nav-find-elisp-thing-at-point
- "mtb" 'spacemacs/ert-run-tests-buffer
- "mtt" 'ert)