-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
bufferline.lua
143 lines (119 loc) · 4.21 KB
/
bufferline.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
local M = { 'akinsho/bufferline.nvim', tag = 'v3.*', requires = { 'tiagovla/scope.nvim' } }
M.keymaps = function()
local modes = { 'n', 'c', 'v' }
local opts = { noremap = true, silent = true }
return {
{ modes, '<M-[>', ':BufferLineCyclePrev<CR>', opts },
{ modes, '<M-]>', ':BufferLineCycleNext<CR>', opts },
{ modes, '<M-{>', ':tabmove-<CR>', opts },
{ modes, '<M-}>', ':tabmove+<CR>', opts },
{ modes, '<leader>1', ':BufferLineGoToBuffer 1<CR>', opts },
{ modes, '<leader>2', ':BufferLineGoToBuffer 2<CR>', opts },
{ modes, '<leader>3', ':BufferLineGoToBuffer 3<CR>', opts },
{ modes, '<leader>4', ':BufferLineGoToBuffer 4<CR>', opts },
{ modes, '<leader>5', ':BufferLineGoToBuffer 5<CR>', opts },
{ modes, '<leader>6', ':BufferLineGoToBuffer 6<CR>', opts },
{ modes, '<leader>7', ':BufferLineGoToBuffer 7<CR>', opts },
{ modes, '<leader>8', ':BufferLineGoToBuffer 8<CR>', opts },
{ modes, '<leader>9', ':BufferLineGoToBuffer 9<CR>', opts },
{ modes, '<leader>0', ':BufferLineGoToBuffer -1<CR>', opts },
}
end
function M.config(config)
local conf = config.bufferline
if conf.options.mode == 'buffers' then
-- Temp Fix: buffers per tab
-- see https://github.com/akinsho/bufferline.nvim#how-do-i-see-only-buffers-per-tab
require('scope').setup()
end
require('bufferline').setup(conf)
end
M.defaultConfig = function(config)
local colors = config.colors
local selectedBG = '#1b2430'
local bufferBG = '#12151a'
local white = colors.white
local grey = colors.grey
local blue = colors.blue
local yellow = colors.yellow
return {
'bufferline',
{
options = {
mode = 'buffers', -- 'tabs' or 'buffers'
numbers = 'ordinal',
diagnostics = false, -- false | 'nvim_lsp' | 'coc',
indicator = {
icon = '▎', -- this should be omitted if indicator style is not 'icon'
style = 'icon', -- 'icon'| 'underline' | 'none',
},
show_buffer_icons = false, -- disable filetype icons for buffers
show_buffer_close_icons = true,
show_tab_indicators = true,
show_duplicate_prefix = true,
show_close_icon = false,
buffer_close_icon = '',
modified_icon = '*',
close_icon = '',
left_trunc_marker = '',
right_trunc_marker = '',
color_icons = true,
separator_style = { '', '' }, -- 'slant' | 'thick' | 'thin' | { 'any', 'any' },
max_name_length = 20,
truncate_names = true,
offsets = {
{
filetype = 'neo-tree',
text = '[File Explorer]',
text_align = 'center', -- 'left' | 'center' | 'right'
highlight = 'BufferLineInfoSelected',
separator = true,
},
{
filetype = 'NvimTree',
text = '[File Explorer]',
text_align = 'center', -- 'left' | 'center' | 'right'
highlight = 'BufferLineInfoSelected',
separator = true,
},
{
filetype = 'aerial',
text = '[Outline]',
text_align = 'center', -- 'left' | 'center' | 'right'
highlight = 'BufferLineInfoSelected',
separator = true,
},
},
},
highlights = {
fill = { -- It's background
fg = grey,
bg = colors.black,
},
background = { -- unselected buffers
fg = grey,
bg = bufferBG,
},
indicator_selected = { fg = blue, bg = selectedBG },
buffer_visible = { fg = white, bg = selectedBG },
tab = { fg = grey, bg = bufferBG },
tab_selected = { fg = white, bg = selectedBG },
tab_close = { fg = grey, bg = bufferBG },
modified = { fg = yellow, bg = bufferBG },
modified_visible = { fg = yellow, bg = selectedBG },
modified_selected = { fg = yellow, bg = selectedBG },
duplicate_selected = { fg = white, bg = selectedBG, italic = true },
duplicate_visible = { fg = grey, bg = selectedBG, italic = true },
duplicate = { fg = grey, bg = bufferBG, italic = true },
buffer_selected = { fg = white, bg = selectedBG, bold = false, italic = false },
numbers = { fg = grey, bg = bufferBG },
numbers_selected = { fg = white, bg = selectedBG, bold = false, italic = false },
numbers_visible = { fg = white, bg = selectedBG },
close_button = { bg = bufferBG },
close_button_selected = { fg = blue, bg = selectedBG },
close_button_visible = { fg = blue, bg = selectedBG },
},
},
}
end
return M