bar.lua 1.8 KB

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