mhinz / vim-startify

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

Possible to have two different bookmark lists please? #480

Closed michael-odonovan closed 3 years ago

michael-odonovan commented 3 years ago

I would like to have more than one book mark list like so: let g:startify_lists = [ \ { 'type': 'sessions', 'header': [' Sessions'] }, \ { 'type': 'bookmarks', 'header': [' Files'] }, \ { 'type': 'bookmarks', 'header': [' Folders'] }, \ { 'type': 'dir', 'header': [' Current Directory '. getcwd()] }, \ { 'type': 'files', 'header': [' Recent Files'] }, \ ] It almost works, I get two bookmark lists, but they contain the same files as stipulated by let g:startify_bookmarks. Can I create two diferrent bookmark lists? With something like let g:startify_bookmarks(Files) = [ ...... let g:startify_bookmarks(Folders) = [ ...... I tried a few things but didn't get anywhere. Have read docs start to finish. Brilliant plugin by the way.

mhinz commented 3 years ago

With a bit of scripting you can do whatever you want, since g:startify_lists also takes a funcref type. So, you could emulate it like this:

let s:bookmarks1 = ['foo', 'bar']
let s:bookmarks2 = ['/tmp', '/etc']

let g:startify_lists = [
      \ {'header': ['   Files'],   'type': {-> map(s:bookmarks1, '{"line": v:val, "path": v:val}')}},
      \ {'header': ['   Folders'], 'type': {-> map(s:bookmarks2, '{"line": v:val, "path": v:val}')}},
      \ ]

I hope this helps!

michael-odonovan commented 3 years ago

Hey, This is awesome, exactly what I needed. Thanks so much! I should have looked into the funcref more, sorry I am quite new to programming, <1 year. Thanks again, I will update reddit. cheers Mike

michael-odonovan commented 3 years ago

Hello, Sorry to bring this up again, but when trying to go back to Startify from an open nvim buffer (:Startify) I get this error:

Error detected while processing function startify#insane_in_the_membrane[81]..<SNR>61_show_lists : line 35: E731: using Dictionary as a String E116: Invalid arguments for function append

I have checked it is caused by the added funcref/bookmarks. Startify opens initially fine from the command line though, just throws this error if you try to go back to it with :Startify. Any ideas I should try? Thanks again for your help and plugin. Mike

JetpackJackson commented 11 months ago

I'm having the exact same issue, is there a workaround or fix?