utilyre / barbecue.nvim

Visual Studio Code inspired breadcrumbs plugin for the Neovim editor
MIT License
776 stars 31 forks source link

[BUG]: Conflicts with winbars from other plugins, even when their filetype is added to exclude_filetypes #54

Closed braxtons12 closed 1 year ago

braxtons12 commented 1 year ago

Requirements

Expected Behavior

This plugin shouldn't affect other plugins' winbars when those plugins' filetypes are added to exclude_filetypes; Neotree's source_selector should appear all the time when the Neotree is open.

Actual Behavior

When using this plugin and Neotree with its source_selector at the same time, the source_selector won't appear when:

* Neotree is focused
* Something else is focused, but focus has not changed from one buffer to another at least once.

This break is caused by barbecue (uninstalling barbecue returns source_selector behavior to normal)

Neovim Version

NVIM v0.9.0-dev-810+gb8288df99

Minimal Configuration

local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
local packer_bootstrap = nil
---@diagnostic disable-next-line: param-type-mismatch
if vim.fn.empty(vim.fn.glob(install_path, nil, nil, nil)) > 0 then
    packer_bootstrap = vim.fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim',
        install_path })
end

require('packer').startup(function(use)
    use "wbthomason/packer.nvim"

    if packer_bootstrap ~= nil then
        require('packer').sync()
    end
end)

local packer = require("packer)

packer.use {
    "SmiteshP/nvim-navic",
    requires = "neovim/nvim-lspconfig",
}
packer.use {
    "utilyre/barbecue.nvim",
    requires = {
        "neovim/nvim-lspconfig",
        "SmiteshP/nvim-navic",
    },
    config = function()
        require("barbecue").setup {
            attach_navic = false,
            show_modified = true,
            symbols = {
                separator = "",
            },
            create_autocmd = false,
            theme = {
                normal = { fg = "#9daaaa", bg = "#24292f" }
            },
            include_buftypes = {
                ""
            },
            exclude_filetypes = {
                "gitcommit",
                "toggleterm",
                "aerial",
                "neo-tree",
                "terminal",
            },
        }

        vim.api.nvim_create_autocmd(
            {
                "WinScrolled",
                "BufWinEnter",
                "CursorHold",
                "CursorMoved",
                "CursorMovedI",
                "InsertLeave",
                "BufWritePost",
                "TextChanged",
                "TextChangedI",
            },
            {
                group = vim.api.nvim_create_augroup("barbecue#create_autocmd", {}),
                callback = function()
                    require("barbecue.ui").update()
                end
            })
    end,
}
packer.use {
    "nvim-neo-tree/neo-tree.nvim",
    branch = "v2.x",
    requires = {
        "nvim-lua/plenary.nvim",
        "nvim-tree/nvim-web-devicons",
        "MunifTanjim/nui.nvim",
        {
            -- only needed if you want to use the commands with "_with_window_picker" suffix
            's1n7ax/nvim-window-picker',
            tag = "v1.*",
            config = function()
                require 'window-picker'.setup({
                    autoselect_one = false,
                    include_current = false,
                    filter_rules = {
                        -- filter using buffer options
                        bo = {
                            -- if the file type is one of following, the window will be ignored
                            filetype = {
                                "neo-tree",
                                "neo-tree-popup",
                                "notify",
                                "aerial",
                                "packer"
                            },
                            -- if the buffer type is one of following, the window will be ignored
                            buftype = {
                                "terminal",
                                "quickfix"
                            },
                        },
                    },
                    other_win_hl_color = "#61afef",
                })
            end,
        }
    },
    config = function()
        vim.cmd("let g:neo_tree_remove_legacy_commands = 1")

        require("neo-tree").setup {
            sources = {
                "filesystem",
                "git_status",
            },
            source_selector = {
                winbar = true,
                statusline = false,
                show_scrolled_off_parent_node = false,
                content_layout = "start",
                tab_labels = {
                    filesystem = "  File",
                    buffers = " Buffer",
                    git_status = " Git",
                    diagnostics = "裂Lints"
                }
            },
            hide_root_node = true,
            expand_all_nodes = false,
            close_if_last_window = true,
            popup_border_style = "rounded",
            enable_git_status = true,
            enable_diagnostics = true,
            sort_case_insensitive = true,
            default_component_configs = {
                indent = {
                    indent_size = 2,
                    padding = 1,
                    with_markers = true,
                    indent_marker = "│",
                    last_indent_marker = "└",
                    highlight = "NeoTreeIndentMarker",
                    with_expanders = true,
                    expander_collapsed = "",
                    expander_expanded = "",
                    expander_highlight = "NeoTreeExpander",
                },
                icon = {
                    folder_closed = "",
                    folder_open = "",
                    folder_empty = "",
                    default = "",
                },
                name = {
                    trailing_slash = false,
                    use_git_status_colors = true,
                },
                git_status = {
                    symbols = {
                        added = "",
                        deleted = "",
                        modified = "",
                        renamed = "➜",
                        untracked = "★",
                        ignored = "◌",
                        unstaged = "✗",
                        staged = "✓",
                        conflict = "",
                    },
                },
            },
            window = {
                position = "left",
                width = 30,
                mappings = {
                    ["<2-LeftMouse>"] = "open",
                    ["<cr>"] = "open",
                    ["e"] = "open",
                    ["s"] = "open_vsplit",
                    ["R"] = "refresh",
                    ["a"] = "add",
                    ["d"] = "delete",
                    ["r"] = "rename",
                    ["y"] = "copy_to_clipboard",
                    ["x"] = "cut_to_clipboard",
                    ["p"] = "paste_from_clipboard",
                    ["q"] = "close_window",
                    ["<C-t>"] = "close_window",
                    ["<"] = "prev_source",
                    [">"] = "next_source",
                },
            },
            filesystem = {
                filtered_items = {
                    visible = false,
                    hide_dotfiles = false,
                    hide_gitignored = false,
                    hide_by_name = {
                        ".DS_Store",
                        "thumbs.db",
                        "node_modules",
                        "__pycache__",
                    },
                },
                follow_current_file = true,
                hijack_netrw_behavior = "open_current",
                use_libuv_file_watcher = true,
                window = {
                    position = "left",
                    width = 30,
                    mappings = {
                        ["H"] = "toggle_hidden",
                        ["/"] = "filter_on_submit",
                        ["<c-x>"] = "clear_filter",
                    },
                },
            },
            buffers = {
                show_unloaded = true,
                window = {
                    position = "left",
                    width = 30,
                    mappings = {
                        ["bd"] = "buffer_delete",
                    },
                },
            },
            git_status = {
                follow_current_file = true,
                window = {
                    position = "left",
                    width = 30,
                    mappings = {
                        ["A"] = "git_add_all",
                        ["u"] = "git_unstage_file",
                        ["a"] = "git_add_file",
                        ["r"] = "git_revert_file",
                        ["c"] = "git_commit",
                        ["p"] = "git_push",
                        ["cp"] = "git_commit_and_push",
                    },
                },
            },
            event_handlers = {
                {
                    event = "vim_buffer_enter",
                    handler = function(_)
                        if vim.bo.filetype == "neo-tree" then
                            vim.wo.signcolumn = "auto"
                        end
                    end,
                },
            },
        }
    end
}
packer.use "folke/tokyonight.nvim"

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme!
vim.cmd([[colorscheme tokyonight]])

Reproduction

1. open neovim and update plugins:
    a. `nvim`
    b. `:PackerSync`
2. open neovim: `nvim some_file`
3. open Neotree `:Neotree`
4. Neotree's source_selector winbar isn't visible/behaves as said above
utilyre commented 1 year ago

From my testing, your repro is fixed now.

braxtons12 commented 1 year ago

Yep, it's fixed now!

Thanks!