forked from windwp/windline.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bubble.lua
197 lines (185 loc) · 5.75 KB
/
bubble.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
local windline = require('windline')
local helper = require('windline.helpers')
local sep = helper.separators
local vim_components = require('windline.components.vim')
local b_components = require('windline.components.basic')
local state = _G.WindLine.state
local lsp_comps = require('windline.components.lsp')
local git_comps = require('windline.components.git')
local hl_list = {
Black = { 'white', 'black' },
White = { 'black', 'white' },
Inactive = { 'InactiveFg', 'InactiveBg' },
Active = { 'ActiveFg', 'ActiveBg' },
}
local basic = {}
basic.divider = { b_components.divider, '' }
basic.file_name_inactive = { b_components.full_file_name, hl_list.Inactive }
basic.line_col_inactive = { b_components.line_col, hl_list.Inactive }
basic.progress_inactive = { b_components.progress, hl_list.Inactive }
basic.vi_mode = {
name = 'vi_mode',
hl_colors = {
Normal = { 'black', 'red', 'bold' },
Insert = { 'black', 'green', 'bold' },
Visual = { 'black', 'yellow', 'bold' },
Replace = { 'black', 'blue_light', 'bold' },
Command = { 'black', 'magenta', 'bold' },
NormalBefore = { 'red', 'black' },
InsertBefore = { 'green', 'black' },
VisualBefore = { 'yellow', 'black' },
ReplaceBefore = { 'blue_light', 'black' },
CommandBefore = { 'magenta', 'black' },
NormalAfter = { 'white', 'red' },
InsertAfter = { 'white', 'green' },
VisualAfter = { 'white', 'yellow' },
ReplaceAfter = { 'white', 'blue_light' },
CommandAfter = { 'white', 'magenta' },
},
text = function()
return {
{ sep.left_rounded, state.mode[2] .. 'Before' },
{ state.mode[1] .. ' ', state.mode[2] },
{ sep.left_rounded, state.mode[2] .. 'After' },
}
end,
}
basic.lsp_diagnos = {
name = 'diagnostic',
hl_colors = {
red = { 'red', 'black' },
yellow = { 'yellow', 'black' },
blue = { 'blue', 'black' },
},
width = 90,
text = function(bufnr)
if lsp_comps.check_lsp(bufnr) then
return {
{ lsp_comps.lsp_error({ format = ' %s' }), 'red' },
{ lsp_comps.lsp_warning({ format = ' %s' }), 'yellow' },
{ lsp_comps.lsp_hint({ format = ' %s' }), 'blue' },
}
end
return ''
end,
}
basic.file = {
name = 'file',
hl_colors = {
default = hl_list.White,
},
text = function()
return {
{b_components.cache_file_icon({ default = '' }), 'default'},
{ ' ', 'default' },
{ b_components.cache_file_name('[No Name]', 'unique') },
{ b_components.file_modified(' ')},
{ b_components.cache_file_size()},
}
end,
}
basic.right = {
hl_colors = {
sep_before = { 'black_light', 'black' },
sep_after = { 'black_light', 'black' },
text = { 'white', 'black_light' },
},
text = function()
return {
{ sep.left_rounded, 'sep_before' },
{ 'l/n', 'text' },
{ b_components.line_col_lua },
{ '' },
{ b_components.progress_lua },
{ sep.right_rounded, 'sep_after' },
}
end,
}
basic.git = {
name = 'git',
width = 90,
hl_colors = {
green = { 'green', 'black' },
red = { 'red', 'black' },
blue = { 'blue', 'black' },
},
text = function(bufnr)
if git_comps.is_git(bufnr) then
return {
{ ' ' },
{ git_comps.diff_added({ format = ' %s' }), 'green' },
{ git_comps.diff_removed({ format = ' %s' }), 'red' },
{ git_comps.diff_changed({ format = ' 柳%s' }), 'blue' },
}
end
return ''
end,
}
local default = {
filetypes = { 'default' },
active = {
{ ' ', hl_list.Black },
basic.vi_mode,
basic.file,
{ vim_components.search_count(), { 'red', 'white' } },
{ sep.right_rounded, hl_list.Black },
basic.lsp_diagnos,
basic.git,
basic.divider,
{ git_comps.git_branch({ icon = ' ' }), { 'green', 'black' }, 90 },
{ ' ', hl_list.Black },
basic.right,
{ ' ', hl_list.Black },
},
inactive = {
basic.file_name_inactive,
basic.divider,
basic.divider,
basic.line_col_inactive,
{ '', hl_list.Inactive },
basic.progress_inactive,
},
}
local quickfix = {
filetypes = { 'qf', 'Trouble' },
active = {
{ '🚦 Quickfix ', { 'white', 'black' } },
{ helper.separators.slant_right, { 'black', 'black_light' } },
{
function()
return vim.fn.getqflist({ title = 0 }).title
end,
{ 'cyan', 'black_light' },
},
{ ' Total : %L ', { 'cyan', 'black_light' } },
{ helper.separators.slant_right, { 'black_light', 'InactiveBg' } },
{ ' ', { 'InactiveFg', 'InactiveBg' } },
basic.divider,
{ helper.separators.slant_right, { 'InactiveBg', 'black' } },
{ '🧛 ', { 'white', 'black' } },
},
always_active = true,
show_last_status = true
}
local explorer = {
filetypes = { 'fern', 'NvimTree', 'lir' },
active = {
{ ' ', { 'white', 'black_light' } },
{ helper.separators.slant_right, { 'black_light', 'NormalBg' } },
{ b_components.divider, '' },
{ b_components.file_name(''), { 'NormalFg', 'NormalBg' } },
},
always_active = true,
show_last_status = true
}
windline.setup({
colors_name = function(colors)
-- ADD MORE COLOR HERE ----
return colors
end,
statuslines = {
default,
explorer,
quickfix,
},
})