Skip to content

Commit

Permalink
fix(bufferline-nvim): add back bufferline leader bindings (#1041)
Browse files Browse the repository at this point in the history
* fix(bufferline-nvim): add back bufferline leader bindings

Since this import uses `astrocommunity.recipes.disable-tabline`, it disables all the `<leader>b` bindings too. This PR adds back the bufferline equivalents of those bindings.

* run stylua
  • Loading branch information
acarl005 authored Jun 16, 2024
1 parent 5dcef71 commit 29d0fd6
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions lua/astrocommunity/bars-and-lines/bufferline-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,66 @@ return {
function() require("bufferline.commands").move(-vim.v.count1) end,
desc = "Move buffer tab left",
},
["<leader>bb"] = {
function() require("bufferline.commands").pick() end,
desc = "Navigate to buffer tab with interactive picker",
},
["<leader>bc"] = {
function() require("bufferline.commands").close_others() end,
desc = "Close all buffers except the current",
},
["<leader>bd"] = {
function() require("bufferline.commands").close_with_pick() end,
desc = "Delete a buffer tab with interactive picker",
},
["<leader>bl"] = {
function() require("bufferline.commands").close_in_direction "left" end,
desc = "Close all buffers to the left of the current",
},
["<leader>br"] = {
function() require("bufferline.commands").close_in_direction "right" end,
desc = "Close all buffers to the right of the current",
},
["<leader>bse"] = {
function() require("bufferline.commands").sort_by "extension" end,
desc = "Sort buffers by extension",
},
["<leader>bsi"] = {
function() require("bufferline.commands").sort_by "id" end,
desc = "Sort buffers by buffer number",
},
["<leader>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",
},
["<leader>bsp"] = {
function() require("bufferline.commands").sort_by "directory" end,
desc = "Sort buffers by directory",
},
["<leader>bsr"] = {
function() require("bufferline.commands").sort_by "relative_directory" end,
desc = "Sort buffers by relative directory",
},
["<leader>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",
},
["<leader>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",
},
},
},
},
Expand Down

0 comments on commit 29d0fd6

Please sign in to comment.