about summary refs log tree commit diff
path: root/fnl/nvrc/ui/statusline.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'fnl/nvrc/ui/statusline.fnl')
-rw-r--r--fnl/nvrc/ui/statusline.fnl28
1 files changed, 28 insertions, 0 deletions
diff --git a/fnl/nvrc/ui/statusline.fnl b/fnl/nvrc/ui/statusline.fnl
new file mode 100644
index 0000000..49afa7f
--- /dev/null
+++ b/fnl/nvrc/ui/statusline.fnl
@@ -0,0 +1,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 "")))