local present, bufferline = pcall(require, "bufferline") if not present then return end local ctp_present, ctp = pcall(require, "catppuccin.groups.integrations.bufferline") local ctp_bufferline if not ctp_present then ctp_bufferline = {} else ctp_bufferline = ctp.get() end local v = vim.version() local vStr = string.format("v%d.%d.%d", v.major, v.minor, v.patch) bufferline.setup({ highlights = ctp_bufferline, options = { show_close_icon = false, show_buffer_close_icons = false, offsets = { { filetype = "NvimTree", text = "  neovim " .. vStr, text_align = "left", separator = "║", }, }, left_mouse_command = "buffer %d", middle_mouse_command = "bdelete! %d", right_mouse_command = nil, indicator = { icon = "‣" }, numbers = function(tab) local roman = { "Ⅰ", "Ⅱ", "Ⅲ", "Ⅳ", "Ⅴ", "Ⅵ", "Ⅶ", "Ⅷ", "Ⅸ", "Ⅹ", "Ⅺ", "Ⅻ", "XⅢ", "XⅣ", "ⅩⅤ", "ⅩⅥ", "ⅩⅦ", "ⅩⅧ", "ⅩⅨ", "ⅩⅩ", } return string.format("%s ", roman[tab.ordinal]) end, }, }) local nmap = function(key, cmd) vim.api.nvim_set_keymap("n", key, cmd, { noremap = true, silent = true }) end -- hop between buffers in order of the bar nmap("", "BufferLineCyclePrev") nmap("", "BufferLineCycleNext") -- Re-order to previous/next nmap("", "BufferLineMovePrev") nmap(">", "BufferLineMoveNext") -- Goto buffer in position... nmap("", "BufferLineGoToBuffer 1") nmap("", "BufferLineGoToBuffer 2") nmap("", "BufferLineGoToBuffer 3") nmap("", "BufferLineGoToBuffer 4") nmap("", "BufferLineGoToBuffer 5") nmap("", "BufferLineGoToBuffer 6") nmap("", "BufferLineGoToBuffer 7") nmap("", "BufferLineGoToBuffer 8") nmap("", "BufferLineGoToBuffer 9") nmap("", "BufferLineGoToBuffer -1") -- Pin/unpin buffer nmap("", "BufferLineTogglePin") -- Close buffer nmap("", "bdelete") nmap("", "bdelete!") -- create new buffer nmap("", "enew") -- pick buffer nmap("", "BufferLinePick") -- Sort automatically by... nmap("bd", "BufferLineSortByDirectory") nmap("bl", "BufferLineSortByExtension")