forked from windwp/windline.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevil_line.lua
215 lines (203 loc) · 6 KB
/
evil_line.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
local windline = require('windline')
local helper = require('windline.helpers')
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 = {}
local breakpoint_width = 90
basic.divider = { b_components.divider, '' }
basic.bg = { ' ', 'StatusLine' }
local colors_mode = {
Normal = { 'red', 'black' },
Insert = { 'green', 'black' },
Visual = { 'yellow', 'black' },
Replace = { 'blue_light', 'black' },
Command = { 'magenta', 'black' },
}
basic.vi_mode = {
name = 'vi_mode',
hl_colors = colors_mode,
text = function()
return { { ' ', state.mode[2] } }
end,
}
basic.square_mode = {
hl_colors = colors_mode,
text = function()
return { { '▊', state.mode[2] } }
end,
}
basic.lsp_diagnos = {
name = 'diagnostic',
hl_colors = {
red = { 'red', 'black' },
yellow = { 'yellow', 'black' },
blue = { 'blue', 'black' },
},
width = breakpoint_width,
text = function(bufnr)
if lsp_comps.check_lsp(bufnr) then
return {
{ lsp_comps.lsp_error({ format = ' %s', show_zero = true }), 'red' },
{ lsp_comps.lsp_warning({ format = ' %s', show_zero = true }), 'yellow' },
{ lsp_comps.lsp_hint({ format = ' %s', show_zero = true }), 'blue' },
}
end
return ''
end,
}
basic.file = {
name = 'file',
hl_colors = {
default = hl_list.Black,
white = { 'white', 'black' },
magenta = { 'magenta', 'black' },
},
text = function(_, _, width)
if width > breakpoint_width then
return {
{ b_components.cache_file_size(), 'default' },
{ ' ', '' },
{ b_components.cache_file_name('[No Name]', 'unique'), 'magenta' },
{ b_components.line_col_lua, 'white' },
{ b_components.progress_lua, '' },
{ ' ', '' },
{ b_components.file_modified(' '), 'magenta' },
}
else
return {
{ b_components.cache_file_size(), 'default' },
{ ' ', '' },
{ b_components.cache_file_name('[No Name]', 'unique'), 'magenta' },
{ ' ', '' },
{ b_components.file_modified(' '), 'magenta' },
}
end
end,
}
basic.file_right = {
hl_colors = {
default = hl_list.Black,
white = { 'white', 'black' },
magenta = { 'magenta', 'black' },
},
text = function(_, _, width)
if width < breakpoint_width then
return {
{ b_components.line_col_lua, 'white' },
{ b_components.progress_lua, '' },
}
end
end,
}
basic.git = {
name = 'git',
hl_colors = {
green = { 'green', 'black' },
red = { 'red', 'black' },
blue = { 'blue', 'black' },
},
width = breakpoint_width,
text = function(bufnr)
if git_comps.is_git(bufnr) then
return {
{ git_comps.diff_added({ format = ' %s', show_zero = true }), 'green' },
{ git_comps.diff_removed({ format = ' %s', show_zero = true }), 'red' },
{ git_comps.diff_changed({ format = ' 柳%s', show_zero = true }), 'blue' },
}
end
return ''
end,
}
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 = {
{ ' ', { 'black', 'red' } },
{ helper.separators.slant_right, { 'red', 'NormalBg' } },
{ b_components.divider, '' },
{ b_components.file_name(''), { 'white', 'NormalBg' } },
},
always_active = true,
show_last_status = true,
}
basic.lsp_name = {
width = breakpoint_width,
name = 'lsp_name',
hl_colors = {
magenta = { 'magenta', 'black' },
},
text = function(bufnr)
if lsp_comps.check_lsp(bufnr) then
return {
{ lsp_comps.lsp_name(), 'magenta' },
}
end
return {
{ b_components.cache_file_type({icon = true}), 'magenta' },
}
end,
}
local default = {
filetypes = { 'default' },
active = {
basic.square_mode,
basic.vi_mode,
basic.file,
basic.lsp_diagnos,
basic.divider,
basic.file_right,
basic.lsp_name,
basic.git,
{ git_comps.git_branch(), { 'magenta', 'black' }, breakpoint_width },
{ ' ', hl_list.Black },
basic.square_mode,
},
inactive = {
{ b_components.full_file_name, hl_list.Inactive },
basic.file_name_inactive,
basic.divider,
basic.divider,
{ b_components.line_col, hl_list.Inactive },
{ b_components.progress, hl_list.Inactive },
},
}
windline.setup({
colors_name = function(colors)
-- print(vim.inspect(colors))
-- ADD MORE COLOR HERE ----
return colors
end,
statuslines = {
default,
quickfix,
explorer,
},
})