diff options
Diffstat (limited to 'fnl/nvrc/statusline.fnl')
-rw-r--r-- | fnl/nvrc/statusline.fnl | 22 |
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"))))) |