clojure layer: add send region to REPL support

This commit is contained in:
syl20bnr 2015-02-23 22:09:39 -05:00
parent d9ad9fea32
commit baa2dc3dd1
2 changed files with 19 additions and 0 deletions

View file

@ -121,6 +121,8 @@ More info regarding installation of nREPL middleware can be found here:
<kbd>SPC m s i</kbd> | start REPL
<kbd>SPC m s n</kbd> | send and eval ns form in REPL
<kbd>SPC m s N</kbd> | send and eval ns form and switch to REPL in `insert state`
<kbd>SPC m s r</kbd> | send and eval region in REPL
<kbd>SPC m s R</kbd> | send and eval region and switch to REPL in `insert state`
<kbd>SPC m s s</kbd> | switch to REPL
### Tests

View file

@ -75,6 +75,21 @@ the focus."
(cider-insert-last-sexp-in-repl t)
(evil-insert-state))
(defun spacemacs/send-region-to-repl ()
"Send region to REPL and evaluate it without changing
the focus."
(interactive)
(spacemacs//cider-eval-in-repl-no-focus
(buffer-substring-no-properties (region-beginning) (region-end))))
(defun spacemacs/send-region-to-repl-focus ()
"Send region to REPL and evaluate it and switch to the REPL in
`insert state'."
(interactive)
(cider-insert-in-repl
(buffer-substring-no-properties (region-beginning) (region-end)) t)
(evil-insert-state))
(defun spacemacs/send-function-to-repl ()
"Send current function to REPL and evaluate it without changing
the focus."
@ -133,6 +148,8 @@ the focus."
"msi" 'cider-jack-in
"msn" 'spacemacs/send-ns-form-to-repl
"msN" 'spacemacs/send-function-to-repl-focus
"msr" 'spacemacs/send-region-to-repl
"msR" 'spacemacs/send-region-to-repl-focus
"mss" 'cider-switch-to-repl-buffer
"mtt" 'cider-test-run-tests)