Skip to content
Discussion options

You must be logged in to vote

This is my custom picker for workspaces.nvim. Putting it here if anyone needs it:

    vim.keymap.set('n', '<Leader>w', function()
      local items = {}
      local longest_name = 0
      for i, workspace in ipairs(require('workspaces').get()) do
        table.insert(items, {
          idx = i,
          score = i,
          text = workspace.path,
          name = workspace.name,
        })
        longest_name = math.max(longest_name, #workspace.name)
      end
      longest_name = longest_name + 2
      return Snacks.picker({
        items = items,
        format = function(item)
          local ret = {}
          ret[#ret + 1] = { ('%-' .. longest_name .. 's'):format(item.name), 'Snack…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by synic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants