I am doing more with the cider-inspector (video coming soon) and noticed that there are several inspector related commands without key bindings (inspect last result, function, expression, last-expression)
I am raising a pull request (when GitHub lets me - PR's still seem to be degraded) to add key bindings under the SPC m d v
menu, , d v
in Evil normal.
https://github.com/jr0cket/spacemacs/blob/cider-inspect-key-bindings/layers/%2Blang/clojure/packages.el#L212-L216
The only key binding change is that , d v
is now , d v i
, all other changes are addative only.
Any feedback welcome. I imagine it will take a few days to approve the change by the Spacemacs maintainers (once I can create the PR on GitHub)
The inspector is a really useful tool to keep open, especially when working with a lot of nested data structures or large data sets (more than 100 elements) Using the inspector rather than the REPL buffer also means Emacs wont slow down due to the REPL buffer getting too large.
How about putting the menu under V and not v? Once it's open it always updates to the last result anyway. I find dv to be easy enough to reach for and cover most use cases, unless I'm missing something fundamental
Spacemacs convention is to use lower case characters where possible, so v i
should be used over Shift v i
, especially as there are several really useful inspector functions under , d v
sub menu. If it was just one additional function and that function was a more destructive version of dv
then I could have made a case.
Is there a way to launch a clojure file and a corresponding linked nrepl from the command line?
Can you elaborate? I am afraid I don't understand what you are trying to achieve? Is the file part of a project? What Clojure project tool are you using, Leiningen, Clojure CLI, boot. How is the linked Repl started? How is a repl linked to the fille? Should Cider start the repl or connect to it? Is this Clojure or Clojurescript? I am not really clear what launching a file means without more context
I assume you mean something different to just running lein repl
or clj
Sometimes I want to quickly try out some clojure command. I have a project "fiddle" with "fiddle.clj" under src. I want to place a shortcut on my de5that launches spacemacs, opens fiddle.clj, starts a cider REPL and connects to it. I could run "emacs fiddle/stc/fiddle.clj" and "cd fiddle: lein repl"in parallel but that doesn't link my spacemacs session to the REPL.yet.
...on my desktop...
Sounds like some elisp is required. I am guessing you would need to write a function enough to start a REPL, or connect to a running one (starting might be easier as the port would be taken care of). I am not sure how to decide when to trigger such a function, it would need to be run after the file is loaded I guess, but no idea what to trigger it off unless it's a specific file name, but that seems very bad code.
Try asking in the #cider channel about automating the startup of a repl from elisp
I think it's just simpler keeping Emacs open and the repl running. Then it's just alt-tab