Pages Picker and All Pages Picker lead to the same function

Regardless the settings on my config page, i get the basic page picker instead instead of the full picker showing with Ctrl-k

  shortcuts = {
    {
      command = "Navigate: All Pages Picker",
      key = "Ctrl-o",
      mac = "Cmd-o"
    },

Also, how can i map the built-in keyboard shortcuts to other functions?

Shortcuts as a configuration or setting are no longer a thing in v2, you now do this by updating the commands themselves via command.update: Command

OK, i changed it on my config page to the following, but it still does not work. Ctrl-k still opens the Page picker (i don’t want Ctrl+k to do anything) and Ctrl-o opens the document picker instead of the page picker.

  command.update {
    name = "Navigate: All Pages Picker",
    key = "Ctrl-o",
    mac = "Cmd-o"
  },

  command.update {
    name = "Navigate: Document Picker",
    key = "",
    mac = ""
  },

You have to set the page picker command to nil keys, there is an example in the docs I linked. Sorry, can’t give a complete example now — on my phone.

1 Like

thanks. almost got it. now the keys work as intended, except in the Command Palette looks like both actions are mapped to the same keys

tried to play with the priorities, but it did not help. anyhow this is just a cosmetic thing

after a reload i realized that i solved the keyboard mapping, but broke everything else in my config. where am i supposed to put those custom commands?

This is how my config.md looked like, but had to remove the command.update parts because nothing else worked - all the plugins and custom buttons disappeared

config.set {
  plugs = {
   "github:joekrill/silverbullet-treeview/treeview.plug.js",
   "github:silverbulletmd/silverbullet-git/git.plug.js",
   "github:minusInfinite/outline-sidebar/outline-sidebar.plug.js",
   "github:jim-fx/silverbullet-excalidraw/excalidraw.plug.js",
   "ghr:MrMugame/silversearch",
   "github:silverbulletmd/silverbullet-mermaid/mermaid.plug.js"
    -- Then run the `Plugs: Update` command to update them
  },

  -- The treeview plug configuration
  treeview = {
    -- Determines where the panel is displayed:
    -- - "lhs" - left hand side
    -- - "rhs" - right hand side
    -- - "bhs" - bottom
    -- - "modal" - in a modal
    position = "lhs",

    -- Must be > 0.
    -- position = "lhs" | "rhs": determines the width of the panel.
    -- position = "modal": sets the margin around the modal window.
    -- position = "bhs": No effect
    size=0.5,

    dragAndDrop = {
      -- Set to false to disable drag-and-drop
      enabled = true,

      -- Set to false to disable the confirmation prompt shown when dragging and
      -- dropping pages that causes them to be renamed/moved.
      confirmOnRename = true
    },

    -- An array of exclusion rules that will exclude pages from being
    -- displayed in the sidebar.
    exclusions = {
      {
        -- Filter by regular expression:
        type = "regex",
        -- Regular Expression string to exclude pages from the tree
        -- Examples:
        -- - Any page that is all-caps: "^[A-Z]+$"
        -- - A specific set of pages: "^(?:CONFIG|Library|index).*$"
        -- - Any path containing Hidden (e.g. test/Hidden/page1): "Hidden"
        rule="^(?:CONFIG|SETTINGS|Library|index).*$",
        -- Optional: set to true to negate the rule, only showing pages that match this regex.
        negate= false,
      },
      {
        -- Filter by page tags:
        type = "tags",
        tags = {"meta"},
        -- Optional: set to true to negate the rule, only showing pages that include any of the tags.
        negate = false
      }
    }
  },

  command.update {
    name = "Navigate: Page Picker",
    key = "Ctrl-o",
    mac = "Cmd-o"
  },

  command.update {
    name = "Navigate: Document Picker",
    key = nil,
    mac = nil
  },

  command.update {
    name = "Open Command Palette",
    key = "Ctrl-p",
    mac = "Cmd-p"
  },


  actionButtons = {
    {
      icon = "sidebar",
      description = "Toggle Tree View",
      priority = 4,
      run = function()
        editor.invokeCommand("Tree View: Toggle")
      end
    },

    {
      icon = "search",
      description = "Search",
      priority = 4,
      run = function()
        editor.invokeCommand("Search Space")
      end
    },
    {
      icon = "pen-tool",
      description = "Excalidraw",
      priority = 4,
      run = function()
        editor.invokeCommand("Excalidraw: Create diagram")
      end
    },
    {
      icon = "home",
      description = "Go to the index page",
      priority = 3,
      run = function()
        editor.invokeCommand("Navigate: Home")
      end
    },
    {
      icon = "book",
      description = "Open page",
      priority = 2,
      run = function()
        editor.invokeCommand("Navigate: Page Picker")
      end
    },
    {
      icon = "terminal",
      description = "Run command",
      priority = 1,
      run = function()
        editor.invokeCommand "Open Command Palette"
      end,
    }
  },
}

You’re the 4th person to put these calls nested somewhere :joy: they should be at the top level of the space lua block, not nested inside anything.

In the latest version of SB the default CONFIG file doesn’t have this top level config.set {} thing anymore, hopefully that will avoid this confusion.

1 Like

i had to look up the posts of those previous 3 persons to figure out how to structure the config.md file :smiley: i thought everything just goes under the config.set part

1 Like