How to bind a key combination to a command?

80 Views Asked by At

I have recently run into the following use case in LightTable:

  • I want to execute a command (for instance, duplicate a line)
  • I press "Ctrl-Space" and a list of commands shows up
  • I select the command I need
  • I want to repeat this command often, but there is no keybinding for this command
  • I go to user.keymap where I am supposed to add a line like [:editor "alt-shift-w" :editor.watch.unwatch]
  • But I have no idea what is the :editor.watch.unwatch-like key for the command I have just found. All I know is the displayed name of this command: Editor: duplicate line

Is there a way to add this keybinding without digging up the documentation and finding the key?

1

There are 1 best solutions below

1
Kenny Evitt On BEST ANSWER

If you add the beginning of a line like this to your user.keymap:

[:editor "alt-shift-w" 

and position the keyboard cursor at the end of the line you should be able to type duplicate line and the relevant command should be listed in a popup autocomplete menu.