mhinz / vim-startify

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

Cannot run :checkhealth command in Neovim #358

Closed malob closed 5 years ago

malob commented 5 years ago

When I run :checkhealth from any buffer in nvim, a new tab is opened that displays Startify (but without any colors and I get the following error:

Running healthchecks...
Error detected while processing function health#check:
line   19:
E21: Cannot make changes, 'modifiable' is of

I'm running Neovim 0.3.4, with the latest version of Startify and the following configuration options in my init.vim for Startify:

let g:startify_update_oldfiles = 1
let g:startify_relative_path   = 1
let g:startify_fortune_use_unicode = 1
let g:startify_files_number = 7
let g:startify_lists = [
\ {'type': 'files',     'header': ['    🕘  Recent']              },
\ {'type': 'dir',       'header': ['    🕘  Recent in '. getcwd()]},
\ {'type': 'bookmarks', 'header': ['    🔖  Bookmarks']           },
\ {'type': 'commands',  'header': ['    🔧  Commands']            }
\ ]

let g:startify_bookmarks = [
\ {'n': '~/.config/nvim/init.vim'   },
\ {'f': '~/.config/fish/config.fish'}
\ ]

let g:startify_commands = [
\ {'t': ['Open Terminal',  'term']                       },
\ {'u': ['Update plugins', 'te ~/.config/nvim/update.sh']},
\ ]
mhinz commented 5 years ago

This plugin doesn't run on its own when creating a new tab. That must happen because of a custom autocmd.

malob commented 5 years ago

Thanks for the quick response!

You're totally right. I had au TabNewEntered * Startify in my config. Removing it solved the issue.

Any quick ideas off the top of your head about how I could get new empty tabs to open with Startify but when commands like checkhealth open a new tab, those don't trigger Startify?

mhinz commented 5 years ago

The problem is that :checkhealth will eventually run this line. Due to that :tabnew, :Startify will run before going to the next line and the following code simply expects a normal empty scratch buffer instead of a Startify buffer.

The only way around that would be changing the checkhealth code. I'll discuss that with the Nvim team!

mhinz commented 5 years ago

So, we came to the conclusion not to change the above line from checkhealth to noautocmd tabnew, because that could break other plugins.

Instead I'll change the FAQ (:h startify-faq-17) to mention that running :Startify on a new tab could result in all kinds of issues like this and that everyone should know exactly what they're doing.

In this particular case, you can work around this via :noau checkhealth (or better remove that autocmd and just create a mapping for :Startify).

Probably not what you wanted to hear, but this is one of the cases that has no real solution. Fixing one's workflow, breaks the workflow of someone else.

malob commented 5 years ago

Thanks man, really appreciate the help/info!