goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.78k stars 104 forks source link

How to integrate bookmarks in dashboard theme? #219

Closed drakari7 closed 1 year ago

drakari7 commented 1 year ago

I'm trying to move over from startify, and the thing I like about alpha is its minimalistic on the first page. My most used feature of startify is the bookmarks by far. In alpha, the way I want it is that there is a start screen with options like "find files, recently opened files, quit nvim, nvim config" etc. 1 of the options should be "bookmarks", and when I trigger that option, I get a page with only the bookmark files.

Any ideas whats the best way to implement this?

goolord commented 1 year ago

i would probably do something probably something like

dashboard.button( "e", "  Bookmarks" , "", {
   callback = function ()
   vim.ui.select(
   {'~/Dev/project1', '~/Dev/project2'},
   {
      prompt = 'Select a bookmark:',
      format_item = function(item)
      return item
      end,
   },
   function(choice)
      if (vim.fn.filereadable(v) == 1) then
         vim.cmd.e(choice)
      else
         vim.cmd.cd(choice)
      end
   end
   )
end
})

and if you want more power i would just integrate this with a fuzzy picker, or a bespoke bookmarks plugin, something like that. (note; i haven't actually tested this but it should work fine)

I feel like bookmarks, sessions, etc are all out of the scope of this plugin and the community would be better served by shimming that functionality out to other plugins, so I'm not interested in implementing something like that in this plugin