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
|
local status_ok, lualine = pcall(require, "lualine")
if not status_ok then
return
end
local status_gps_ok, gps = pcall(require, "nvim-gps")
if not status_gps_ok then
return
end
local hide_in_width = function()
return vim.fn.winwidth(0) > 80
end
local icons = require 'icons'
local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn" },
symbols = { error = icons.diagnostics.Error .. " ", warn = icons.diagnostics.Warning .. " " },
colored = false,
update_in_insert = false,
always_visible = true,
}
local diff = {
"diff",
colored = false,
symbols = { added = icons.git.Add .. " ", modified = icons.git.Mod .. " ", removed = icons.git.Remove .. " " }, -- changes diff symbols
cond = hide_in_width,
}
local mode = {
"mode",
fmt = function(str)
return "-- " .. str .. " --"
end,
}
local filetype = {
"filetype",
icons_enabled = false,
icon = nil,
}
local branch = {
"branch",
icons_enabled = true,
icon = "",
}
local location = {
"location",
padding = 0,
}
-- cool function for progress
local progress = function()
local current_line = vim.fn.line "."
local total_lines = vim.fn.line "$"
local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" }
local line_ratio = current_line / total_lines
local index = math.ceil(line_ratio * #chars)
return chars[index]
end
local spaces = function()
return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
end
local nvim_gps = function()
local gps_location = gps.get_location()
if gps_location == "error" then
return ""
else
return gps.get_location()
end
end
lualine.setup {
options = {
icons_enabled = true,
theme = "vscode",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = { "alpha", "dashboard", "NvimTree", "Outline", "toggleterm" },
always_divide_middle = true,
},
sections = {
-- lualine_a = { branch, diagnostics },
lualine_a = { branch },
lualine_b = { diagnostics },
-- lualine_c = { _gps },
lualine_c = {
{ nvim_gps, cond = hide_in_width },
},
-- lualine_x = { "encoding", "fileformat", "filetype" },
lualine_x = { diff, spaces, "encoding", filetype },
lualine_y = { location },
lualine_z = { progress },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = {},
}
|