init.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. local M = {}
  2. M.config = function()
  3. require('bufferline').setup {
  4. options = {
  5. -- numbers = "none" | "ordinal" | "buffer_id" | "both",
  6. -- number_style = "superscript" | "" | { "none", "subscript" }, -- buffer_id at index 1, ordinal at index 2
  7. -- mappings = true | false,
  8. -- close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
  9. -- right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
  10. -- left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
  11. middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
  12. indicator_icon = '▎',
  13. buffer_close_icon = '',
  14. modified_icon = '●',
  15. close_icon = '',
  16. left_trunc_marker = '',
  17. right_trunc_marker = '',
  18. --- name_formatter can be used to change the buffer's label in the bufferline.
  19. --- Please note some names can/will break the
  20. --- bufferline so use this at your discretion knowing that it has
  21. --- some limitations that will *NOT* be fixed.
  22. -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
  23. -- -- remove extension from markdown files for example
  24. -- if buf.name:match('%.md') then
  25. -- return vim.fn.fnamemodify(buf.name, ':t:r')
  26. -- end
  27. -- end,
  28. max_name_length = 18,
  29. max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
  30. tab_size = 18,
  31. -- diagnostics = "nvim_lsp",
  32. offsets = {{filetype = "NvimTree", text = "File Explorer", text_align = "left", padding = 1}},
  33. -- show_buffer_icons = true | false, -- disable filetype icons for buffers
  34. show_buffer_close_icons = true
  35. -- show_close_icon = true | false,
  36. -- show_tab_indicators = true | false,
  37. -- persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
  38. -- can also be a table containing 2 custom separators
  39. -- [focused and unfocused]. eg: { '|', '|' }
  40. -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' },
  41. -- enforce_regular_tabs = false | true,
  42. -- always_show_bufferline = true | false,
  43. -- sort_by = 'extension' | 'relative_directory' | 'directory' | function(buffer_a, buffer_b)
  44. -- add custom logic
  45. -- return buffer_a.modified > buffer_b.modified
  46. -- end
  47. }
  48. }
  49. end
  50. return M