goolord / alpha-nvim

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

Feature/startify fortune #21

Closed BlakeJC94 closed 2 years ago

BlakeJC94 commented 3 years ago

I ported the code from vim-startify (with permission from @mhinz) into this project, entirely in Lua!

Functionality is quite basic for now, only works with dashboard theme at this stage. The startify theme doesn't seem to have a footer, so this would need to be added if there's any requests)

The fortune footer is just a left aligned quote that fits the width of the rest of the menu items (hardcoded in main()). If a quote attribution is present, that will be right-aligned (see attached image of my configuration)

alpha-nvim-config

Testing

Here's a really basic init.lua to test this new feature on my fork:

vim.opt.termguicolors = true
return require('packer').startup(function()
    use 'wbthomason/packer.nvim'
    use {
        'BlakeJC94/alpha-nvim', branch = 'feature/startify-fortune',
        config = function ()
            require'alpha.themes.dashboard'.section.footer.val = require'alpha.fortune'()
            require'alpha'.setup(require'alpha.themes.dashboard'.opts)
        end
    }
end)

Save this to ~/alpha-test-init.lua, run $ vim -u ~/alpha-test-init.lua and then :PackerSync to see the new footer in a basic configuration

goolord commented 3 years ago

very cool, commendable effort. i am hesitant to merge only because i think it would be neat for code like this to live in their own repositories/gists/luarocks. either way it will certainly be mentioned in the docs : )

goolord commented 3 years ago

The startify theme doesn't seem to have a footer

yeaaaah you could put it in bottom_buttons or something but i suppose there really ought to be a footer section just for consistency

BlakeJC94 commented 3 years ago

very cool, commendable effort. i am hesitant to merge only because i think it would be neat for code like this to live in their own repositories/gists/luarocks. either way it will certainly be mentioned in the docs : )

No worries, what would you like to do with the fortune code then? I could pull it out to it's own repo then inform uses on the alpha-nvim README to also add this as a dependency. Or we could merge this into alpha-nvim and I'll host the standalone code in a gist for anyone who would like to use it elsewhere?

From a user standpoint, it might be easier to keep it all bundled together instead of going down the additional dependencies route. It's a relatively niche function and I can't imagine there's any pressing use for it elsewhere.

Happy to proceed in whichever way you see fit :)

goolord commented 3 years ago

to clarify, it's a tossup for me. i'm erring on the side of 'merge it' because bundling any and all relevant features in one plugin seems to be convention in the vim community. however, https://github.com/hrsh7th/nvim-cmp for instance goes the "require additional plugins" route for its sources and it's pretty nice

BlakeJC94 commented 3 years ago

Ah yeah, I've seen that too. The niceness of the "CMP" method is a bit subjective. CMP is also handling much larger functional units, so I can see why they made the choice to split it up.

Since this plugin is much smaller and focussed in comparison, I would personally vote to keep it all in one place for now.

It wouldn't be hard to stratify it later if the need arises. Keeping it all in one location will ensure we only have one repo to worry about with updates rather than many repos

On Sat, 11 Sep 2021, 1:54 pm Zachary Churchill, @.***> wrote:

to clarify, it's a tossup for me. i'm erring on the side of 'merge it' because bundling any and all relevant features in one plugin seems to be convention in the vim community. but, https://github.com/hrsh7th/nvim-cmp goes the "require additional plugins" route for its sources and it's pretty nice

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/goolord/alpha-nvim/pull/21#issuecomment-917333433, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD66TWWPRHS3SV3E2CXNL7TUBLHFVANCNFSM5D2OI5HQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

goolord commented 2 years ago

deciding to merge, it is a pretty negligible addition (small-ish file, no depencies) and probably popular enough that i just want it in here. i might change my mind later if the number of extensions to this plugin gets out of hand tho ,':^Y