all repos — dotfiles @ 689d7c59fe5957e0ac6efe7d3f79a7c2e51499a6

my *nix dotfiles

config/nvim/lua/statusline.lua (view raw)

 1local mode_map = {
 2	['n'] = 'normal ',
 3	['no'] = 'n·operator pending ',
 4	['v'] = 'visual ',
 5	['V'] = 'v·line ',
 6	[''] = 'v·block ',
 7	['s'] = 'select ',
 8	['S'] = 's·line ',
 9	[''] = 's·block ',
10	['i'] = 'insert ',
11	['R'] = 'replace ',
12	['Rv'] = 'v·replace ',
13	['c'] = 'command ',
14	['cv'] = 'vim ex ',
15	['ce'] = 'ex ',
16	['r'] = 'prompt ',
17	['rm'] = 'more ',
18	['r?'] = 'confirm ',
19	['!'] = 'shell ',
20	['t'] = 'terminal '
21}
22
23local function mode()
24	local m = vim.api.nvim_get_mode().mode
25	if mode_map[m] == nil then return m end
26	return mode_map[m]
27end
28
29-- set highlights for statusline sections
30vim.api.nvim_exec(
31[[
32	hi PrimaryBlock   ctermfg=06 ctermbg=00
33	hi SecondaryBlock ctermfg=08 ctermbg=00
34	hi Blanks   ctermfg=07 ctermbg=00
35]], false)
36
37
38local stl = {
39  '%#PrimaryBlock#',
40  mode(),
41  '%#SecondaryBlock#',
42  '%#Blanks#',
43  '%f',
44  '%m',
45  '%=',
46  '%#SecondaryBlock#',
47  '%l,%c ',
48  '%#PrimaryBlock#',
49  '%{&filetype}',
50}
51
52vim.o.statusline = table.concat(stl)