-
Notifications
You must be signed in to change notification settings - Fork 0
/
mode.lua
52 lines (50 loc) · 1 KB
/
mode.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
-- set mode hl
(function()
for key, val in pairs(require("yasl.highlights").mode) do
vim.api.nvim_set_hl(0, "Yasl" .. key, val)
end
end)()
local mode_alias = {
['n'] = 'NORMAL',
['no'] = 'OP',
['nov'] = 'OP',
['noV'] = 'OP',
['no'] = 'OP',
['niI'] = 'NORMAL',
['niR'] = 'NORMAL',
['niV'] = 'NORMAL',
['v'] = 'VISUAL',
['vs'] = 'VISUAL',
['V'] = 'LINES',
['Vs'] = 'LINES',
[''] = 'BLOCK',
['s'] = 'BLOCK',
['s'] = 'SELECT',
['S'] = 'SELECT',
[''] = 'BLOCK',
['i'] = 'INSERT',
['ic'] = 'INSERT',
['ix'] = 'INSERT',
['R'] = 'REPLACE',
['Rc'] = 'REPLACE',
['Rv'] = 'V-REPLACE',
['Rx'] = 'REPLACE',
['c'] = 'COMMAND',
['cv'] = 'COMMAND',
['ce'] = 'COMMAND',
['r'] = 'ENTER',
['rm'] = 'MORE',
['r?'] = 'CONFIRM',
['!'] = 'SHELL',
['t'] = 'TERM',
['nt'] = 'TERM',
['null'] = 'NONE',
}
return {
name = "mode",
events = { "WinEnter", "BufEnter", "ModeChanged" },
update = function()
local mode = mode_alias[vim.fn.mode()]
return string.format("%%#Yasl%s# %s %%*", mode, mode)
end
}