Skip to content

Commit 874118f

Browse files
enable group for bufferline
1 parent 0e34590 commit 874118f

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

lua/modules/buffers/config.lua

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
local config = {}
22

33
function config.nvim_bufferline()
4+
local fn = vim.fn
5+
local r = vim.regex
6+
local fmt = string.format
7+
local bufferline = require("bufferline")
48
local default = {
59
colors = require("core.utils").get(),
610
}
@@ -14,6 +18,61 @@ function config.nvim_bufferline()
1418
-- Code from NvChad
1519
require("bufferline").setup({
1620
options = {
21+
groups = {
22+
options = { toggle_hidden_on_enter = true },
23+
items = {
24+
bufferline.groups.builtin.pinned:with({ icon = "" }),
25+
bufferline.groups.builtin.ungrouped,
26+
{
27+
name = "Dependencies",
28+
icon = "",
29+
highlight = { fg = "#ECBE7B" },
30+
matcher = function(buf)
31+
return vim.startswith(buf.path, vim.env.VIMRUNTIME)
32+
end,
33+
},
34+
{
35+
name = "Terraform",
36+
matcher = function(buf)
37+
return buf.name:match("%.tf") ~= nil
38+
end,
39+
},
40+
{
41+
name = "Kubernetes",
42+
matcher = function(buf)
43+
return buf.name:match("kubernetes") and buf.name:match("%.yaml")
44+
end,
45+
},
46+
{
47+
name = "SQL",
48+
matcher = function(buf)
49+
return buf.name:match("%.sql$")
50+
end,
51+
},
52+
{
53+
name = "tests",
54+
icon = "",
55+
matcher = function(buf)
56+
local name = buf.name
57+
return name:match("[_%.]spec") or name:match("[_%.]test")
58+
end,
59+
},
60+
{
61+
name = "docs",
62+
icon = "",
63+
matcher = function(buf)
64+
if vim.bo[buf.id].filetype == "man" or buf.path:match("man://") then
65+
return true
66+
end
67+
for _, ext in ipairs({ "txt", "org", "wiki", "norg" }) do
68+
if ext == fn.fnamemodify(buf.path, ":e") then
69+
return true
70+
end
71+
end
72+
end,
73+
},
74+
},
75+
},
1776
hover = {
1877
enabled = true,
1978
delay = 0,

0 commit comments

Comments
 (0)