about summary refs log tree commit diff
path: root/fnl/nvrc/ui/statusline.fnl
blob: 9c6d04ca45a99c4386beadcc02e4a4e7829fbe47 (plain)
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
(import-macros {: setl!} :nvrc.macro.set)
(import-macros {: ag!
                : au!} :nvrc.macro.event)

(local {: mode : update-mode-colors} (require :nvrc.ui.modules.vi_mode))
(local {: diagnostics} (require :nvrc.ui.modules.diagnostics))
(local {: file-size} (require :nvrc.ui.modules.misc))

(global statusline {})
(set statusline.enable (fn []
                         (table.concat ["%#StatusLinePad#"
                                        "▊ "
                                        "%#StatusLine#"
                                        (update-mode-colors)
                                        (mode)
                                        "%#StatusLineFile#"
                                        "%f%m%r "
                                        "%#StatusLine#"
                                        (file-size)
                                        "%l:%c | "
                                        (diagnostics)
                                        "%="
                                        "%#StatusLineFileData#"
                                        "%y *%n "])))

(ag! ui-statusline
  (au! [WinEnter BufEnter] * #(setl! statusline "%!v:lua.statusline.enable()"))
  (au! [WinLeave BufLeave] * #(setl! statusline " ")))