-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
slanty.lua
162 lines (153 loc) · 4.36 KB
/
slanty.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
local nougat = require("nougat")
local core = require("nougat.core")
local Bar = require("nougat.bar")
local Item = require("nougat.item")
local sep = require("nougat.separator")
local nut = {
buf = {
diagnostic_count = require("nougat.nut.buf.diagnostic_count").create,
filename = require("nougat.nut.buf.filename").create,
filestatus = require("nougat.nut.buf.filestatus").create,
filetype = require("nougat.nut.buf.filetype").create,
},
git = {
branch = require("nougat.nut.git.branch").create,
status = require("nougat.nut.git.status"),
},
tab = {
tablist = {
tabs = require("nougat.nut.tab.tablist").create,
close = require("nougat.nut.tab.tablist.close").create,
icon = require("nougat.nut.tab.tablist.icon").create,
label = require("nougat.nut.tab.tablist.label").create,
modified = require("nougat.nut.tab.tablist.modified").create,
},
},
mode = require("nougat.nut.mode").create,
spacer = require("nougat.nut.spacer").create,
truncation_point = require("nougat.nut.truncation_point").create,
}
---@type nougat.color
local color = require("nougat.color").get()
local mode = nut.mode({
prefix = " ",
suffix = " ",
sep_right = sep.right_lower_triangle_solid(true),
})
local stl = Bar("statusline")
stl:add_item(mode)
stl:add_item(nut.git.branch({
hl = { bg = color.magenta, fg = color.bg },
prefix = " ",
suffix = " ",
sep_right = sep.right_upper_triangle_solid(true),
}))
stl:add_item(nut.git.status.create({
hl = { fg = color.bg },
content = {
nut.git.status.count("added", {
hl = { bg = color.green },
prefix = "+",
sep_right = sep.right_upper_triangle_solid(true),
}),
nut.git.status.count("changed", {
hl = { bg = color.blue },
prefix = "~",
sep_right = sep.right_upper_triangle_solid(true),
}),
nut.git.status.count("removed", {
hl = { bg = color.red },
prefix = "-",
sep_right = sep.right_upper_triangle_solid(true),
}),
},
}))
local filename = stl:add_item(nut.buf.filename({
hl = { bg = color.bg3 },
prefix = " ",
suffix = " ",
}))
local filestatus = stl:add_item(nut.buf.filestatus({
hl = { bg = color.bg3 },
suffix = " ",
sep_right = sep.right_lower_triangle_solid(true),
config = {
modified = "",
nomodifiable = "",
readonly = "",
sep = " ",
},
}))
stl:add_item(nut.spacer())
stl:add_item(nut.truncation_point())
stl:add_item(nut.buf.diagnostic_count({
sep_left = sep.left_lower_triangle_solid(true),
prefix = " ",
suffix = " ",
config = {
error = { prefix = " " },
warn = { prefix = " " },
info = { prefix = " " },
hint = { prefix = " " },
},
}))
stl:add_item(nut.buf.filetype({
hl = { bg = color.bg1 },
sep_left = sep.left_lower_triangle_solid(true),
prefix = " ",
suffix = " ",
}))
stl:add_item(Item({
hl = { bg = color.bg2, fg = color.blue },
sep_left = sep.left_lower_triangle_solid(true),
prefix = " ",
content = core.group({
core.code("l"),
":",
core.code("c"),
}),
suffix = " ",
}))
stl:add_item(Item({
hl = { bg = color.blue, fg = color.bg },
sep_left = sep.left_lower_triangle_solid(true),
prefix = " ",
content = core.code("P"),
suffix = " ",
}))
local stl_inactive = Bar("statusline")
stl_inactive:add_item(mode)
stl_inactive:add_item(filename)
stl_inactive:add_item(filestatus)
stl_inactive:add_item(nut.spacer())
nougat.set_statusline(function(ctx)
return ctx.is_focused and stl or stl_inactive
end)
local tal = Bar("tabline")
tal:add_item(nut.tab.tablist.tabs({
active_tab = {
hl = { bg = color.bg, fg = color.blue },
prefix = " ",
suffix = " ",
content = {
nut.tab.tablist.icon({ suffix = " " }),
nut.tab.tablist.label({}),
nut.tab.tablist.modified({ prefix = " ", config = { text = "●" } }),
nut.tab.tablist.close({ prefix = " ", config = { text = "" } }),
},
sep_right = sep.right_lower_triangle_solid(true),
},
inactive_tab = {
hl = { bg = color.bg2, fg = color.fg2 },
prefix = " ",
suffix = " ",
content = {
nut.tab.tablist.icon({ suffix = " " }),
nut.tab.tablist.label({}),
nut.tab.tablist.modified({ prefix = " ", config = { text = "●" } }),
nut.tab.tablist.close({ prefix = " ", config = { text = "" } }),
},
sep_right = sep.right_lower_triangle_solid(true),
},
}))
nougat.set_tabline(tal)