mhinz / vim-startify

:link: The fancy start screen for Vim.
MIT License
5.31k stars 187 forks source link

Markers for Funcref type #328

Closed VladimirPal closed 6 years ago

VladimirPal commented 6 years ago

Hi! How can i have an ability to use markers(s,b v) in Funcref type. for example i have a function:

function! s:list_modified()
  let files = systemlist('git ls-files -m')
  return map(files, '{"line": v:val, "cmd": "edit ". v:val }')
endfunction

let g:startify_lists = [
  \ { 'type': function('s:list_modified), 'header': ['Modified'] },
\ ]

Do you have a function which I can use for it? Thanks.

mhinz commented 6 years ago

You mean so that v would split the window vertically etc. even for funcrefs?

I'd like to avoid introducing another key (besides line and cmd), but we could change cmd so that if it contains a valid path (instead of a command), use the marker type for opening it.

I'll hack up a PoC later today!

mhinz commented 6 years ago

Please update the plugin and change one line in your example:

return map(files, '{"line": v:val, "path": v:val }')

If it works for you, I'll add it to the documentation.

VladimirPal commented 6 years ago

Works like a charm. Thank you.

VladimirPal commented 6 years ago

If the function returns an empty list it will cause the error, I've fixed in the PR.