bar.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. return {
  2. "akinsho/bufferline.nvim",
  3. version = "*",
  4. dependencies = "nvim-tree/nvim-web-devicons",
  5. opts = function()
  6. local Offset = require("bufferline.offset")
  7. if not Offset.edgy then
  8. local get = Offset.get
  9. Offset.get = function()
  10. if package.loaded.edgy then
  11. local layout = require("edgy.config").layout
  12. local ret = { left = "", left_size = 0, right = "", right_size = 0 }
  13. for _, pos in ipairs({ "left", "right" }) do
  14. local sb = layout[pos]
  15. if sb and #sb.wins > 0 then
  16. local title = " Sidebar" .. string.rep(" ", sb.bounds.width - 8)
  17. ret[pos] = "%#EdgyTitle#" .. title .. "%*" .. "%#WinSeparator#│%*"
  18. ret[pos .. "_size"] = sb.bounds.width
  19. end
  20. end
  21. ret.total_size = ret.left_size + ret.right_size
  22. if ret.total_size > 0 then
  23. return ret
  24. end
  25. end
  26. return get()
  27. end
  28. Offset.edgy = true
  29. end
  30. end,
  31. config = function()
  32. vim.opt.termguicolors = true
  33. require("bufferline").setup({
  34. options = {
  35. -- separator_style = "slant",
  36. -- style_preset = bufferline.style_preset.no_italic,
  37. diagnostics = "nvim_lsp",
  38. diagnostics_indicator = function(count, level)
  39. local icon = level:match("error") and " " or ""
  40. return " " .. icon .. count
  41. end,
  42. },
  43. })
  44. vim.g.transparent_groups = vim.list_extend(
  45. vim.g.transparent_groups or {},
  46. vim.tbl_map(function(v)
  47. return v.hl_group
  48. end, vim.tbl_values(require("bufferline.config").highlights))
  49. )
  50. end,
  51. }