mhinz / vim-startify

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

Disable from the command line? #332

Closed 097115 closed 6 years ago

097115 commented 6 years ago

Is there any way to disable Startify from the command line? As much as I love it, sometimes (when reading from stdin, from example) I just don't need it :).

mhinz commented 6 years ago

Huh, it shouldn't appear when you read from stdin (e.g. echo foo | vim -)

Can you give an example?

097115 commented 6 years ago

Yeah, vim - doesn't launches Startify. That's my bad in formulating a question. However, there also other cases.

I actually had in mind something like passing some command line parameter that would tell Vim not no launch Startify. But solved it via something like -c "call feedkeys('e')", which simply bypasses Startify and opens an empty buffer.

mhinz commented 6 years ago

Ah, okay. I thought there would be a bug. :)

Another way that keeps the plugin from even running would be:

$ vim -c 'let g:startify_disable_at_vimenter = 1'
097115 commented 6 years ago

More like "should be" :)

I mean, I tried that before opening the issue, but it didn't work for me. Probably because of this.

mhinz commented 6 years ago

Maybe change it to this:

if has('nvim')
  autocmd TabNewEntered * Startify
else
  autocmd BufEnter *
        \ if !exists('t:startify_new_tab') && empty(expand('%'))
        \     && (get(g:, 'startify_disable_at_vimenter', 1) && bufnr('') != 1) |
        \   let t:startify_new_tab = 1 |
        \   Startify |
        \ endif
endif

I'm not sure about the corner cases, because it's all just a big hack. (The Nvim version works as expected.)

097115 commented 6 years ago

Yeah, that seems working in Vim, too :) Thanks.