-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvscode_light.lua
226 lines (221 loc) · 6.02 KB
/
vscode_light.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
216
217
218
219
220
221
222
223
224
225
226
local lualine = require "lualine"
local colors = {
bg = "#cbcfce",
fg = "#6e6e74",
mbg = "#d7d9e1",
yellow = "#ff6300",
cyan = "#477bde",
darkblue = "#081633",
green = "#97ff8f",
orange = "#ffb684",
violet = "#c678dd",
magenta = "#c678dd",
blue = "#8fb5f7",
red = "#ffa3be",
grey = "#3e3d50",
lsp = "#70ff64",
diff_green = "#98be65",
diff_orange = "#ff8800",
diff_red = "#ec5f67",
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand "%:t") ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
hide_lsp_diagnostics = function()
return vim.o.columns > 140
end,
hide_diff = function()
return vim.o.columns > 120
end,
hide_line_col = function()
return vim.o.columns > 140
end,
hide_cwd = function()
return vim.o.columns > 80
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = "",
section_separators = "",
theme = "auto",
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
-- normal = { a = { bg = colors.mbg }, b = { bg = colors.mbg }, c = { bg = colors.mbg } },
-- inactive = { c = { bg = light_colors.bg } },
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_c = {
{
"mode",
icon = "",
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.blue,
i = colors.violet,
v = colors.cyan,
[""] = colors.cyan,
V = colors.cyan,
c = colors.magenta,
R = colors.orange,
no = colors.blue,
s = colors.orange,
S = colors.orange,
[""] = colors.orange,
ic = colors.yellow,
Rv = colors.orange,
cv = colors.blue,
ce = colors.blue,
r = colors.cyan,
rm = colors.cyan,
["r?"] = colors.cyan,
["!"] = colors.blue,
t = colors.green,
}
return { fg = mode_color[vim.fn.mode()], bg = colors.bg }
end,
-- color = { bg = colors.fg },
},
{
"filetype",
icon_only = true,
colored = false,
-- color = { fg = colors.fg, bg = colors.mbg },
color = { fg = colors.fg },
padding = { left = 1, right = 0 },
},
{
"filename",
cond = conditions.buffer_not_empty,
-- color = { fg = colors.fg, bg = colors.mbg },
color = { fg = colors.fg },
padding = { left = 1, right = 1 },
},
{
"branch",
icon = "",
color = { fg = colors.fg },
padding = { left = 1, right = 1 },
},
{
"diagnostics",
sources = { "nvim_diagnostic" },
symbols = { error = " ", warn = " ", info = " ", hint = " " },
cond = conditions.hide_lsp_diagnostics,
colored = true,
always_visible = true,
},
},
lualine_x = {
{
"diff",
colored = true,
symbols = { added = " ", modified = " ", removed = " " },
diff_color = {
added = { fg = colors.diff_green },
modified = { fg = colors.diff_orange },
removed = { fg = colors.diff_red },
},
cond = conditions.hide_diff,
},
{
function()
return "|"
end,
-- color = { fg = colors.diff_red, bg = colors.mbg },
color = { fg = colors.diff_red },
cond = conditions.hide_diff,
},
{
function()
return "Ln %l, Col %c"
end,
-- color = { fg = colors.fg, bg = colors.mbg },
color = { fg = colors.fg },
cond = conditions.hide_line_col,
-- icon = "|",
},
{
"o:encoding", -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
-- color = { fg = colors.yellow, bg = colors.mbg, gui = "bold" },
color = { fg = colors.yellow, gui = "bold" },
},
{
function()
return "{} %Y"
end,
-- color = { fg = colors.blue, bg = colors.mbg, gui = "bold" },
color = { fg = colors.blue, gui = "bold" },
},
{
function ()
local msg = ""
-- local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
if client.name == "copilot" then
return ""
end
end
return msg
end
},
{
function()
local msg = "No Active Lsp"
-- local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
if client.name ~= "null-ls" then
return (vim.o.columns > 100 and client.name) or "LSP"
end
end
return msg
end,
icon = " ",
-- color = { fg = colors.lsp, bg = colors.mbg },
color = { fg = colors.lsp },
},
},
lualine_y = {},
lualine_z = {
{
function()
local filepath = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return " " .. filepath
end,
color = { bg = colors.bg, fg = colors.red },
cond = conditions.hide_cwd,
},
},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
lualine.setup(config)