nvim: Update statusline
This commit is contained in:
parent
47c87b7b1e
commit
57958b8d99
3 changed files with 24 additions and 9 deletions
|
@ -54,6 +54,7 @@
|
||||||
(set o.mouse :a)
|
(set o.mouse :a)
|
||||||
(set o.mousemodel :popup_setpos)
|
(set o.mousemodel :popup_setpos)
|
||||||
(set o.cmdheight 1)
|
(set o.cmdheight 1)
|
||||||
|
(set o.showcmdloc :statusline)
|
||||||
;; Backups
|
;; Backups
|
||||||
(set o.backup false)
|
(set o.backup false)
|
||||||
(set o.swapfile false)
|
(set o.swapfile false)
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
(if (> (length str) max-length) (.. (str:sub 1 max-length) ellipsis) str))
|
(if (> (length str) max-length) (.. (str:sub 1 max-length) ellipsis) str))
|
||||||
|
|
||||||
;; Utils
|
;; Utils
|
||||||
(set mod.default-hl (fn []
|
(set mod.default-hl #{:bg colors.black})
|
||||||
{:bg colors.black}))
|
|
||||||
(set mod.space {:provider " "})
|
(set mod.space {:provider " "})
|
||||||
(set mod.spacer {:provider " " :hl {:fg colors.bg :bg colors.bg}})
|
(set mod.spacer {:provider " " :hl {:fg colors.bg :bg colors.bg}})
|
||||||
(set mod.push-right {:provider "%="})
|
(set mod.push-right {:provider "%="})
|
||||||
|
@ -37,9 +36,7 @@
|
||||||
{:condition #(or (> $1.check-count 0) (> $1.check-length 0))
|
{:condition #(or (> $1.check-count 0) (> $1.check-length 0))
|
||||||
:provider " "})
|
:provider " "})
|
||||||
;; Mode
|
;; Mode
|
||||||
(set mod.vi-mode {:init (fn [self]
|
(set mod.vi-mode {:init #(set $1.mode (. (api.nvim_get_mode) :mode))
|
||||||
(let [mode (. (api.nvim_get_mode) :mode)]
|
|
||||||
(set self.mode mode)))
|
|
||||||
:update {1 :ModeChanged
|
:update {1 :ModeChanged
|
||||||
:pattern "*:*"
|
:pattern "*:*"
|
||||||
:callback (vim.schedule_wrap #(vim.cmd.redrawstatus))}
|
:callback (vim.schedule_wrap #(vim.cmd.redrawstatus))}
|
||||||
|
@ -122,9 +119,7 @@
|
||||||
(let [short-mode (self.mode:sub 1 1)]
|
(let [short-mode (self.mode:sub 1 1)]
|
||||||
(. self :mode-hl short-mode)))})
|
(. self :mode-hl short-mode)))})
|
||||||
;; Filetype
|
;; Filetype
|
||||||
(set mod.filetype-block
|
(set mod.filetype-block {:init #(set $1.filename (api.nvim_buf_get_name 0))})
|
||||||
{:init (fn [self]
|
|
||||||
(set self.filename (api.nvim_buf_get_name 0)))})
|
|
||||||
(set mod.file-icon {:init (fn [self]
|
(set mod.file-icon {:init (fn [self]
|
||||||
(let [filename self.filename
|
(let [filename self.filename
|
||||||
ext (vim.fn.fnamemodify filename ":e")
|
ext (vim.fn.fnamemodify filename ":e")
|
||||||
|
@ -361,6 +356,24 @@
|
||||||
:init #(set $1.count (vim.fn.searchcount {:timeout 5}))
|
:init #(set $1.count (vim.fn.searchcount {:timeout 5}))
|
||||||
:provider #(string.format "[%s/%s]" $1.count.current $1.count.total)
|
:provider #(string.format "[%s/%s]" $1.count.current $1.count.total)
|
||||||
:hl {:fg colors.black :bg colors.purple}})
|
:hl {:fg colors.black :bg colors.purple}})
|
||||||
|
;; Command
|
||||||
|
(set mod.command
|
||||||
|
{:condition (fn [self]
|
||||||
|
(let [mode (. (api.nvim_get_mode) :mode)]
|
||||||
|
(vim.tbl_contains self.enabled-modes mode)))
|
||||||
|
:update {1 :ModeChanged :pattern "*:*"}
|
||||||
|
:static {:enabled-modes [:no
|
||||||
|
:nov
|
||||||
|
:noV
|
||||||
|
"no\022"
|
||||||
|
:v
|
||||||
|
:vs
|
||||||
|
:V
|
||||||
|
:Vs
|
||||||
|
"\022"
|
||||||
|
"\022s"]}
|
||||||
|
:provider "[%S]"
|
||||||
|
:hl {:fg colors.black :bg colors.purple}})
|
||||||
;; Custom Mode
|
;; Custom Mode
|
||||||
|
|
||||||
(fn mod.custom-mode [str fg bg]
|
(fn mod.custom-mode [str fg bg]
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
ns.scrollbar
|
ns.scrollbar
|
||||||
ns.space
|
ns.space
|
||||||
ns.position
|
ns.position
|
||||||
ns.search-count])
|
ns.search-count
|
||||||
|
ns.command])
|
||||||
(local telescope-statusline
|
(local telescope-statusline
|
||||||
{:condition (fn []
|
{:condition (fn []
|
||||||
(conditions.buffer_matches {:filetype [:TelescopePrompt]}))
|
(conditions.buffer_matches {:filetype [:TelescopePrompt]}))
|
||||||
|
|
Loading…
Reference in a new issue