This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (9)
- # beginners (96)
- # calva (14)
- # cider (49)
- # clj-kondo (29)
- # cljsrn (5)
- # clojure (55)
- # clojure-dev (37)
- # clojure-europe (4)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-spec (5)
- # clojure-switzerland (3)
- # clojure-uk (5)
- # clojurescript (172)
- # cursive (14)
- # datomic (3)
- # duct (1)
- # emacs (6)
- # fulcro (17)
- # jobs (1)
- # leiningen (6)
- # nrepl (11)
- # off-topic (26)
- # pedestal (2)
- # re-frame (20)
- # reagent (9)
- # remote-jobs (3)
- # shadow-cljs (67)
- # spacemacs (24)
- # specter (6)
- # test-check (3)
- # tools-deps (18)
I would like to be able to run cider command while in lisp state like when I am in normal state with
, leader key e.g.
,ee to evaluate expression etc…
How do I achieve this?
@ag I tried it but as far as I know, I have to add a line for each keybinding. I am looking for a way to add a binding for
I’m not sure what exactly you are trying to achieve, here’s for example how I extended lisp state by adding a command to reindent current sexp:
(with-eval-after-load 'evil-lisp-state (defun sp-reindent () (interactive) (save-excursion (er/expand-region 2) (evil-indent (region-beginning) (region-end)))) (evil-lisp-state-enter-command sp-reindent) (spacemacs/set-leader-keys "k=" #'evil-lisp-state-sp-reindent))
SPC k =would re-indent things.
@ag I am trying to make all cider functions accessible from lisp state with the same keybindings as in normal state
I get that, but what’s the workflow? How are you getting into the lisp-state to begin with? Anyway, it should be as straightforward as doing something like this:
(add-to-list 'evil-lisp-state-commands '("e e" . cider-eval-last-sexp))
My workflow is: 1. Normal state 2. Switch to Insert state 3. Edit some code 4. Switch to lisp state 5. Now I want to evaluate an expression without having to press ESC
As I said, I can make it work by rebinding all the cider keys: ee, ef, eb etc…
But I think there should be a way to make the “,” key available in lisp state and trigger the cider functions
@viebel it's not exactly what you are asking, but you can use
M-RET as the major mode leader instead of
, when in Lisp State.
I consider lisp state to be just like insert state. So if I want to evaluate code then I drop back to Normal state using
I assume you would need to either modify lisp state elisp or add hooks in your .spacemacs file (or become used to eval code in normal state)
M-RET is the Emacs binding for the major mode menu so its always available in any evil state as well as Emacs (holy mode).
I dont know how you would edit evil-lisp-state to have a major-mode menu bound to the key
,. Evil-lisp state is a micro state in Spacemacs so its not configured to have a leader key for a major mode. Even if you did find a way to add
, to call the major mode menu within the evil-lisp-state If someone added a
, keybinding to the evil-lisp state then I dont know which would take precedence.
I don't really understand you workflow. Why are you switching from insert to lisp state? Are you always structurally editing after adding new code?
My use of multi-modal states is:
normal to evaluate code, navigate around code, maybe code fold, spell check, etc
insert to add code and back to
fd) to demarcate the undo boundary of text changes
lisp to refactor using slurp, barf, raise, transpose, etc and back to