nvim: Make more use of the fennel # function
This commit is contained in:
parent
01271138d3
commit
cf213116e9
1 changed files with 34 additions and 45 deletions
|
@ -133,14 +133,11 @@
|
||||||
{:default true})]
|
{:default true})]
|
||||||
(set self.icon icon)
|
(set self.icon icon)
|
||||||
(set self.icon-color color)))
|
(set self.icon-color color)))
|
||||||
:provider (fn [self]
|
:provider #(when $1.icon
|
||||||
(when self.icon
|
(.. $1.icon " "))
|
||||||
(.. self.icon " ")))
|
:hl #{:fg $1.icon-color}})
|
||||||
:hl (fn [self]
|
(set mod.filetype {:provider #(let [ft vim.bo.filetype]
|
||||||
{:fg self.icon-color})})
|
(if (> (ft:len) 0) ft "no ft"))
|
||||||
(set mod.filetype {:provider (fn []
|
|
||||||
(let [ft vim.bo.filetype]
|
|
||||||
(if (> (ft:len) 0) ft "no ft")))
|
|
||||||
:hl {:fg colors.white}})
|
:hl {:fg colors.white}})
|
||||||
(set mod.encoding {:provider (fn []
|
(set mod.encoding {:provider (fn []
|
||||||
(let [vim-enc (if (not= vim.bo.fenc nil)
|
(let [vim-enc (if (not= vim.bo.fenc nil)
|
||||||
|
@ -155,31 +152,28 @@
|
||||||
{:provider " | " :hl {:fg colors.white}}
|
{:provider " | " :hl {:fg colors.white}}
|
||||||
mod.encoding))
|
mod.encoding))
|
||||||
;; git
|
;; git
|
||||||
(set mod.git {:condition heirline-conditions.is_git_repo
|
(set mod.git
|
||||||
:init (fn [self]
|
{:condition heirline-conditions.is_git_repo
|
||||||
(let [git-status vim.b.gitsigns_status_dict]
|
:init (fn [self]
|
||||||
(set self.git-head git-status.head)
|
(let [git-status vim.b.gitsigns_status_dict]
|
||||||
(set self.git-added (or git-status.added 0))
|
(set self.git-head git-status.head)
|
||||||
(set self.git-removed (or git-status.removed 0))
|
(set self.git-added (or git-status.added 0))
|
||||||
(set self.git-changed (or git-status.changed 0))
|
(set self.git-removed (or git-status.removed 0))
|
||||||
(set self.check-count
|
(set self.git-changed (or git-status.changed 0))
|
||||||
(max-number [self.git-added
|
(set self.check-count
|
||||||
self.git-removed
|
(max-number [self.git-added
|
||||||
self.git-changed]))
|
self.git-removed
|
||||||
(set self.check-length (length self.git-head))))
|
self.git-changed]))
|
||||||
1 mod.space-if-count-or-length
|
(set self.check-length (length self.git-head))))
|
||||||
2 {:provider #(.. " " $1.git-head " ")
|
1 mod.space-if-count-or-length
|
||||||
:hl {:fg colors.black :bg colors.orange :bold true}}
|
2 {:provider #(.. " " $1.git-head " ")
|
||||||
3 mod.space
|
:hl {:fg colors.black :bg colors.orange :bold true}}
|
||||||
4 {:provider (fn [self]
|
3 mod.space
|
||||||
(.. " " self.git-added " "))
|
4 {:provider #(.. " " $1.git-added " ")
|
||||||
:hl {:fg colors.bright_green}}
|
:hl {:fg colors.bright_green}}
|
||||||
5 {:provider (fn [self]
|
5 {:provider #(.. " " $1.git-removed " ")
|
||||||
(.. " " self.git-removed " "))
|
:hl {:fg colors.bright_red}}
|
||||||
:hl {:fg colors.bright_red}}
|
6 {:provider #(.. " " $1.git-changed) :hl {:fg colors.cyan}}})
|
||||||
6 {:provider (fn [self]
|
|
||||||
(.. " " self.git-changed))
|
|
||||||
:hl {:fg colors.cyan}}})
|
|
||||||
;; Diagnostics
|
;; Diagnostics
|
||||||
(set mod.diagnostics {:condition heirline-conditions.has_diagnostics
|
(set mod.diagnostics {:condition heirline-conditions.has_diagnostics
|
||||||
:init (fn [self]
|
:init (fn [self]
|
||||||
|
@ -233,10 +227,9 @@
|
||||||
;; Current Function
|
;; Current Function
|
||||||
(set mod.current-function
|
(set mod.current-function
|
||||||
{:condition heirline-conditions.lsp_attached
|
{:condition heirline-conditions.lsp_attached
|
||||||
:init (fn [self]
|
:init #(if (navic.is_available)
|
||||||
(if (navic.is_available)
|
(set $1.check-length 1)
|
||||||
(set self.check-length 1)
|
(set $1.check-length 0))
|
||||||
(set self.check-length 0)))
|
|
||||||
:update :CursorMoved
|
:update :CursorMoved
|
||||||
1 mod.space-if-length
|
1 mod.space-if-length
|
||||||
2 {:provider #(string.gsub (navic.get_location) "%%" "%%%%")
|
2 {:provider #(string.gsub (navic.get_location) "%%" "%%%%")
|
||||||
|
@ -330,9 +323,8 @@
|
||||||
(let [pos (api.nvim_win_get_cursor 0)]
|
(let [pos (api.nvim_win_get_cursor 0)]
|
||||||
(set self.position-line (tostring (. pos 1)))
|
(set self.position-line (tostring (. pos 1)))
|
||||||
(set self.position-column (tostring (. pos 2)))))
|
(set self.position-column (tostring (. pos 2)))))
|
||||||
:provider (fn [self]
|
:provider #(string.format " %3s:%-3s " $1.position-line
|
||||||
(string.format " %3s:%-3s " self.position-line
|
$1.position-column)
|
||||||
self.position-column))
|
|
||||||
:hl {:fg colors.black :bg colors.purple :bold true}})
|
:hl {:fg colors.black :bg colors.purple :bold true}})
|
||||||
;; Scrollbar
|
;; Scrollbar
|
||||||
(set mod.scrollbar {:init (fn [self]
|
(set mod.scrollbar {:init (fn [self]
|
||||||
|
@ -366,11 +358,8 @@
|
||||||
;; Search count
|
;; Search count
|
||||||
(set mod.search-count
|
(set mod.search-count
|
||||||
{:condition #(> vim.v.hlsearch 0)
|
{:condition #(> vim.v.hlsearch 0)
|
||||||
:init (fn [self]
|
:init #(set $1.count (vim.fn.searchcount {:timeout 5}))
|
||||||
(set self.count (vim.fn.searchcount {:timeout 5})))
|
:provider #(string.format "[%s/%s]" $1.count.current $1.count.total)
|
||||||
:provider (fn [self]
|
|
||||||
(string.format "[%s/%s]" self.count.current
|
|
||||||
self.count.total))
|
|
||||||
:hl {:fg colors.black :bg colors.purple}})
|
:hl {:fg colors.black :bg colors.purple}})
|
||||||
;; Custom Mode
|
;; Custom Mode
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue