mhinz / vim-startify

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

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 #484

Open michael-odonovan opened 3 years ago

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]..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

mhinz commented 3 years ago

That shouldn't happen by default. What options do you have set? It gets a Dictionary when it expects a String.

michael-odonovan commented 3 years ago

Hi, Thanks for coming back to me. This is everything I have set at the moment:

let g:startify_custom_header = [
\'    __        __          _ _         ____  _     _             ',
\'    \ \      / /__   ___ | | |_   _  |  _ \| |__ (_)_ __   ___  ',
\'     \ \ /\ / / _ \ / _ \| | | | | | | |_) |  _ \| |  _ \ / _ \ ',
\'      \ V  V / (_) | (_) | | | |_| | |  _ <| | | | | | | | (_) |',
\'       \_/\_/ \___/ \___/|_|_|\__, | |_| \_\_| |_|_|_| |_|\___/ ',
\'                              |___/                             ',
\'    <leader>S     :Startify               V   open file in a vsp',
\'    :SSave[!]     save a session          T   open file in a tab',
\'    :SDelete[!]   delete a session        e   open a blank file',
\]

let g:startify_session_dir = '~/.config/nvim/sessions'
let g:startify_session_persistence = 0 " automatically update sessions
let g:startify_files_number = 10
let g:startify_change_to_dir = 1
let g:startify_change_to_vcs_root = 0
let g:startify_padding_left = 5
let g:startify_session_sort = 1 " sort sessions by modification time
let g:startify_enable_special = 0 " gets rid of [e] and [q]

let s:bookmarks1 = [
        \ '~/.config/nvim/init.vim', 
        \ '~/.config/nvim/colors/daytona.vim',
        \ ]
let s:bookmarks2 = [
        \ '~/documents/notes', 
        \ '~/coding-files',
        \ ]

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}')}},
      \ ]

map <leader>s :Startify<CR>
mhinz commented 3 years ago

That exact configuration is working fine here with Nvim 0.4.4 and Nvim master. Maybe double-check your vim-startify plugin is up-to-date.

Are you sure there isn't any other configuration left over somewhere else? Maybe check :echo g:startify_lists when Nvim started. :)

Otherwise we need to figure out why append() is getting wrong arguments. For that, open autoload/startify.vim, and add the following line above the line with append():

        echomsg 'DEBUG: '. s:leftpad .'['. index .']'. repeat(' ', (3 - strlen(index))) . entry.line

Then start Nvim again, you probably get the error again, but then check :messages for the DEBUG messages.

michael-odonovan commented 3 years ago

Hi, When I run :echo g:startify_lists it returns

[{'header': ['   Files'], 'type': function('<lambda>1')}, {'header': ['   Folders'],
'type': function('<lambda>2')}]

I have gone to /.config/nvim/plugins-storage/vim-startify/autoload/startify.vim and done a search /append() and there is no match. there are multiple matches for call append functions but I out of my depth from here...

sorry I did an edit as I messed up your instructions first time. thanks mike

mhinz commented 3 years ago

I linked the exact line above. :)

https://github.com/mhinz/vim-startify/blob/5ee8914b26e9f0b2d8ec01b3cef8c46e7a3954b5/autoload/startify.vim#L516

michael-odonovan commented 3 years ago

Oops sorry missed that. I didn't get an error on startup but then got the same error when opening startify from within nvim. :messages gives - DEBUG: [0] ~/.config/nvim/init.vim DEBUG: [1] ~/.config/nvim/colors/daytona.vim DEBUG: [2] ~/documents/notes DEBUG: [3] ~/coding-files Error detected while processing function startify#insane_in_the_membrane[81]..63 _show_lists: line 35: E731: using Dictionary as a String

thanks again Mike