1
0
Fork 0

nvim: Tabline styling

This commit is contained in:
Daniel Kempkens 2022-08-29 00:33:48 +02:00
parent 0b6ed8e8e5
commit 7ee5df02b2
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 26 additions and 17 deletions

View file

@ -3,10 +3,18 @@
heirline-utils (require :heirline.utils) heirline-utils (require :heirline.utils)
dracula (require :dracula) dracula (require :dracula)
colors (dracula.colors) colors (dracula.colors)
statusline (require :nifoc.statusline)] statusline (require :nifoc.statusline)
fg-active (. (heirline-utils.get_highlight :TabLineSel) :fg)
fg-inactive (. (heirline-utils.get_highlight :TabLine) :fg)
bg-active (. (heirline-utils.get_highlight :TabLineSel) :bg)
bg-inactive (. (heirline-utils.get_highlight :TabLine) :bg)]
;; Utils ;; Utils
(set mod.truncate-left {:provider "" :hl {:fg :gray}}) (set mod.space
(set mod.truncate-right {:provider "" :hl {:fg :gray}}) {:provider " "
:hl (fn [self]
(if self.is_active {:bg bg-active} {:bg bg-inactive}))})
(set mod.truncate-left {:provider "" :hl {:fg fg-inactive}})
(set mod.truncate-right {:provider "" :hl {:fg fg-inactive}})
;; Filename ;; Filename
(set mod.filename-block (set mod.filename-block
{:init (fn [self] {:init (fn [self]
@ -42,9 +50,11 @@
(set mod.close-button (set mod.close-button
{:condition (fn [self] {:condition (fn [self]
(not (. vim :bo self.bufnr :modified))) (not (. vim :bo self.bufnr :modified)))
1 statusline.space 1 mod.space
2 {:provider "" 2 {:provider ""
:hl {:fg :gray} :hl (fn [self]
(if self.is_active {:fg fg-active :bg bg-active}
{: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})) (api.nvim_buf_delete minwid {:force false}))
@ -54,18 +64,13 @@
(set mod.active-indicator (set mod.active-indicator
{:provider (fn [self] {:provider (fn [self]
(if self.is_active "┃ " " ")) (if self.is_active "┃ " " "))
:hl {:fg colors.purple :bold true}}) :hl (fn [self]
(if self.is_active {:fg colors.purple :bg bg-active :bold true}
{:fg fg-inactive :bg bg-inactive :bold true}))})
;; Block ;; Block
(set mod.buffer-block (set mod.buffer-block [mod.active-indicator
(heirline-utils.surround [" " " "]
(fn [self]
(if self.is_active
(. (heirline-utils.get_highlight :TabLineSel)
:bg)
(. (heirline-utils.get_highlight :TabLine)
:bg)))
[mod.active-indicator
mod.filename-block mod.filename-block
mod.close-button])) mod.close-button
mod.space])
mod) mod)

View file

@ -10,6 +10,10 @@
(set g.dracula_italic_comment true) (set g.dracula_italic_comment true)
(set o.background :dark) (set o.background :dark)
(colorscheme :dracula) (colorscheme :dracula)
;; Tabline
(highlight :TabLine {:fg dracula-colors.comment :bg dracula-colors.black})
(highlight :TabLineSel {:fg dracula-colors.white :bg dracula-colors.bg})
(highlight :TabLineFill {:bg dracula-colors.black})
;; vim-matchup ;; vim-matchup
(highlight :MatchParen {:fg dracula-colors.orange :bold true :italic true}) (highlight :MatchParen {:fg dracula-colors.orange :bold true :italic true})
(highlight :MatchWord {:italic true}) (highlight :MatchWord {:italic true})