-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmusic_bar.lua
More file actions
124 lines (114 loc) · 2.5 KB
/
Copy pathmusic_bar.lua
File metadata and controls
124 lines (114 loc) · 2.5 KB
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
local windline = require('windline')
local animation = require('wlanimation')
local efffects = require('wlanimation.effects')
local BLOCKS_DATA = {
'▁',
'▂',
'▃',
'▄',
'▅',
'▆',
'▇',
'█',
'█',
'▇',
'▆',
'▅',
'▄',
'▃',
'▂',
'▁',
}
local blocks = {}
local winwidth = vim.api.nvim_win_get_width(0)
print(vim.inspect(winwidth))
local item = {}
local basic = {}
local num_block = (winwidth - 1) / #BLOCKS_DATA
for _ = 1, num_block do
for _, v in ipairs(BLOCKS_DATA) do
table.insert(blocks, v)
end
end
basic.up = {
hl_colors = {
block1 = { 'block1', 'NormalBg' },
block2 = { 'block2', 'NormalBg' },
block3 = { 'block3', 'NormalBg' },
block4 = { 'block4', 'NormalBg' },
block5 = { 'block5', 'NormalBg' },
block6 = { 'block6', 'NormalBg' },
},
text = function()
local tbl = {}
local color = 1
for _, v in ipairs(item) do
color = color + 1
table.insert(tbl, { v, 'block' .. color })
if color == 6 then
color = 0
end
end
return tbl
end,
}
local default = {
filetypes = { 'default' },
active = {
basic.up,
},
inactive = {
{ '', '' },
},
}
windline.setup({
colors_name = function(colors)
colors.block1 = colors.blue
colors.block2 = colors.blue
colors.block3 = colors.blue
colors.block4 = colors.blue
colors.block5 = colors.blue
colors.block6 = colors.blue
return colors
end,
statuslines = {
default,
},
})
local maxNum = #blocks
local num = maxNum
animation.stop_all()
animation.basic_animation({
timeout = nil,
delay = 200,
interval = 250,
effect = function()
num = num - 1
if num < 1 then
num = maxNum
end
return num
end,
on_tick = function(value)
local tbl = {}
for i = value, maxNum do
table.insert(tbl, blocks[i])
end
for i = 1, value do
table.insert(tbl, blocks[maxNum - i])
end
item = tbl
end,
})
animation.animation({
data = {
{ 'block1', efffects.rainbow( 6) },
{ 'block2', efffects.rainbow( 5) },
{ 'block3', efffects.rainbow( 4) },
{ 'block4', efffects.rainbow( 3) },
{ 'block5', efffects.rainbow( 2) },
},
timeout = 100,
delay = 200,
interval = 250,
})