9

KLIPSE hotkeys and url parameters

 3 years ago
source link: https://blog.klipse.tech/clojure/2016/03/27/klipse-manual.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

KLIPSE hotkeys and url parameters

Mar 27, 2016 • Yehonathan Sharvit

KLIPSE is a clojure[script] web REPL built on top of self-host clojurescript.

In this article, we describe how to tweak KLIPSE.

URL parameters

KLIPSE configuration is done with the url parameters:

  • cljs_in=<cljs_code> - initial content of the clojurescript box ( code must be encoded properly)
  • cljs_in.gist=<gist_id> - load code from a gist; e.g. http://app.klipse.tech?cljs_in.gist=viebel/368d3bec58d3ec47e935ad488bafb600&eval_only=1
  • container=1 - container more useful for UI stuff: instead of the compilation box, you have your klipse container
  • js_only=1 - display only input and js boxes
  • eval_only=1 - display only input, eval and print boxes
  • static-fns=true - eval and transpile js code with static dispatch
  • external-libs - array of external libs to resolve the namespace dependencies. Here is an example with the gadjett library.
  • verbose - (default false) passed to bootstraped eval and compile functions as :verbose opts
  • cache-buster - (default false) when true the namespaces are loaded with a cache buster
  • max-eval-duration - (default 1000) max number of 1000 seconds the code is allowed to run synchronously before being interrupted.
  • compile-display-guard: (default false) when true, display the anti-starvation code inside result of compilation
  • print-length: (default 1000) max number of items in collections to display - useful to prevent browser stuck when evaluating infinite sequences like (range)
  • beautify-strings: (default false) when evaluation result is a string - display the “interior” of the string without escaping the quotes.

Hotkeys

Interaction with the REPL is done with hotkeys:

  • Ctrl-Enter or Cmd-Enter - eval and transpile
  • Ctrl-S - display in the console and alert box shareable url that embeds the content of your current KLIPSE session.
  • Ctrl-R - reload the app with the same content (pass the content to cljs_in url parameter).
If you enjoy this kind of interactive articles would you consider a (small) donation💸 on Patreon or at least giving a star⭐ for the Klispe repo on Github?

to stay up-to-date with the coolest interactive articles around the world.

Discover more cool interactive articles about javascript, clojure[script], python, ruby, scheme, c++ and even brainfuck!

Give Klipse a Github star to express how much you appreciate Code Interactivity.

Subscribe to the Klipse newsletter:

Feel free to email me [email protected] for getting practical tips and tricks in writing your first interactive blog post.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK