Skip to content

Commit c05cd32

Browse files
refactor: modularise snacks integration for bufferline
1 parent 4f4c0e1 commit c05cd32

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

lua/plugins/bufferline.lua

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
-- TODO: Modularise snacks integration
2-
31
local default_opts = {
42
options = {
53
offsets = {
@@ -13,16 +11,6 @@ local default_opts = {
1311
},
1412
}
1513

16-
local function config(_, opts)
17-
if Snacks then
18-
opts.options = opts.options or {}
19-
opts.options.close_command = "lua Snacks.bufdelete.delete(%d)"
20-
opts.options.right_mouse_command = opts.options.close_command
21-
end
22-
23-
require("bufferline").setup(opts)
24-
end
25-
2614
return {
2715
"akinsho/bufferline.nvim",
2816
dependencies = "nvim-tree/nvim-web-devicons",
@@ -43,5 +31,4 @@ return {
4331
},
4432

4533
opts = default_opts,
46-
config = config,
4734
}

lua/plugins/snacks.lua

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,24 @@ return {
7373
config = config,
7474

7575
specs = {
76-
"catppuccin/nvim",
77-
optional = true,
78-
opts = {
79-
integrations = {
80-
snacks = { enabled = true },
76+
{
77+
"catppuccin/nvim",
78+
optional = true,
79+
opts = {
80+
integrations = {
81+
snacks = { enabled = true },
82+
},
83+
},
84+
},
85+
86+
{
87+
"akinsho/bufferline.nvim",
88+
optional = true,
89+
opts = {
90+
options = {
91+
close_command = "lua Snacks.bufdelete.delete(%d)",
92+
right_mouse_command = "lua Snacks.bufdelete.delete(%d)",
93+
},
8194
},
8295
},
8396
},

0 commit comments

Comments
 (0)