EITHER key bindings OR plugs in CONFIG not working

if one CONFIGs as follows (in SB v2),

4 key bindings don’t work, but 2 plugs (treeview.plug.js & Git.md) work

↓ space-lua

config.set {
  plugs = {
    "github:joekrill/silverbullet-treeview/treeview.plug.js",
  },

  git = {
    autoSync = 5,
  },
}

↓ lua (see Library/Std/Command)

command.update {
  name = "Page: Delete",
  key = "Ctrl-Alt-d",
  mac = "Cmd-Alt-d",
  priority = 0
},
command.update {
  name = "Navigate: Page Picker",
  key = "Ctrl-Alt-p",
  mac = "Cmd-Alt-p",
  priority = 0
},
command.update {
  name = "Navigate: Home",
  key = "Ctrl-Alt-h",
  mac = "Cmd-Alt-h",
  priority = 0
},
command.define {
  name = "Navigate: CONFIG",
  run = function()
    editor.navigate "CONFIG"
  end,
  key = "Ctrl-Alt-c",
  mac = "Cmd-Alt-c",
  priority = 0
},

However, if one CONFIGs as follows (in SB v2),

4 key bindings work, but 2 plugs (treeview.plug.js & Git.md) don’t work

↓ space-lua

config.set {
  plugs = {
    "github:joekrill/silverbullet-treeview/treeview.plug.js",
  },

  git = {
    autoSync = 5,
  },

  command.update {
    name = "Page: Delete",
    key = "Ctrl-Alt-d",
    mac = "Cmd-Alt-d",
    priority = 0
  },
  command.update {
    name = "Navigate: Page Picker",
    key = "Ctrl-Alt-p",
    mac = "Cmd-Alt-p",
    priority = 0
  },
  command.update {
    name = "Navigate: Home",
    key = "Ctrl-Alt-h",
    mac = "Cmd-Alt-h",
    priority = 0
  },
  command.define {
    name = "Navigate: CONFIG",
    run = function()
      editor.navigate "CONFIG"
    end,
    key = "Ctrl-Alt-c",
    mac = "Cmd-Alt-c",
    priority = 0
  },
}

You shouldn’t nest the command.update’s in the config.set block, so do this instead:

config.set {
  plugs = {
    "github:joekrill/silverbullet-treeview/treeview.plug.js",
  },

  git = {
    autoSync = 5,
  },
}

command.update {
  name = "Page: Delete",
  key = "Ctrl-Alt-d",
  mac = "Cmd-Alt-d",
  priority = 0
}

command.update {
  name = "Navigate: Page Picker",
  key = "Ctrl-Alt-p",
  mac = "Cmd-Alt-p",
  priority = 0
}

command.update {
  name = "Navigate: Home",
  key = "Ctrl-Alt-h",
  mac = "Cmd-Alt-h",
  priority = 0
}

command.define {
  name = "Navigate: CONFIG",
  run = function()
    editor.navigate "CONFIG"
  end,
  key = "Ctrl-Alt-c",
  mac = "Cmd-Alt-c",
  priority = 0
}
1 Like

Thanks @zef ! 4 deadly commas + 1 deadly curly brackets pair!

I (should) have learnt that: command.update { … } is a function call, rather than a “key = value” pair…

I am a Lua newbie, although the Chinese input method I am learning is currently using it as the main language -_-||

1 Like