1
0
Fork 0

nvim: heirline fixes

This commit is contained in:
Daniel Kempkens 2023-03-29 22:18:22 +02:00
parent 5198bacc1d
commit dc43bd481a
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 14 additions and 6 deletions

View file

@ -40,7 +40,9 @@
(set mod.vi-mode {:init (fn [self] (set mod.vi-mode {:init (fn [self]
(let [mode (. (api.nvim_get_mode) :mode)] (let [mode (. (api.nvim_get_mode) :mode)]
(set self.mode mode))) (set self.mode mode)))
:update :ModeChanged :update {1 :ModeChanged
:pattern "*:*"
:callback (vim.schedule_wrap #(vim.cmd.redrawstatus))}
:static {:mode-names {:n :NORMAL :static {:mode-names {:n :NORMAL
:no :O-PENDING :no :O-PENDING
:nov :O-PENDING :nov :O-PENDING
@ -205,19 +207,22 @@
(let [spacer (if (or (> self.warnings 0) (let [spacer (if (or (> self.warnings 0)
(> self.info 0) (> self.info 0)
(> self.hints 0)) (> self.hints 0))
" " "")] " "
"")]
(when (> self.errors 0) (when (> self.errors 0)
(.. " " self.errors spacer)))) (.. " " self.errors spacer))))
:hl {:fg colors.red}} :hl {:fg colors.red}}
3 {:provider (fn [self] 3 {:provider (fn [self]
(let [spacer (if (or (> self.info 0) (let [spacer (if (or (> self.info 0)
(> self.hints 0)) (> self.hints 0))
" " "")] " "
"")]
(when (> self.warnings 0) (when (> self.warnings 0)
(.. " " self.warnings spacer)))) (.. " " self.warnings spacer))))
:hl {:fg colors.yellow}} :hl {:fg colors.yellow}}
4 {:provider (fn [self] 4 {:provider (fn [self]
(let [spacer (if (> self.hints 0) " " "")] (let [spacer (if (> self.hints 0) " "
"")]
(when (> self.info 0) (when (> self.info 0)
(.. " " self.info spacer)))) (.. " " self.info spacer))))
:hl {:fg colors.cyan}} :hl {:fg colors.cyan}}

View file

@ -42,7 +42,8 @@
:provider (fn [self] :provider (fn [self]
(if (= api.nvim_buf_get_option self.bufnr (if (= api.nvim_buf_get_option self.bufnr
:terminal) :terminal)
" " " ")) " "
" "))
:hl {:fg colors.orange}}]) :hl {:fg colors.orange}}])
(set mod.filename-block (set mod.filename-block
(heirline-utils.insert mod.filename-block statusline.file-icon (heirline-utils.insert mod.filename-block statusline.file-icon
@ -65,7 +66,9 @@
{:fg fg-inactive :bg bg-inactive})) {:fg fg-inactive :bg bg-inactive}))
:on_click {:name :heirline_tabline_close_buffer_callback :on_click {:name :heirline_tabline_close_buffer_callback
:callback (fn [_ minwid] :callback (fn [_ minwid]
(api.nvim_buf_delete minwid {:force false})) (vim.schedule #(api.nvim_buf_delete minwid
{:force false}))
(vim.cmd.redrawtabline))
:minwid (fn [self] :minwid (fn [self]
self.bufnr)}}}) self.bufnr)}}})
(set mod.close-tabpage {:provider "%999X  %X" :hl :TabLine}) (set mod.close-tabpage {:provider "%999X  %X" :hl :TabLine})