about summary refs log tree commit diff
path: root/fnl
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-03-06 20:51:38 +0900
committersefidel <contact@sefidel.net>2022-03-06 20:51:38 +0900
commitf5cc3f01fae31acdb35b9c70b739a130b059f05f (patch)
tree452acff8b6c247bf8459e1a6c81767cea116a89e /fnl
parent3c1989af2f178711055f75639ac5208c166cec68 (diff)
downloadnvimrc-f5cc3f01fae31acdb35b9c70b739a130b059f05f.tar.gz
nvimrc-f5cc3f01fae31acdb35b9c70b739a130b059f05f.zip
feat(ui): combine statusline into one file
Diffstat (limited to 'fnl')
-rw-r--r--fnl/nvrc/ignite.fnl2
-rw-r--r--fnl/nvrc/statusline.fnl (renamed from fnl/nvrc/ui/statusline.fnl)20
-rw-r--r--fnl/nvrc/ui/modules/diagnostics.fnl21
3 files changed, 20 insertions, 23 deletions
diff --git a/fnl/nvrc/ignite.fnl b/fnl/nvrc/ignite.fnl
index 9eab014..fd3db9c 100644
--- a/fnl/nvrc/ignite.fnl
+++ b/fnl/nvrc/ignite.fnl
@@ -2,5 +2,5 @@
 (require :nvrc.options)
 (require :nvrc.keymaps)
 (require :nvrc.events)
-(require :nvrc.ui.statusline)
+(require :nvrc.statusline)
 (require :nvrc.pack)
diff --git a/fnl/nvrc/ui/statusline.fnl b/fnl/nvrc/statusline.fnl
index c50bc81..fbac5a8 100644
--- a/fnl/nvrc/ui/statusline.fnl
+++ b/fnl/nvrc/statusline.fnl
@@ -2,7 +2,25 @@
 (import-macros {: ag!
                 : au!} :nvrc.macro.event)
 
-(local {: diagnostics} (require :nvrc.ui.modules.diagnostics))
+(fn diagnostics []
+  (let [count {}
+        levels {:errors :Error :warnings :Warn :info :Info :hints :Hint}]
+    (each [k level (pairs levels)]
+      (tset count k (vim.tbl_count (vim.diagnostic.get 0 {:severity level}))))
+    (var errors "")
+    (var warnings "")
+    (var hints "")
+    (var info "")
+    (when (not= (. count :errors) 0)
+      (set errors (.. "%#DiagnosticSignError#E" (. count :errors))))
+    (when (not= (. count :warnings) 0)
+      (set warnings
+           (.. " %#DiagnosticSignWarn#W" (. count :warnings))))
+    (when (not= (. count :hints) 0)
+      (set hints (.. " %#DiagnosticSignHint#H" (. count :hints))))
+    (when (not= (. count :info) 0)
+      (set info (.. " %#DiagnosticSignInformation#I" (. count :info))))
+    (.. errors warnings hints info "%#StatusLine#")))
 
 (global statusline {})
 (set statusline.enable (fn []
diff --git a/fnl/nvrc/ui/modules/diagnostics.fnl b/fnl/nvrc/ui/modules/diagnostics.fnl
deleted file mode 100644
index 9cf6a02..0000000
--- a/fnl/nvrc/ui/modules/diagnostics.fnl
+++ /dev/null
@@ -1,21 +0,0 @@
-(fn diagnostics []
-  (let [count {}
-        levels {:errors :Error :warnings :Warn :info :Info :hints :Hint}]
-    (each [k level (pairs levels)]
-      (tset count k (vim.tbl_count (vim.diagnostic.get 0 {:severity level}))))
-    (var errors "")
-    (var warnings "")
-    (var hints "")
-    (var info "")
-    (when (not= (. count :errors) 0)
-      (set errors (.. "%#DiagnosticSignError#E" (. count :errors))))
-    (when (not= (. count :warnings) 0)
-      (set warnings
-           (.. " %#DiagnosticSignWarn#W" (. count :warnings))))
-    (when (not= (. count :hints) 0)
-      (set hints (.. " %#DiagnosticSignHint#H" (. count :hints))))
-    (when (not= (. count :info) 0)
-      (set info (.. " %#DiagnosticSignInformation#I" (. count :info))))
-    (.. errors warnings hints info "%#StatusLine#")))
-
-{: diagnostics}