goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.92k stars 113 forks source link

alpha-nvim hijacks the Man buffer #44

Closed jdhao closed 2 years ago

jdhao commented 3 years ago

I am using neovim as my man pager using the following shell config:

if [[ "$(command -v nvim)" ]]; then
    export EDITOR='nvim'
    export MANPAGER='nvim +Man!'
    export MANWIDTH=999
fi

without alpha nvim, it works well when I run man ls. After using alpha-nvim, nvim opens, but the alpha-nvim start page is shown instead of the man page.

jdhao commented 3 years ago

Upon inspecting the neovim help on startup, it seems that VimEnter event is fired after +cmd, so alpha-nvim is overriding the buffer created by Man! command. It seems that alpah-nvim should add a check condition for the existing buffer?

goolord commented 3 years ago

hmm the hotfix is just to change +Man! to -c Man!, i have not been able to find a set of predicates for alpha opening that doesn't break any plugins https://github.com/goolord/alpha-nvim/blob/main/lua/alpha.lua#L396

jdhao commented 3 years ago

@goolord Would like me to make a pull request for this?

  1. Maybe we should make the condition checking a separate function? The current condition is getting too long.
  2. Nvim has quite a few command-line options, should we just skip loading alpha-nvim if the user provides some argument for nvim? If the user provides some argument to nvim command, they may have something in mind to do. I do not think they want to see a fancy startup screen. They just want to go to work on their project.
goolord commented 3 years ago

to 2., yeah i think that would be the optimal solution but i think this would probably break the plugin if someone aliases neovim or something. i'm unsure. i'll look at the neovim manpage some time and see if that's an option, atm the behavior is supposed to be closer to how startify/dashboard check

jdhao commented 3 years ago

@goolord you mean the user does something like this in their shell startup file: alias nvim="nvim -someoption"? I am not aware of the usefulness of this alias after inspecting the nvim command line options.

jdhao commented 3 years ago

Maybe we can just disable alpha-nvim once a command line argument is detected. If a user later complains about this, then collect their use cases and adjust the skip strategy.

Anyway, IMHO, the skip condition should be made a separate function to make the code cleaner.

goolord commented 2 years ago

should be fixed by https://github.com/goolord/alpha-nvim/pull/47