aboutsummaryrefslogtreecommitdiff
path: root/fnl/nvrc
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-12-17 10:57:23 +0900
committersefidel <contact@sefidel.net>2024-12-17 11:00:24 +0900
commit7f61937ce21ef39f7b98b9380a44993732f473a9 (patch)
tree74f7c7468373a063cb94947068b45df60594525b /fnl/nvrc
parent614e98c06e3917eb7d23b03f1be2f9b31b9c2fee (diff)
downloadnvimrc-7f61937ce21ef39f7b98b9380a44993732f473a9.zip
feat(statusline): show greyscale info on unfocused statusline
Diffstat (limited to 'fnl/nvrc')
-rw-r--r--fnl/nvrc/statusline.fnl22
1 files changed, 13 insertions, 9 deletions
diff --git a/fnl/nvrc/statusline.fnl b/fnl/nvrc/statusline.fnl
index c202fd5..dd5699d 100644
--- a/fnl/nvrc/statusline.fnl
+++ b/fnl/nvrc/statusline.fnl
@@ -3,6 +3,9 @@
(import-macros {: ag!
: au!} :nvrc.macro.event)
+(fn focus_hl [group focused?]
+ (string.format "%%#%s#" (if focused? group (.. group "NC"))))
+
(fn diagnostics []
(let [count {}
levels {:errors :Error :warnings :Warn :info :Info :hints :Hint}]
@@ -24,19 +27,20 @@
(.. errors warnings info hints "%#StatusLine#")))
(global statusline {})
-(set statusline.enable (fn []
- (table.concat ["%#StatusLinePad#"
+(set statusline.enable (fn [focused?]
+ (let [hi (fn [group] (focus_hl group focused?))]
+ (table.concat [(hi "StatusLinePad")
"▊ "
- "%#StatusLine#"
- "%#StatusLineAccentBold#"
+ (hi "StatusLine")
+ (hi "StatusLineAccentBold")
"%<%f%m%r "
- "%#StatusLine#"
+ (hi "StatusLine")
"%l:%c | "
(diagnostics)
"%="
- "%#StatusLineAccentBold#"
- "%y "])))
+ (hi "StatusLineAccentBold")
+ "%y "]))))
(ag! ui-statusline
- (au! [WinEnter BufEnter] * #(setl! statusline (.. "%!" (vlua statusline.enable))))
- (au! [WinLeave BufLeave] * #(setl! statusline " ")))
+ (au! [WinEnter BufEnter] * #(setl! statusline (.. "%!" (vlua statusline.enable "v:true"))))
+ (au! [WinLeave BufLeave] * #(setl! statusline (.. "%!" (vlua statusline.enable "v:false")))))