1
0
Fork 0

Update deps and nvim tabline

This commit is contained in:
Daniel Kempkens 2022-08-29 22:36:11 +02:00
parent 7dc975017e
commit e6fac2dee5
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
7 changed files with 90 additions and 68 deletions

View file

@ -27,11 +27,11 @@
]
},
"locked": {
"lastModified": 1661329936,
"narHash": "sha256-dafFjAcJPo0SdegK3E+SnTI8CNMgV/bBm/6CeDf82f8=",
"lastModified": 1661762118,
"narHash": "sha256-+kQvys2HuLwQBkpN2AoVl4pFQx2MQ7o0jjNdGu2dIV4=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "ef0e7f41cdf8fae1d2390c4df246c90a364ed8d9",
"rev": "157a3c3c4ea482317a4eb4ea2c41db4f16c82420",
"type": "github"
},
"original": {

View file

@ -5,8 +5,7 @@
heirline-utils (require :heirline.utils)
heirline-conditions (require :heirline.conditions)
web-devicons (require :nvim-web-devicons)
dracula (require :dracula)
colors (dracula.colors)
colors (. (require :nifoc.theme) :colors)
formatting (require :nifoc.formatting)
nifoc-treesitter (require :nifoc.treesitter)]
(fn buffer-variable-exists? [key]
@ -19,25 +18,20 @@
(fn get-total-lines []
(api.nvim_buf_line_count 0))
(fn max-number [nums]
(math.max (unpack nums)))
;; Utils
(set mod.default-hl (fn []
{:bg colors.black}))
(set mod.space {:provider " "})
(set mod.spacer {:provider " " :hl {:fg colors.bg :bg colors.bg}})
(set mod.push-right {:provider "%="})
(fn mod.insert-left-unless-empty [item left]
{:after (fn [self]
(if (and (not= self.stl nil) (> (length self.stl) 0))
(set self.stl (.. left self.stl))))
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})
(set mod.space-if-count {:condition #(> $1.check-count 0) :provider " "})
(set mod.space-if-length {:condition #(> $1.check-length 0) :provider " "})
(set mod.space-if-count-or-length
{:condition #(or (> $1.check-count 0) (> $1.check-length 0))
:provider " "})
;; Mode
(set mod.vi-mode {:init (fn [self]
(let [mode (. (api.nvim_get_mode) :mode)]
@ -161,17 +155,23 @@
(set self.git-head git-status.head)
(set self.git-added (or git-status.added 0))
(set self.git-removed (or git-status.removed 0))
(set self.git-changed (or git-status.changed 0))))
1 {:provider #(.. "  " $1.git-head " ")
(set self.git-changed (or git-status.changed 0))
(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}}
2 mod.space
3 {:provider (fn [self]
3 mod.space
4 {:provider (fn [self]
(.. " " self.git-added " "))
:hl {:fg colors.bright_green}}
4 {:provider (fn [self]
5 {:provider (fn [self]
(.. " " self.git-removed " "))
:hl {:fg colors.bright_red}}
5 {:provider (fn [self]
6 {:provider (fn [self]
(.. " " self.git-changed))
:hl {:fg colors.cyan}}})
;; Diagnostics
@ -189,9 +189,15 @@
{:severity d.severity.INFO})))
(set self.hints
(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]
1 {:provider (fn [self]
1 mod.space-if-count
2 {:provider (fn [self]
(let [spacer (if (or (> self.warnings 0)
(> self.info 0)
(> self.hints 0))
@ -199,30 +205,38 @@
(when (> self.errors 0)
(.. " " self.errors spacer))))
:hl {:fg colors.red}}
2 {:provider (fn [self]
3 {:provider (fn [self]
(let [spacer (if (or (> self.info 0)
(> self.hints 0))
" " "")]
(when (> self.warnings 0)
(.. " " self.warnings spacer))))
:hl {:fg colors.yellow}}
3 {:provider (fn [self]
4 {:provider (fn [self]
(let [spacer (if (> self.hints 0) " " "")]
(when (> self.info 0)
(.. " " self.info spacer))))
:hl {:fg colors.cyan}}
4 {:provider (fn [self]
5 {:provider (fn [self]
(when (> self.hints 0)
(.. " " self.hints)))
:hl {:fg colors.cyan}}})
;; Current Function
(set mod.current-function
{:condition heirline-conditions.lsp_attached
:provider (fn []
(let [ctx vim.b.nifoc_lsp_current_context]
(when (and (not= ctx nil) (> (ctx:len) 0))
ctx)))
:hl {:fg colors.white}})
:init (fn [self]
(let [ctx vim.b.nifoc_lsp_current_context]
(if (and (not= ctx nil) (> (ctx:len) 0))
(do
(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
(set mod.buffer-options
{:static {:format {:dos "" :unix "" :mac ""}}

View file

@ -1,8 +1,7 @@
(let [mod {}
api vim.api
heirline-utils (require :heirline.utils)
dracula (require :dracula)
colors (dracula.colors)
colors (. (require :nifoc.theme) :colors)
statusline (require :nifoc.statusline)
fg-active (. (heirline-utils.get_highlight :TabLineSel) :fg)
fg-inactive (. (heirline-utils.get_highlight :TabLine) :fg)
@ -46,6 +45,12 @@
(set mod.filename-block
(heirline-utils.insert mod.filename-block statusline.file-icon
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
(set mod.close-button
{:condition (fn [self]
@ -60,6 +65,7 @@
(api.nvim_buf_delete minwid {:force false}))
:minwid (fn [self]
self.bufnr)}}})
(set mod.close-tabpage {:provider "%999X  %X" :hl :TabLine})
;; Indicator
(set mod.active-indicator
{:provider (fn [self]
@ -67,10 +73,21 @@
:hl (fn [self]
(if self.is_active {:fg colors.purple :bg bg-active :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
(set mod.buffer-block [mod.active-indicator
mod.filename-block
mod.close-button
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)

View file

@ -5,24 +5,25 @@
g vim.g
dracula (require :dracula)
dracula-colors (dracula.colors)]
(set mod.colors dracula-colors)
(fn mod.setup []
(set g.dracula_show_end_of_buffer false)
(set g.dracula_italic_comment true)
(set o.background :dark)
(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})
(highlight :TabLine {:fg mod.colors.comment :bg mod.colors.black})
(highlight :TabLineSel {:fg mod.colors.white :bg mod.colors.bg})
(highlight :TabLineFill {:bg mod.colors.black})
;; 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-link :MatchupVirtualText :Comment)
;; vim-illuminate
(highlight :IlluminatedWordText {:bg dracula-colors.selection})
(highlight :IlluminatedWordRead {:bg dracula-colors.selection})
(highlight :IlluminatedWordWrite
{:bg dracula-colors.selection :underline true}))
(highlight :IlluminatedWordText {:bg mod.colors.selection})
(highlight :IlluminatedWordRead {:bg mod.colors.selection})
(highlight :IlluminatedWordWrite {:bg mod.colors.selection :underline true}))
mod)

View file

@ -5,10 +5,9 @@
nt (require :nifoc.tabline)]
(local default-statusline [;; Left
ns.vi-mode
(ns.insert-left-unless-empty ns.git " ")
(ns.insert-left-unless-empty ns.diagnostics " ")
(ns.insert-left-unless-empty ns.current-function
" ")
ns.git
ns.diagnostics
ns.current-function
;; Right
ns.push-right
ns.filetype-block
@ -37,8 +36,10 @@
2 shell-statusline
3 default-statusline})
(local winbar nil)
(local tabline (utils.make_buflist nt.buffer-block nt.truncate-left
nt.truncate-right))
(local tabline [nt.os-indicator
(utils.make_buflist nt.buffer-block nt.truncate-left
nt.truncate-right)
nt.tabpages-block])
;; Load Lines
(set vim.opt.laststatus 3)
(heirline.setup statuslines winbar tabline))

View file

@ -1,3 +1,3 @@
(let [illuminate (require :illuminate)]
(illuminate.configure {:filetypes_denylist [:netrw]}))
(illuminate.configure {:filetypes_denylist [:TelescopePrompt :netrw]}))

View file

@ -113,12 +113,12 @@ rec {
};
nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter";
version = "2022-08-28";
version = "2022-08-29";
src = pkgs.fetchFromGitHub {
owner = "nvim-treesitter";
repo = "nvim-treesitter";
rev = "9560e3ce7d9f01b21f7f14c0b2d93f718e1ccf36";
sha256 = "061n5wvmaqyalnajksscy8w4k6wd43vn5zsy44sy4wfh99lnkjr6";
rev = "f3c53d225ada93a99bfd818e1c40012400e2dc55";
sha256 = "1qj4rp8ry1qyv6lsdxbmnl9h0bb2jc9hs52q55f4wxw5rxq9zf00";
fetchSubmodules = false;
};
passthru.withPlugins =
@ -483,12 +483,12 @@ rec {
};
heirline-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "heirline.nvim";
version = "2022-08-28";
version = "2022-08-29";
src = pkgs.fetchFromGitHub {
owner = "rebelot";
repo = "heirline.nvim";
rev = "489aa37a6aec30c43217bd4ddc75ef9f945c9d0d";
sha256 = "0ig9h71wl6ac7injl7mzdxzbx6aa7jc8g37xfbi1l2bndfnc9brw";
rev = "94afeea9a4103923cd8e1f8fac5308bdb00ca3b8";
sha256 = "1hsvp6b50sya5v0gxiy42rdn3fhlbm4lndl56h74lwkzm69zmpky";
fetchSubmodules = false;
};
};
@ -569,15 +569,4 @@ rec {
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;
};
};
}