Search code examples
lighttable

How do i map one shortcut key to a sequence of tags (tasks) in lighttable?


Say, for example, I want to bind a key "ctrl+d" to duplicate current line in LightTable. For that, to emulate duplication of the current line, I want to run a series of actions like [:editor.select-line :editor.copy :editor.selection.clear :editor.new-line-indent :editor.line-start :editor.paste]

How do I achieve this?

Note: I am aware of the :editor.sublime.duplicateLine tag which duplicates the line, but this is just the example. In general, I want to map a shortcut to a sequence of tags/tasks.

http://lighttable.com/


Solution

  • Are you trying to bind the key? You seem to have most of it set. Just open up user.keymap (ctrl-space "user keymap") and add this:

    [:editor "ctrl+d" :editor.select-line
                      :editor.copy
                      :editor.selection.clear
                      :editor.new-line-indent
                      :editor.line-start
                      :editor.paste]
    

    There is no requirement that you put it on separate lines like that of course.

    Or are you asking for something more complicated?