{ config, lib, ... }: with lib; with builtins; let cfg = config.vim.tabline.nvimBufferline; in { config = mkIf cfg.enable ( let mouse = { right = "'vertical sbuffer %d'"; close = '' function(bufnum) require("bufdelete").bufdelete(bufnum, false) end ''; }; in { vim.startPlugins = [ (assert config.vim.visuals.nvimWebDevicons.enable == true; "nvim-bufferline-lua") "bufdelete-nvim" ]; vim.maps.normal = { "bn" = {action = ":BufferLineCycleNext";}; "bp" = {action = ":BufferLineCyclePrev";}; "bc" = {action = ":BufferLinePick";}; "bse" = {action = ":BufferLineSortByExtension";}; "bsd" = {action = ":BufferLineSortByDirectory";}; "bsi" = {action = ":lua require'bufferline'.sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end)";}; "bmn" = {action = ":BufferLineMoveNext";}; "bmp" = {action = ":BufferLineMovePrev";}; "b1" = {action = "BufferLineGoToBuffer 1";}; "b2" = {action = "BufferLineGoToBuffer 2";}; "b3" = {action = "BufferLineGoToBuffer 3";}; "b4" = {action = "BufferLineGoToBuffer 4";}; "b5" = {action = "BufferLineGoToBuffer 5";}; "b6" = {action = "BufferLineGoToBuffer 6";}; "b7" = {action = "BufferLineGoToBuffer 7";}; "b8" = {action = "BufferLineGoToBuffer 8";}; "b9" = {action = "BufferLineGoToBuffer 9";}; }; vim.luaConfigRC.nvimBufferline = nvim.dag.entryAnywhere '' require("bufferline").setup{ options = { mode = "buffers", numbers = "both", close_command = ${mouse.close}, right_mouse_command = ${mouse.right}, indicator = { style = 'underline', -- indicator_icon = '▎', }, buffer_close_icon = '', modified_icon = '●', close_icon = '', left_trunc_marker = '', right_trunc_marker = '', max_name_length = 18, max_prefix_length = 15, tab_size = 18, show_buffer_icons = true, show_buffer_close_icons = true, show_close_icon = true, show_tab_indicators = true, persist_buffer_sort = true, --separator_style = "thin", separator_style = { " ", " " }, enforce_regular_tabs = true, always_show_bufferline = true, offsets = { {filetype = "NvimTree", text = "File Explorer", text_align = "center"} }, sort_by = 'extension', diagnostics = "nvim_lsp", -- TODO: use coc if it's enabled diagnostics_update_in_insert = true, diagnostics_indicator = function(count, level, diagnostics_dict, context) local s = "" for e, n in pairs(diagnostics_dict) do local sym = e == "error" and "" or (e == "warning" and "" or "" ) if(sym ~= "") then s = s .. " " .. n .. sym end end return s end, numbers = function(opts) return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal)) end, } } ''; } ); }