From 29d0fd64d584ca8e9fcb31ef038624566d1a0a84 Mon Sep 17 00:00:00 2001 From: Andy <8334252+acarl005@users.noreply.github.com> Date: Sun, 16 Jun 2024 08:34:05 -0400 Subject: [PATCH] fix(bufferline-nvim): add back bufferline leader bindings (#1041) * fix(bufferline-nvim): add back bufferline leader bindings Since this import uses `astrocommunity.recipes.disable-tabline`, it disables all the `b` bindings too. This PR adds back the bufferline equivalents of those bindings. * run stylua --- .../bars-and-lines/bufferline-nvim/init.lua | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/lua/astrocommunity/bars-and-lines/bufferline-nvim/init.lua b/lua/astrocommunity/bars-and-lines/bufferline-nvim/init.lua index 59d1d7eab..cba73a802 100644 --- a/lua/astrocommunity/bars-and-lines/bufferline-nvim/init.lua +++ b/lua/astrocommunity/bars-and-lines/bufferline-nvim/init.lua @@ -18,6 +18,66 @@ return { function() require("bufferline.commands").move(-vim.v.count1) end, desc = "Move buffer tab left", }, + ["bb"] = { + function() require("bufferline.commands").pick() end, + desc = "Navigate to buffer tab with interactive picker", + }, + ["bc"] = { + function() require("bufferline.commands").close_others() end, + desc = "Close all buffers except the current", + }, + ["bd"] = { + function() require("bufferline.commands").close_with_pick() end, + desc = "Delete a buffer tab with interactive picker", + }, + ["bl"] = { + function() require("bufferline.commands").close_in_direction "left" end, + desc = "Close all buffers to the left of the current", + }, + ["br"] = { + function() require("bufferline.commands").close_in_direction "right" end, + desc = "Close all buffers to the right of the current", + }, + ["bse"] = { + function() require("bufferline.commands").sort_by "extension" end, + desc = "Sort buffers by extension", + }, + ["bsi"] = { + function() require("bufferline.commands").sort_by "id" end, + desc = "Sort buffers by buffer number", + }, + ["bsm"] = { + function() + require("bufferline.commands").sort_by(function(a, b) return a.modified and not b.modified end) + end, + desc = "Sort buffers by last modification", + }, + ["bsp"] = { + function() require("bufferline.commands").sort_by "directory" end, + desc = "Sort buffers by directory", + }, + ["bsr"] = { + function() require("bufferline.commands").sort_by "relative_directory" end, + desc = "Sort buffers by relative directory", + }, + ["b\\"] = { + function() + require("bufferline.pick").choose_then(function(id) + vim.cmd "split" + vim.cmd("buffer " .. id) + end) + end, + desc = "Open a buffer tab in a new horizontal split with interactive picker", + }, + ["b|"] = { + function() + require("bufferline.pick").choose_then(function(id) + vim.cmd "vsplit" + vim.cmd("buffer " .. id) + end) + end, + desc = "Open a buffer tab in a new vertical split with interactive picker", + }, }, }, },