barbar.lua 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. local map = vim.api.nvim_set_keymap
  2. local opts = { noremap = true, silent = true }
  3. -- Move to previous/next
  4. map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
  5. map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
  6. -- Re-order to previous/next
  7. map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts)
  8. map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts)
  9. -- Goto buffer in position...
  10. map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
  11. map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
  12. map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
  13. map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
  14. map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
  15. map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
  16. map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
  17. map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
  18. map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
  19. map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
  20. -- Pin/unpin buffer
  21. map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
  22. -- Close buffer
  23. map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
  24. -- Wipeout buffer
  25. -- :BufferWipeout
  26. -- Close commands
  27. -- :BufferCloseAllButCurrent
  28. -- :BufferCloseAllButPinned
  29. -- :BufferCloseAllButCurrentOrPinned
  30. -- :BufferCloseBuffersLeft
  31. -- :BufferCloseBuffersRight
  32. -- Magic buffer-picking mode
  33. map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)
  34. -- Sort automatically by...
  35. map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
  36. map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts)
  37. map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts)
  38. map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
  39. -- Other:
  40. -- :BarbarEnable - enables barbar (enabled by default)
  41. -- :BarbarDisable - very bad command, should never be used
  42. --
  43. -- Set barbar's options
  44. require'bufferline'.setup {
  45. -- Enable/disable animations
  46. animation = true,
  47. -- Enable/disable auto-hiding the tab bar when there is a single buffer
  48. auto_hide = false,
  49. -- Enable/disable current/total tabpages indicator (top right corner)
  50. tabpages = true,
  51. -- Enable/disable close button
  52. closable = true,
  53. -- Enables/disable clickable tabs
  54. -- - left-click: go to buffer
  55. -- - middle-click: delete buffer
  56. clickable = true,
  57. -- Enables / disables diagnostic symbols
  58. diagnostics = {
  59. -- you can use a list
  60. {enabled = true, icon = 'ff'}, -- ERROR
  61. {enabled = false}, -- WARN
  62. {enabled = false}, -- INFO
  63. {enabled = true}, -- HINT
  64. -- OR `vim.diagnostic.severity`
  65. [vim.diagnostic.severity.ERROR] = {enabled = true, icon = 'ff'},
  66. [vim.diagnostic.severity.WARN] = {enabled = false},
  67. [vim.diagnostic.severity.INFO] = {enabled = false},
  68. [vim.diagnostic.severity.HINT] = {enabled = true},
  69. },
  70. -- Excludes buffers from the tabline
  71. exclude_ft = {'javascript'},
  72. exclude_name = {'package.json'},
  73. -- Hide inactive buffers and file extensions. Other options are `alternate`, `current`, and `visible`.
  74. hide = {extensions = true, inactive = true},
  75. -- Disable highlighting alternate buffers
  76. highlight_alternate = false,
  77. -- Disable highlighting file icons in inactive buffers
  78. highlight_inactive_file_icons = false,
  79. -- Enable highlighting visible buffers
  80. highlight_visible = true,
  81. -- Enable/disable icons
  82. -- if set to 'numbers', will show buffer index in the tabline
  83. -- if set to 'both', will show buffer index and icons in the tabline
  84. icons = false,
  85. -- If set, the icon color will follow its corresponding buffer
  86. -- highlight group. By default, the Buffer*Icon group is linked to the
  87. -- Buffer* group (see Highlighting below). Otherwise, it will take its
  88. -- default value as defined by devicons.
  89. icon_custom_colors = false,
  90. -- Configure icons on the bufferline.
  91. icon_separator_active = '▎',
  92. icon_separator_inactive = '▎',
  93. icon_close_tab = '',
  94. icon_close_tab_modified = '●',
  95. icon_pinned = '車',
  96. -- If true, new buffers will be inserted at the start/end of the list.
  97. -- Default is to insert after current buffer.
  98. insert_at_end = false,
  99. insert_at_start = false,
  100. -- Sets the maximum padding width with which to surround each tab
  101. maximum_padding = 1,
  102. -- Sets the minimum padding width with which to surround each tab
  103. minimum_padding = 1,
  104. -- Sets the maximum buffer name length.
  105. maximum_length = 30,
  106. -- If set, the letters for each buffer in buffer-pick mode will be
  107. -- assigned based on their name. Otherwise or in case all letters are
  108. -- already assigned, the behavior is to assign letters in order of
  109. -- usability (see order below)
  110. semantic_letters = true,
  111. -- New buffer letters are assigned in this order. This order is
  112. -- optimal for the qwerty keyboard layout but might need adjustement
  113. -- for other layouts.
  114. letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP',
  115. -- Sets the name of unnamed buffers. By default format is "[Buffer X]"
  116. -- where X is the buffer number. But only a static string is accepted here.
  117. no_name_title = nil,
  118. }