diff --git a/layers/+lang/ruby/README.org b/layers/+lang/ruby/README.org index c6dbc803212a..1c84b51868b4 100644 --- a/layers/+lang/ruby/README.org +++ b/layers/+lang/ruby/README.org @@ -20,6 +20,7 @@ - [[#toggles][Toggles]] - [[#rake][Rake]] - [[#refactor][Refactor]] + - [[#seeing-is-believing][Seeing is believing]] - [[#layer-options][Layer options]] * Description @@ -55,6 +56,7 @@ based on your version manager): - =pry= and =pry-doc= are required for *jump to definition* and *code documentation* (=robe-mode=) - =ruby_parser= is required for *goto-step_definition* in =feature-mode= - =rubocop= is required for rubocop integration +- =seeing_is_believing= helps you evaluate code inline You can install the gems in the context of your current project by adding them to the =Gemfile=, e.g.: @@ -210,6 +212,13 @@ When =ruby-test-runner= equals =minitest=. | ~SPC m r R c~ | Extract constant | | ~SPC m r R l~ | Extract to let (rspec) | +** Seeing is believing + +| Key Binding | Description | +|-----------------+----------------------------------| +| ~ m @ @~ | Run seeing is believing | +| ~ m @ c~ | Clear seeing is believing output | + * Layer options | Variable | Default value | Description | diff --git a/layers/+lang/ruby/packages.el b/layers/+lang/ruby/packages.el index 03f2ee9c7d8e..6632c17d77b2 100644 --- a/layers/+lang/ruby/packages.el +++ b/layers/+lang/ruby/packages.el @@ -33,6 +33,7 @@ ruby-test-mode ruby-tools rvm + seeing-is-believing smartparens rake )) @@ -330,3 +331,18 @@ "kr" 'rake-rerun "kR" 'rake-regenerate-cache "kf" 'rake-find-task)))) + +(defun ruby/init-seeing-is-believing () + (use-package seeing-is-believing + :defer t + :commands (seeing-is-believing seeing-is-believing-run seeing-is-believing-clear) + :if (executable-find "seeing_is_believing") + :init + (progn + (spacemacs|diminish seeing-is-believing " 👁" " @") + (dolist (hook '(ruby-mode-hook enh-ruby-mode-hook)) + (add-hook hook 'seeing-is-believing)) + (dolist (mode '(ruby-mode enh-ruby-mode)) + (spacemacs/set-leader-keys-for-major-mode mode + "@@" 'seeing-is-believing-run + "@c" 'seeing-is-believing-clear)))))