mhinz / vim-startify

:link: The fancy start screen for Vim.
MIT License
5.3k stars 186 forks source link

Implementing Bookmark Groupings #422

Closed Shadorain closed 3 years ago

Shadorain commented 4 years ago

I know this ins't an issue exactly, but not sure where else to put this.

Was wondering if there is a way to group your bookmarks. From looking at the code itself it might be hard since everything is wrapping around g:startify_bookmarks, but if i am missing something, please let me know! Startify has become my daily organizer to be honest, so I put a ton of stuff in my bookmarks, it would be nice to have them grouped via custom header or something! Thanks so much!

mhinz commented 3 years ago

Sorry, I wasn't active on GitHub in recent months. :)

Since bookmarks are basically just a list of files that get opened via :edit, you could simulate it via custom lists:

function! s:bookmarks1()
  return [
        \ { 'line': 'file1', 'cmd': 'edit file1' },
        \ { 'line': 'file2', 'cmd': 'edit file2' },
        \ ]
endfunction

function! s:bookmarks2()
  return [
        \ { 'line': 'file3', 'cmd': 'edit file3' },
        \ { 'line': 'file4', 'cmd': 'edit file4' },
        \ ]
endfunction

let g:startify_lists = [
      \ { 'header': ['   MRU'],            'type': 'files' },
      \ { 'header': ['   MRU '. getcwd()], 'type': 'dir' },
      \ { 'header': ['   Sessions'],       'type': 'sessions' },
      \ { 'header': ['   Bookmarks 1'],    'type': function('s:bookmarks1') },
      \ { 'header': ['   Bookmarks 2'],    'type': function('s:bookmarks2') },
      \ ]

The format of these custom functions is explained under :h g:startify_lists.