Search code examples
key-bindingslighttable

How do I override a default keybinding in LightTable?


The default.keymap has pmeta-shift-s bound to :save-as but I would like to rebind it to :save-all. I added the following to my user.keymap:

;; Remove the default keybinding
{:- {:editor {"pmeta-shift-s" [:save-as]}}}

;; Add my keybinding
{:+ {:app {"pmeta-shift-s" [:save-all]}}}

I've saved my user.keymap and LightTable says that it's reloaded the keymap, but pressing pmeta-shift-s still pops up the Save As dialog. What am I doing wrong?

EDIT: I'm fairly convinced this is a bug, so: https://github.com/LightTable/LightTable/issues/1180


Solution

  • Apparently it was not a bug, the :- and :+ keys must appear in the same map:

    {:- {:editor {"pmeta-shift-s" [:save-as]}}
    
     :+ {:app {"pmeta-shift-s" [:save-all]}
    
         :editor {"alt-w" [:editor.watch.watch-selection]
                  "alt-shift-w" [:editor.watch.unwatch]
                  "f3" [:find.next]}
    
         :tabs {"pmeta-pagedown" [:tabs.next]
                "pmeta-pageup" [:tabs.prev]}}}}