1
- vim .g .indicator_errors = ' '
2
- vim .g .indicator_warnings = ' '
3
- vim .g .indicator_info = ' 🛈'
4
- vim .g .indicator_hint = ' ❗'
5
- vim .g .indicator_ok = ' '
6
- vim .g .spinner_frames = { ' ⣾' , ' ⣽' , ' ⣻' , ' ⢿' , ' ⡿' , ' ⣟' , ' ⣯' , ' ⣷' }
1
+ local config = {}
2
+
3
+ local function init (_ , _config )
4
+ config = vim .tbl_extend (' force' , config , _config )
5
+ end
7
6
8
7
local diagnostics = require (' lsp-status/diagnostics' )
9
8
local messages = require (' lsp-status/messaging' ).messages
@@ -22,25 +21,25 @@ local function statusline_lsp()
22
21
local some_diagnostics = false
23
22
local status_parts = {}
24
23
if buf_diagnostics .errors and buf_diagnostics .errors > 0 then
25
- table.insert (status_parts , vim . g .indicator_errors .. ' ' .. buf_diagnostics .errors )
24
+ table.insert (status_parts , config .indicator_errors .. ' ' .. buf_diagnostics .errors )
26
25
only_hint = false
27
26
some_diagnostics = true
28
27
end
29
28
30
29
if buf_diagnostics .warnings and buf_diagnostics .warnings > 0 then
31
- table.insert (status_parts , vim . g .indicator_warnings .. ' ' .. buf_diagnostics .warnings )
30
+ table.insert (status_parts , config .indicator_warnings .. ' ' .. buf_diagnostics .warnings )
32
31
only_hint = false
33
32
some_diagnostics = true
34
33
end
35
34
36
35
if buf_diagnostics .info and buf_diagnostics .info > 0 then
37
- table.insert (status_parts , vim . g .indicator_info .. ' ' .. buf_diagnostics .info )
36
+ table.insert (status_parts , config .indicator_info .. ' ' .. buf_diagnostics .info )
38
37
only_hint = false
39
38
some_diagnostics = true
40
39
end
41
40
42
41
if buf_diagnostics .hints and buf_diagnostics .hints > 0 then
43
- table.insert (status_parts , vim . g .indicator_hint .. ' ' .. buf_diagnostics .hints )
42
+ table.insert (status_parts , config .indicator_hint .. ' ' .. buf_diagnostics .hints )
44
43
some_diagnostics = true
45
44
end
46
45
@@ -60,7 +59,7 @@ local function statusline_lsp()
60
59
end
61
60
62
61
if msg .spinner then
63
- contents = vim . g . spinner_frames [(msg .spinner % # vim . g .spinner_frames ) + 1 ] .. ' ' .. contents
62
+ contents = config . spinner_frames [(msg .spinner % # config .spinner_frames ) + 1 ] .. ' ' .. contents
64
63
end
65
64
elseif msg .status then
66
65
contents = msg .content
@@ -82,7 +81,7 @@ local function statusline_lsp()
82
81
end
83
82
84
83
local base_status = vim .trim (table.concat (status_parts , ' ' ) .. ' ' .. table.concat (msgs , ' ' ))
85
- local symbol = ' 🇻 ' .. ((some_diagnostics and only_hint ) and ' ' or ' ' )
84
+ local symbol = config . status_symbol .. ((some_diagnostics and only_hint ) and ' ' or ' ' )
86
85
local current_function = vim .b .lsp_current_function
87
86
if current_function and current_function ~= ' ' then
88
87
symbol = symbol .. ' (' .. current_function .. ' ) '
@@ -92,7 +91,12 @@ local function statusline_lsp()
92
91
return symbol .. base_status .. ' '
93
92
end
94
93
95
- return symbol .. vim . g .indicator_ok .. ' '
94
+ return symbol .. config .indicator_ok .. ' '
96
95
end
97
96
98
- return statusline_lsp
97
+ local M = {
98
+ _init = init ,
99
+ status = statusline_lsp
100
+ }
101
+
102
+ return M
0 commit comments