romgrk / barbar.nvim

The neovim tabline plugin.
2.16k stars 81 forks source link

Show Only Pinned Buffers #525

Closed Pandoks closed 10 months ago

Pandoks commented 10 months ago

Hey, I read the documentation, and either don't know how to do it, or it doesn't exist. This is my config right now:

return 
  {'romgrk/barbar.nvim',
    dependencies = {
      'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
      'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
    },
    init = function() vim.g.barbar_auto_setup = false end,
    lazy = false,
    opts = 
{
  animation = false,
  auto_hide = true,

  -- Hide inactive buffers and file extensions. Other options are `alternate`, `current`, and `visible`.
hide = {
        current = true,       -- Hide the current buffer
        visible = true,       -- Hide visible (active) buffers
        inactive = true,      -- Hide inactive (hidden) buffers
        alternate = true,     -- Hide alternate buffers
    },

  -- Disable highlighting file icons in inactive buffers

  icons = {
    button = false,
    diagnostics = {
      [vim.diagnostic.severity.ERROR] = {enabled = true},
      [vim.diagnostic.severity.WARN] = {enabled = false},
      [vim.diagnostic.severity.INFO] = {enabled = false},
      [vim.diagnostic.severity.HINT] = {enabled = false},
    },
    separator = {left = '', right = ''},
    separator_at_end = false,

    -- Configure the icons on the bufferline based on the visibility of a buffer.
    -- Supports all the base icon options, plus `modified` and `pinned`.
    pinned = {button = '', filename = true, extension = true},
  },
  insert_at_start = true,

  sidebar_filetypes = {
    NvimTree = true,
    undotree = true,
  },
    },
    keys = {
      { "<leader>b", "<cmd>BufferPick<cr>", mode = "n", desc = "Pick a buffer mode"},
      { "<leader>a", "<cmd>BufferPin<cr>", mode = "n", desc = "Pin a buffer"},
    },
  }

(Mind the indenting, my formatter isn't set up yet) As you can see, I hide everything, but is there an option where it shows pinned tabs like an option in hide for pinned = false?

I want it to hide everything and only show the tabs I have pinned manually. This would make it basically have the functionality of harpoon, but with a constant UI so I don't need to memorize what I have pinned.

Is there a way to achieve this, or is it impossible currently?

Iron-E commented 10 months ago

Currently no option for this, but it shouldn't be too hard to add. I'll see what can be done!

Iron-E commented 10 months ago

Try #527

Pandoks commented 10 months ago

When there is only one pinned tab, it doesn't show. Recreation: Open many files (load multiple buffers) Pin only one buffer Tab doesn't show.

Otherwise, everything works as expected. Tested with split windows and tabs (spaces).

Iron-E commented 10 months ago

You have auto_hide = true set, that will hide the tabline if there is only one buffer. Try setting that to false and see if that helps!

Pandoks commented 10 months ago

Works! Love this plugin!

Pandoks commented 10 months ago

Reopening this because I think the reason I wanted auto_hide on was because I wouldn't have this gap when there was nothing in the bar: image

Ideally, it would have no gap: image and then when I pinned something, it would show the bar.

Iron-E commented 10 months ago

I opened a new issue for that just now. I'll keep progress updates over there :)