Skip to content

Commit

Permalink
refactor(snacks.nvim): migrate 'dressing'/'ibl'/'bbye' to 'snacks' (#692
Browse files Browse the repository at this point in the history
)
  • Loading branch information
linrongbin16 authored Feb 13, 2025
1 parent a6c9460 commit b30b283
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 22 deletions.
8 changes: 6 additions & 2 deletions lua/configs/akinsho/bufferline-nvim/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ local str = require("commons.str")
require("bufferline").setup({
options = {
numbers = "ordinal",
close_command = "Bdelete! %d", -- vim-bbye
right_mouse_command = "Bdelete! %d", -- vim-bbye
close_command = function(bufnr)
require("snacks").bufdelete({ buf = bufnr, force = true })
end,
right_mouse_command = function(bufnr)
require("snacks").bufdelete({ buf = bufnr, force = true })
end,
name_formatter = function(buf)
local max_name_len = layout.editor.width(0.334, 60, nil)
local name = buf.name
Expand Down
19 changes: 19 additions & 0 deletions lua/configs/folke/snacks-nvim/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local constants = require("builtin.constants")

require("snacks").setup({
styles = {
input = {
border = constants.window.border,
relative = "cursor",
row = 1,
col = 0,
keys = {
i_esc = { "<esc>", { "cmp_close", "cancel" }, mode = "i", expr = true },
},
},
},
indent = { enabled = true, animate = { enabled = false }, scope = { enabled = false } },
input = {
enabled = true,
},
})
12 changes: 12 additions & 0 deletions lua/configs/folke/snacks-nvim/keys.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local set_lazy_key = require("builtin.utils.keymap").set_lazy_key

local M = {
set_lazy_key("n", "<leader>bd", function()
require("snacks").bufdelete()
end, { desc = "Close buffer" }),
set_lazy_key("n", "<leader>bD", function()
require("snacks").bufdelete({ force = true })
end, { desc = "Close buffer forcibly!" }),
}

return M
28 changes: 8 additions & 20 deletions lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ local M = {
"linrongbin16/commons.nvim",
lazy = true,
},
-- Colorschemes
{
"linrongbin16/colorbox.nvim",
priority = 1000,
Expand All @@ -40,6 +41,13 @@ local M = {
require("colorbox").update()
end,
},
-- UI improvements
{
"folke/snacks.nvim",
priority = 1000,
config = lua_config("folke/snacks.nvim"),
keys = lua_keys("folke/snacks.nvim"),
},

-- ---- HIGHLIGHT ----

Expand Down Expand Up @@ -90,25 +98,12 @@ local M = {
config = lua_config("nvim-neo-tree/neo-tree.nvim"),
keys = lua_keys("nvim-neo-tree/neo-tree.nvim"),
},
-- Tabline
{
"moll/vim-bbye",
cmd = { "Bdelete", "Bwipeout" },
keys = lua_keys("moll/vim-bbye"),
},
{
"akinsho/bufferline.nvim",
event = { VeryLazy },
dependencies = { "moll/vim-bbye" },
config = lua_config("akinsho/bufferline.nvim"),
keys = lua_keys("akinsho/bufferline.nvim"),
},
-- Indentline
{
"lukas-reineke/indent-blankline.nvim",
event = { VeryLazy },
config = lua_config("lukas-reineke/indent-blankline.nvim"),
},
-- Git
{
"airblade/vim-gitgutter",
Expand All @@ -135,13 +130,6 @@ local M = {
},
config = lua_config("rebelot/heirline.nvim"),
},
-- UI improvement
{
"stevearc/dressing.nvim",
event = { VeryLazy },
dependencies = { "junegunn/fzf" },
config = lua_config("stevearc/dressing.nvim"),
},
{
"stevearc/stickybuf.nvim",
event = { VeryLazy },
Expand Down

0 comments on commit b30b283

Please sign in to comment.