Update deps and nvim tabline
This commit is contained in:
parent
7dc975017e
commit
e6fac2dee5
7 changed files with 90 additions and 68 deletions
6
flake.lock
generated
6
flake.lock
generated
|
@ -27,11 +27,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1661329936,
|
"lastModified": 1661762118,
|
||||||
"narHash": "sha256-dafFjAcJPo0SdegK3E+SnTI8CNMgV/bBm/6CeDf82f8=",
|
"narHash": "sha256-+kQvys2HuLwQBkpN2AoVl4pFQx2MQ7o0jjNdGu2dIV4=",
|
||||||
"owner": "lnl7",
|
"owner": "lnl7",
|
||||||
"repo": "nix-darwin",
|
"repo": "nix-darwin",
|
||||||
"rev": "ef0e7f41cdf8fae1d2390c4df246c90a364ed8d9",
|
"rev": "157a3c3c4ea482317a4eb4ea2c41db4f16c82420",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
heirline-utils (require :heirline.utils)
|
heirline-utils (require :heirline.utils)
|
||||||
heirline-conditions (require :heirline.conditions)
|
heirline-conditions (require :heirline.conditions)
|
||||||
web-devicons (require :nvim-web-devicons)
|
web-devicons (require :nvim-web-devicons)
|
||||||
dracula (require :dracula)
|
colors (. (require :nifoc.theme) :colors)
|
||||||
colors (dracula.colors)
|
|
||||||
formatting (require :nifoc.formatting)
|
formatting (require :nifoc.formatting)
|
||||||
nifoc-treesitter (require :nifoc.treesitter)]
|
nifoc-treesitter (require :nifoc.treesitter)]
|
||||||
(fn buffer-variable-exists? [key]
|
(fn buffer-variable-exists? [key]
|
||||||
|
@ -19,25 +18,20 @@
|
||||||
(fn get-total-lines []
|
(fn get-total-lines []
|
||||||
(api.nvim_buf_line_count 0))
|
(api.nvim_buf_line_count 0))
|
||||||
|
|
||||||
|
(fn max-number [nums]
|
||||||
|
(math.max (unpack nums)))
|
||||||
|
|
||||||
;; Utils
|
;; Utils
|
||||||
(set mod.default-hl (fn []
|
(set mod.default-hl (fn []
|
||||||
{: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 "%="})
|
||||||
|
(set mod.space-if-count {:condition #(> $1.check-count 0) :provider " "})
|
||||||
(fn mod.insert-left-unless-empty [item left]
|
(set mod.space-if-length {:condition #(> $1.check-length 0) :provider " "})
|
||||||
{:after (fn [self]
|
(set mod.space-if-count-or-length
|
||||||
(if (and (not= self.stl nil) (> (length self.stl) 0))
|
{:condition #(or (> $1.check-count 0) (> $1.check-length 0))
|
||||||
(set self.stl (.. left self.stl))))
|
:provider " "})
|
||||||
1 item})
|
|
||||||
|
|
||||||
(fn mod.insert-right-unless-empty [item right]
|
|
||||||
{:after (fn [self]
|
|
||||||
(if (and (not= self.stl nil) (> (length self.stl) 0))
|
|
||||||
(set self.stl (.. self.stl right))))
|
|
||||||
1 item})
|
|
||||||
|
|
||||||
;; Mode
|
;; Mode
|
||||||
(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)]
|
||||||
|
@ -161,17 +155,23 @@
|
||||||
(set self.git-head git-status.head)
|
(set self.git-head git-status.head)
|
||||||
(set self.git-added (or git-status.added 0))
|
(set self.git-added (or git-status.added 0))
|
||||||
(set self.git-removed (or git-status.removed 0))
|
(set self.git-removed (or git-status.removed 0))
|
||||||
(set self.git-changed (or git-status.changed 0))))
|
(set self.git-changed (or git-status.changed 0))
|
||||||
1 {:provider #(.. " " $1.git-head " ")
|
(set self.check-count
|
||||||
|
(max-number [self.git-added
|
||||||
|
self.git-removed
|
||||||
|
self.git-changed]))
|
||||||
|
(set self.check-length (length self.git-head))))
|
||||||
|
1 mod.space-if-count-or-length
|
||||||
|
2 {:provider #(.. " " $1.git-head " ")
|
||||||
:hl {:fg colors.black :bg colors.orange :bold true}}
|
:hl {:fg colors.black :bg colors.orange :bold true}}
|
||||||
2 mod.space
|
3 mod.space
|
||||||
3 {:provider (fn [self]
|
4 {:provider (fn [self]
|
||||||
(.. " " self.git-added " "))
|
(.. " " self.git-added " "))
|
||||||
:hl {:fg colors.bright_green}}
|
:hl {:fg colors.bright_green}}
|
||||||
4 {:provider (fn [self]
|
5 {:provider (fn [self]
|
||||||
(.. " " self.git-removed " "))
|
(.. " " self.git-removed " "))
|
||||||
:hl {:fg colors.bright_red}}
|
:hl {:fg colors.bright_red}}
|
||||||
5 {:provider (fn [self]
|
6 {:provider (fn [self]
|
||||||
(.. " " self.git-changed))
|
(.. " " self.git-changed))
|
||||||
:hl {:fg colors.cyan}}})
|
:hl {:fg colors.cyan}}})
|
||||||
;; Diagnostics
|
;; Diagnostics
|
||||||
|
@ -189,9 +189,15 @@
|
||||||
{:severity d.severity.INFO})))
|
{:severity d.severity.INFO})))
|
||||||
(set self.hints
|
(set self.hints
|
||||||
(length (d.get 0
|
(length (d.get 0
|
||||||
{:severity d.severity.HINT})))))
|
{:severity d.severity.HINT})))
|
||||||
|
(set self.check-count
|
||||||
|
(max-number [self.errors
|
||||||
|
self.warnings
|
||||||
|
self.info
|
||||||
|
self.hints]))))
|
||||||
:update [:DiagnosticChanged :BufEnter]
|
:update [:DiagnosticChanged :BufEnter]
|
||||||
1 {:provider (fn [self]
|
1 mod.space-if-count
|
||||||
|
2 {:provider (fn [self]
|
||||||
(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))
|
||||||
|
@ -199,30 +205,38 @@
|
||||||
(when (> self.errors 0)
|
(when (> self.errors 0)
|
||||||
(.. " " self.errors spacer))))
|
(.. " " self.errors spacer))))
|
||||||
:hl {:fg colors.red}}
|
:hl {:fg colors.red}}
|
||||||
2 {: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}}
|
||||||
3 {: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}}
|
||||||
4 {:provider (fn [self]
|
5 {:provider (fn [self]
|
||||||
(when (> self.hints 0)
|
(when (> self.hints 0)
|
||||||
(.. " " self.hints)))
|
(.. " " self.hints)))
|
||||||
:hl {:fg colors.cyan}}})
|
:hl {:fg colors.cyan}}})
|
||||||
;; Current Function
|
;; Current Function
|
||||||
(set mod.current-function
|
(set mod.current-function
|
||||||
{:condition heirline-conditions.lsp_attached
|
{:condition heirline-conditions.lsp_attached
|
||||||
:provider (fn []
|
:init (fn [self]
|
||||||
(let [ctx vim.b.nifoc_lsp_current_context]
|
(let [ctx vim.b.nifoc_lsp_current_context]
|
||||||
(when (and (not= ctx nil) (> (ctx:len) 0))
|
(if (and (not= ctx nil) (> (ctx:len) 0))
|
||||||
ctx)))
|
(do
|
||||||
:hl {:fg colors.white}})
|
(set self.current-ctx ctx)
|
||||||
|
(set self.check-length 1))
|
||||||
|
(do
|
||||||
|
(set self.current-ctx nil)
|
||||||
|
(set self.check-length 0)))))
|
||||||
|
1 mod.space-if-length
|
||||||
|
2 {:provider (fn [self]
|
||||||
|
self.current-ctx)
|
||||||
|
:hl {:fg colors.white}}})
|
||||||
;; Buffer Options
|
;; Buffer Options
|
||||||
(set mod.buffer-options
|
(set mod.buffer-options
|
||||||
{:static {:format {:dos "" :unix "" :mac ""}}
|
{:static {:format {:dos "" :unix "" :mac ""}}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
(let [mod {}
|
(let [mod {}
|
||||||
api vim.api
|
api vim.api
|
||||||
heirline-utils (require :heirline.utils)
|
heirline-utils (require :heirline.utils)
|
||||||
dracula (require :dracula)
|
colors (. (require :nifoc.theme) :colors)
|
||||||
colors (dracula.colors)
|
|
||||||
statusline (require :nifoc.statusline)
|
statusline (require :nifoc.statusline)
|
||||||
fg-active (. (heirline-utils.get_highlight :TabLineSel) :fg)
|
fg-active (. (heirline-utils.get_highlight :TabLineSel) :fg)
|
||||||
fg-inactive (. (heirline-utils.get_highlight :TabLine) :fg)
|
fg-inactive (. (heirline-utils.get_highlight :TabLine) :fg)
|
||||||
|
@ -46,6 +45,12 @@
|
||||||
(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
|
||||||
mod.filename mod.file-flags))
|
mod.filename mod.file-flags))
|
||||||
|
;; Tabpages
|
||||||
|
(set mod.tabpage
|
||||||
|
{:provider (fn [self]
|
||||||
|
(.. "%" self.tabnr "T " self.tabnr " %T"))
|
||||||
|
:hl (fn [self]
|
||||||
|
(if self.is_active :TabLineSel :TabLine))})
|
||||||
;; Buttons
|
;; Buttons
|
||||||
(set mod.close-button
|
(set mod.close-button
|
||||||
{:condition (fn [self]
|
{:condition (fn [self]
|
||||||
|
@ -60,6 +65,7 @@
|
||||||
(api.nvim_buf_delete minwid {:force false}))
|
(api.nvim_buf_delete minwid {:force false}))
|
||||||
:minwid (fn [self]
|
:minwid (fn [self]
|
||||||
self.bufnr)}}})
|
self.bufnr)}}})
|
||||||
|
(set mod.close-tabpage {:provider "%999X %X" :hl :TabLine})
|
||||||
;; Indicator
|
;; Indicator
|
||||||
(set mod.active-indicator
|
(set mod.active-indicator
|
||||||
{:provider (fn [self]
|
{:provider (fn [self]
|
||||||
|
@ -67,10 +73,21 @@
|
||||||
:hl (fn [self]
|
:hl (fn [self]
|
||||||
(if self.is_active {:fg colors.purple :bg bg-active :bold true}
|
(if self.is_active {:fg colors.purple :bg bg-active :bold true}
|
||||||
{:fg fg-inactive :bg bg-inactive :bold true}))})
|
{:fg fg-inactive :bg bg-inactive :bold true}))})
|
||||||
|
(set mod.os-indicator {:static {:uname (vim.loop.os_uname)
|
||||||
|
:os {:Darwin "" :Linux ""}}
|
||||||
|
:hl {:fg colors.white :bg bg-active}
|
||||||
|
1 {:provider " "}
|
||||||
|
2 {:provider (fn [self]
|
||||||
|
(. self :os self.uname.sysname))}
|
||||||
|
3 {:provider " "}})
|
||||||
;; Block
|
;; Block
|
||||||
(set mod.buffer-block [mod.active-indicator
|
(set mod.buffer-block [mod.active-indicator
|
||||||
mod.filename-block
|
mod.filename-block
|
||||||
mod.close-button
|
mod.close-button
|
||||||
mod.space])
|
mod.space])
|
||||||
|
(set mod.tabpages-block {:condition #(>= (length (api.nvim_list_tabpages)) 2)
|
||||||
|
1 statusline.push-right
|
||||||
|
2 (heirline-utils.make_tablist mod.tabpage)
|
||||||
|
3 mod.close-tabpage})
|
||||||
mod)
|
mod)
|
||||||
|
|
||||||
|
|
|
@ -5,24 +5,25 @@
|
||||||
g vim.g
|
g vim.g
|
||||||
dracula (require :dracula)
|
dracula (require :dracula)
|
||||||
dracula-colors (dracula.colors)]
|
dracula-colors (dracula.colors)]
|
||||||
|
(set mod.colors dracula-colors)
|
||||||
|
|
||||||
(fn mod.setup []
|
(fn mod.setup []
|
||||||
(set g.dracula_show_end_of_buffer false)
|
(set g.dracula_show_end_of_buffer false)
|
||||||
(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
|
;; Tabline
|
||||||
(highlight :TabLine {:fg dracula-colors.comment :bg dracula-colors.black})
|
(highlight :TabLine {:fg mod.colors.comment :bg mod.colors.black})
|
||||||
(highlight :TabLineSel {:fg dracula-colors.white :bg dracula-colors.bg})
|
(highlight :TabLineSel {:fg mod.colors.white :bg mod.colors.bg})
|
||||||
(highlight :TabLineFill {:bg dracula-colors.black})
|
(highlight :TabLineFill {:bg mod.colors.black})
|
||||||
;; vim-matchup
|
;; vim-matchup
|
||||||
(highlight :MatchParen {:fg dracula-colors.orange :bold true :italic true})
|
(highlight :MatchParen {:fg mod.colors.orange :bold true :italic true})
|
||||||
(highlight :MatchWord {:italic true})
|
(highlight :MatchWord {:italic true})
|
||||||
(highlight-link :MatchupVirtualText :Comment)
|
(highlight-link :MatchupVirtualText :Comment)
|
||||||
;; vim-illuminate
|
;; vim-illuminate
|
||||||
(highlight :IlluminatedWordText {:bg dracula-colors.selection})
|
(highlight :IlluminatedWordText {:bg mod.colors.selection})
|
||||||
(highlight :IlluminatedWordRead {:bg dracula-colors.selection})
|
(highlight :IlluminatedWordRead {:bg mod.colors.selection})
|
||||||
(highlight :IlluminatedWordWrite
|
(highlight :IlluminatedWordWrite {:bg mod.colors.selection :underline true}))
|
||||||
{:bg dracula-colors.selection :underline true}))
|
|
||||||
|
|
||||||
mod)
|
mod)
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,9 @@
|
||||||
nt (require :nifoc.tabline)]
|
nt (require :nifoc.tabline)]
|
||||||
(local default-statusline [;; Left
|
(local default-statusline [;; Left
|
||||||
ns.vi-mode
|
ns.vi-mode
|
||||||
(ns.insert-left-unless-empty ns.git " ")
|
ns.git
|
||||||
(ns.insert-left-unless-empty ns.diagnostics " ")
|
ns.diagnostics
|
||||||
(ns.insert-left-unless-empty ns.current-function
|
ns.current-function
|
||||||
" ")
|
|
||||||
;; Right
|
;; Right
|
||||||
ns.push-right
|
ns.push-right
|
||||||
ns.filetype-block
|
ns.filetype-block
|
||||||
|
@ -37,8 +36,10 @@
|
||||||
2 shell-statusline
|
2 shell-statusline
|
||||||
3 default-statusline})
|
3 default-statusline})
|
||||||
(local winbar nil)
|
(local winbar nil)
|
||||||
(local tabline (utils.make_buflist nt.buffer-block nt.truncate-left
|
(local tabline [nt.os-indicator
|
||||||
nt.truncate-right))
|
(utils.make_buflist nt.buffer-block nt.truncate-left
|
||||||
|
nt.truncate-right)
|
||||||
|
nt.tabpages-block])
|
||||||
;; Load Lines
|
;; Load Lines
|
||||||
(set vim.opt.laststatus 3)
|
(set vim.opt.laststatus 3)
|
||||||
(heirline.setup statuslines winbar tabline))
|
(heirline.setup statuslines winbar tabline))
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
(let [illuminate (require :illuminate)]
|
(let [illuminate (require :illuminate)]
|
||||||
(illuminate.configure {:filetypes_denylist [:netrw]}))
|
(illuminate.configure {:filetypes_denylist [:TelescopePrompt :netrw]}))
|
||||||
|
|
||||||
|
|
|
@ -113,12 +113,12 @@ rec {
|
||||||
};
|
};
|
||||||
nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
pname = "nvim-treesitter";
|
pname = "nvim-treesitter";
|
||||||
version = "2022-08-28";
|
version = "2022-08-29";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "nvim-treesitter";
|
owner = "nvim-treesitter";
|
||||||
repo = "nvim-treesitter";
|
repo = "nvim-treesitter";
|
||||||
rev = "9560e3ce7d9f01b21f7f14c0b2d93f718e1ccf36";
|
rev = "f3c53d225ada93a99bfd818e1c40012400e2dc55";
|
||||||
sha256 = "061n5wvmaqyalnajksscy8w4k6wd43vn5zsy44sy4wfh99lnkjr6";
|
sha256 = "1qj4rp8ry1qyv6lsdxbmnl9h0bb2jc9hs52q55f4wxw5rxq9zf00";
|
||||||
fetchSubmodules = false;
|
fetchSubmodules = false;
|
||||||
};
|
};
|
||||||
passthru.withPlugins =
|
passthru.withPlugins =
|
||||||
|
@ -483,12 +483,12 @@ rec {
|
||||||
};
|
};
|
||||||
heirline-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
heirline-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
pname = "heirline.nvim";
|
pname = "heirline.nvim";
|
||||||
version = "2022-08-28";
|
version = "2022-08-29";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "rebelot";
|
owner = "rebelot";
|
||||||
repo = "heirline.nvim";
|
repo = "heirline.nvim";
|
||||||
rev = "489aa37a6aec30c43217bd4ddc75ef9f945c9d0d";
|
rev = "94afeea9a4103923cd8e1f8fac5308bdb00ca3b8";
|
||||||
sha256 = "0ig9h71wl6ac7injl7mzdxzbx6aa7jc8g37xfbi1l2bndfnc9brw";
|
sha256 = "1hsvp6b50sya5v0gxiy42rdn3fhlbm4lndl56h74lwkzm69zmpky";
|
||||||
fetchSubmodules = false;
|
fetchSubmodules = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -569,15 +569,4 @@ rec {
|
||||||
fetchSubmodules = false;
|
fetchSubmodules = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
nvim-visual-eof-lua = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
|
||||||
pname = "nvim-visual-eof.lua";
|
|
||||||
version = "2021-03-14";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "LumaKernel";
|
|
||||||
repo = "nvim-visual-eof.lua";
|
|
||||||
rev = "3c001c6cda4db5bf62ba33344e61e30230acd9eb";
|
|
||||||
sha256 = "0mm4zadcl9fkqwxb8kvzfspach2vxxpr3kzgnb3z3ry6zl5gcd3b";
|
|
||||||
fetchSubmodules = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue