From 08a715f6375694f37be30afdddb2025dcde2133b Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 9 Aug 2024 05:57:20 +0200 Subject: Set bufferline shortcuts --- lua/ache/plugins/bufferline.lua | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/lua/ache/plugins/bufferline.lua b/lua/ache/plugins/bufferline.lua index 8fe18e3..8d2dbaa 100644 --- a/lua/ache/plugins/bufferline.lua +++ b/lua/ache/plugins/bufferline.lua @@ -1,11 +1,33 @@ return { - "akinsho/bufferline.nvim", - version = "*", - dependencies = "nvim-tree/nvim-web-devicons", - config = function() - vim.opt.termguicolors = true - require("bufferline").setup({}) - vim.keymap.set("n", "", "bnext") - vim.keymap.set("n", "", "bprev") - end, + "akinsho/bufferline.nvim", + version = "*", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() + vim.opt.termguicolors = true + require("bufferline").setup({ + options = { + separator_style = "slope", -- padded_slope doesn't render properly + diagnostics = "nvim_lsp", + }, + }) + + vim.keymap.set("n", "", "bnext") + vim.keymap.set("n", "", "bprev") + + vim.keymap.set("n", "tx", function() + vim.api.nvim_command("bp|sp|bn|bd") + end, { desc = "Close current bufferline tab" }) + + vim.keymap.set("n", "tl", function() + vim.api.nvim_command("BufferLineCloseLeft") + end, { desc = "Close bufferline tabs on the left" }) + + vim.keymap.set("n", "tr", function() + vim.api.nvim_command("BufferLineCloseRight") + end, { desc = "Close bufferline tabs on the right" }) + + vim.keymap.set("n", "to", function() + vim.api.nvim_command("BufferLineCloseOthers") + end, { desc = "Close others bufferline tabs" }) + end, } -- cgit v1.3-2-g11bf