Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't find a light table cheat sheet

Does anyone have a cheatsheet for LightTable, even better for the paredit plugin, it seems my google-fu is not up to finding one?

like image 408
shmish111 Avatar asked Mar 04 '14 09:03

shmish111


3 Answers

I don't think a general cheat sheet for LightTable exists yet! But for the paredit plugin...I hope the following helps

Paredit Commands

  • :paredit.unwrap.parent (a b (c | d) e) => (a b c | d e)
  • :paredit.grow.left (a b (c | d) e) => (a (b c | d))
  • :paredit.grow.right (a b (c | d) e) => (a b (c | d e))
  • :paredit.shrink.left (a b (c | d) e) => (a b c | (d) e)
  • :paredit.shrink.right (a b (c | d) e) => (a b (c) | d e)
  • :paredit.move.up.forward (a b (c | d) e) => (a b (c d)| e)
  • :paredit.move.up.backward (a b (c | d) e) => (a b |(c d) e)
  • :paredit.move.down.forward (a b | (c d) e) => (a b (|c d) e)
  • :paredit.move.down.backward (a b (c d) | e) => (a b (c d|) e)

Binding the keys

To bind the keys, first open user keymap (Settings: User Keymap), and then add binding entries in for the editors in which you want paredit bindings.

e.g. I have them bound in all editors, so the relevant bit of my keymap is:

{:+ {:app { ...}
     :editor { ...
              "ctrl-shift-right" [:paredit.grow.right]
              "ctrl-shift-left" [:paredit.shrink.right]
              "ctrl-right" [:paredit.shrink.left]
              "ctrl-left" [:paredit.grow.left]}}
 :- {}}
like image 182
Daniel Neal Avatar answered Oct 19 '22 06:10

Daniel Neal


Most of the action happens, when you hit CTRL + Space so you get all commands in there. Just type a keyword and you get all options for it.

I think you want to bind the "usual" keyboard bindings from paredit into lighttable. That's very easy:

  1. Hit CTRL + Space
  2. Type Settings
  3. You get a list of actually 5 items. Choose "Default Keymap" (or "User keymap")
  4. You get a hash-map with the keybindings set up so far

Here you can edit your paredit plugin and bind the commands you would like to use. For paredit I added to my default keymap:

:editor {"ctrl-left"  [:paredit.shrink.right]
         "ctrl-right" [:paredit.grow.right]
         "ctrl-s"     [:paredit.unwrap.parent]}

Values like paredit.shrink.right can be found if you hit CTRL + Space and type paredit. As you have 3 examples above, you can just think of how the other commands would look like:

"Paredit: Shrink right" is the keyword :paredit.shrink.right

I am pretty sure that I found a list in the internet where those commands were written down, but I can't find it at this moment. But if you know how to "convert" it to keywords, you can just use CTRL + Space to find all commands you need.

When you correctly bound a keyword on a keybinding you can see this binding in the command list CTRL + Space.

With this in your mind, you actually have something like a Cheatsheet printed as a map of bindings and actions. Hope this helps ;-)

like image 20
n2o Avatar answered Oct 19 '22 07:10

n2o


Only because the others have not said it yet. You can bind multiple actions to one shortcut as the actions are stored in a list:

:editor {"ctrl-shift-up" [:paredit.grow.right :paredit.shrink.right]
         "ctrl-right-down" [:paredit.shrink.left :paredit.grow.left]}
like image 31
sveri Avatar answered Oct 19 '22 06:10

sveri