bufferline.lua 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. local status, bufferline = pcall(require, "bufferline")
  2. if not status then
  3. vim.notify("没有找到 bufferline")
  4. return
  5. end
  6. -- bfferline 配置
  7. -- https://github.com/akinsho/bufferline.nvim#configuration
  8. bufferline.setup({
  9. options = {
  10. -- 关闭 Tab 的命令
  11. close_command = "Bdelete! %d",
  12. right_mouse_command = "Bdelete! %d",
  13. -- 侧边栏配置
  14. -- 左侧让出 nvim-tree 的位置,显示文字 File Explorer
  15. offsets = {
  16. {
  17. filetype = "NvimTree",
  18. text = "File Explorer",
  19. highlight = "Directory",
  20. text_align = "left",
  21. },
  22. },
  23. -- 使用 nvim 内置 LSP 后续课程会配置
  24. diagnostics = "nvim_lsp",
  25. -- 可选,显示 LSP 报错图标
  26. ---@diagnostic disable-next-line: unused-local
  27. diagnostics_indicator = function(count, level, diagnostics_dict, context)
  28. local s = " "
  29. for e, n in pairs(diagnostics_dict) do
  30. local sym = e == "error" and " " or (e == "warning" and " " or "")
  31. s = s .. n .. sym
  32. end
  33. return s
  34. end,
  35. },
  36. })