aaronhallaert / advanced-git-search.nvim

Search your git history by commit message, content and author in Neovim
Apache License 2.0
340 stars 8 forks source link

Set theme and layout simultaneously? #62

Closed FriendlyTroll closed 9 months ago

FriendlyTroll commented 9 months ago

Hi,

thanks for the awesome plugin!

I tried setting the theme and layout but that doesn't work?

            extensions = {
                advanced_git_search = {
                    telescope_theme = {
                        -- search_log_content = "dropdown",
                        search_log_content = { layout_config = { width = 0.8, height = 0.8 }, theme = "dropdown" },
                        search_log_content_file = "dropdown",
                    },
                },
            },

The commented line does work fine, but combining theme with layout doesn't. Am I doing smth wrong?

aaronhallaert commented 9 months ago

I think you'll have to do something like this if you want to customize an existing theme. https://github.com/nvim-telescope/telescope.nvim/issues/765#issuecomment-881956538

Or you could use layout_strategy as explained here https://github.com/nvim-telescope/telescope.nvim?tab=readme-ov-file#layout-display

aaronhallaert commented 9 months ago

Or you can do this:

            telescope_theme = {
                search_log_content = require("telescope.themes").get_dropdown({
                    layout_config = { width = 0.8, height = 0.2 },
                }),
            },
FriendlyTroll commented 9 months ago

Thanks for the fast reply!

I went with this (full lazy nvim snippet for anyone else looking into this):

return {
    "aaronhallaert/advanced-git-search.nvim",
    dependencies = {
        "nvim-telescope/telescope.nvim",
        -- to show diff splits and open commits in browser
        "tpope/vim-fugitive",
    },
    config = function()
        -- optional: setup telescope before loading the extension
        require("telescope").setup({
            extensions = {
                advanced_git_search = {
                    telescope_theme = {
                        search_log_content = {
                            layout_config = { width = 0.8, height = 0.8 },
                            layout_strategy = "vertical",
                        },
                        search_log_content_file = {
                            layout_config = { width = 0.8, height = 0.8 },
                            layout_strategy = "vertical",
                        },
                    },
                },
            },
        })

        require("telescope").load_extension("advanced_git_search")
    end,
}