1
0
Fork 0

Various fixes

This commit is contained in:
Daniel Kempkens 2023-07-05 23:55:20 +02:00
parent b5fc4465b4
commit e5c390431d
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
8 changed files with 39 additions and 38 deletions

View file

@ -28,6 +28,7 @@ jobs:
- run: nix build '.#nixosConfigurations.tanker.pkgs.attic-server'
- run: nix build '.#nixosConfigurations.tanker.pkgs.attic-client'
- run: nix build '.#nixosConfigurations.tanker.pkgs.deploy-rs'
- run: nix build '.#nixosConfigurations.tanker.config.services.nginx.package'
- run: nix build '.#nixosConfigurations.tanker.config.home-manager.users.daniel.programs.neovim.finalPackage'
build-arm64-linux:
@ -42,4 +43,5 @@ jobs:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build '.#nixosConfigurations.argon.pkgs.attic-client'
- run: nix build '.#nixosConfigurations.argon.pkgs.deploy-rs'
- run: nix build '.#nixosConfigurations.argon.config.services.nginx.package'
- run: nix build '.#nixosConfigurations.argon.config.home-manager.users.daniel.programs.neovim.finalPackage'

View file

@ -71,7 +71,6 @@ in
mosquittoPorts = [ 1883 ];
in
{
"enp41s0".allowedTCPPorts = mosquittoPorts;
"tailscale0".allowedTCPPorts = mosquittoPorts;
"podman+".allowedTCPPorts = mosquittoPorts;
};

View file

@ -324,11 +324,11 @@
"weewx-proxy-flake": "weewx-proxy-flake"
},
"locked": {
"lastModified": 1688545452,
"narHash": "sha256-atZwF9M6GQPJBFvYdH7ErT5do4HW2ZJU8TudQVzvs4k=",
"lastModified": 1688571825,
"narHash": "sha256-ZFT6aMYVsosc2O0ogcGS2ykG21bFkFrhpGeMf719rYs=",
"owner": "nifoc",
"repo": "nix-overlay",
"rev": "5d3b73d5b2dae72e8d27da72e488e51db6f045ba",
"rev": "1a3bd2e604228eafbb01fd867c032139fb2cbc93",
"type": "github"
},
"original": {

View file

@ -88,7 +88,7 @@
(keymap.set :n :<leader>tw
#(telescope-builtin.lsp_dynamic_workspace_symbols telescope-dropdown)
{:buffer bufnr :desc "LSP Workspace Symbols"})
(keymap.set :n :<leader>th #(vim.lsp.buf.inlay_hint bufnr nil)
(keymap.set :n :<leader>th #(vim.lsp.inlay_hint bufnr nil)
{:buffer bufnr :desc "Toggle Inlay Hints"})
(keymap.set :n :<leader>lca
#(telescope-builtin.lsp_code_actions telescope-dropdown)

View file

@ -1,5 +1,5 @@
(let [mod {}
cache {}
cache {:diagnostics {} :gitsigns {}}
api vim.api
o vim.opt
b vim.b
@ -11,14 +11,15 @@
aucmd vim.api.nvim_create_autocmd]
;; Cache
(fn maybe-setup-buffer-cache! [bufnr key]
(when (= (. cache bufnr) nil)
(tset cache bufnr {}))
(when (= (. cache bufnr key) nil)
(tset cache bufnr key {})))
(fn cached-sign [key bufnr lnum]
(?. cache key bufnr lnum))
(fn clear-cache! [bufnr key]
(tset cache bufnr key {}))
(fn maybe-setup-buffer-cache! [key bufnr]
(when (= (. cache key bufnr) nil)
(tset cache key bufnr {})))
(fn clear-cache! [key bufnr]
(tset cache key bufnr {}))
(fn cache-filter [func t]
(let [ret-tab {}]
@ -26,40 +27,36 @@
ret-tab))
(fn clear-diagnostics-cache! [bufnr diagnostics]
(let [key :diagnostics
namespaces (vim.tbl_map #$1.namespace diagnostics)
current-cache (. cache bufnr key)
(let [namespaces (vim.tbl_map #$1.namespace diagnostics)
current-cache (. cache :diagnostics bufnr)
new-cache (cache-filter #(not (vim.tbl_contains namespaces $1.ns))
current-cache)]
(tset cache bufnr key new-cache)))
(tset cache :diagnostics bufnr new-cache)))
(fn update-cache-diagnostics [bufnr diagnostics]
(maybe-setup-buffer-cache! bufnr :diagnostics)
(maybe-setup-buffer-cache! :diagnostics bufnr)
(clear-diagnostics-cache! bufnr diagnostics)
(each [_ diagnostic (pairs diagnostics)]
(let [lnum (+ diagnostic.lnum 1)
current (. cache bufnr :diagnostics lnum)]
current (cached-sign :diagnostics bufnr lnum)]
(when (or (= current nil) (> diagnostic.severity current.severity))
(tset cache bufnr :diagnostics lnum
(tset cache :diagnostics bufnr lnum
{:severity diagnostic.severity
:col diagnostic.col
:ns diagnostic.namespace})))))
(fn update-cache-gitsigns [bufnr]
(maybe-setup-buffer-cache! bufnr :gitsigns)
(clear-cache! bufnr :gitsigns)
(maybe-setup-buffer-cache! :gitsigns bufnr)
(clear-cache! :gitsigns bufnr)
(let [signs (?. (vim.fn.sign_getplaced bufnr
{:group :gitsigns_vimfn_signs_})
1 :signs)]
(when (not= signs nil)
(each [_ sign (pairs signs)]
(let [lnum sign.lnum
current (. cache bufnr :gitsigns lnum)]
current (cached-sign :gitsigns bufnr lnum)]
(when (= current nil)
(tset cache bufnr :gitsigns lnum sign)))))))
(fn cached-sign [bufnr key lnum]
(?. cache bufnr key lnum))
(tset cache :gitsigns bufnr lnum sign)))))))
(aucmd :DiagnosticChanged
{:callback #(update-cache-diagnostics $1.buf $1.data.diagnostics)
@ -69,8 +66,10 @@
:callback #(update-cache-gitsigns $1.buf)
:group augroup
:desc "Update cached gitsigns signs"})
(aucmd :BufWipeout
{:callback #(tset cache $1.buf nil)
(aucmd [:BufWipeout :BufWritePre]
{:callback (fn [args]
(tset cache :diagnostics args.buf nil)
(tset cache :gitsigns args.buf nil))
:group augroup
:desc "Clear sign cache for current buffer"})
;; Line Number
@ -90,7 +89,7 @@
(set mod.gitsigns {:condition #(= b.nifoc_gitsigns_enabled 1)
:init (fn [self]
(let [bufnr (api.nvim_get_current_buf)
sign (cached-sign bufnr :gitsigns v.lnum)]
sign (cached-sign :gitsigns bufnr v.lnum)]
(set self.sign sign)
(set self.has_sign (not= sign nil))))
:provider " ▏"
@ -123,7 +122,7 @@
diagnostic.severity.HINT :DiagnosticSignHint}}
:init (fn [self]
(let [bufnr (api.nvim_get_current_buf)
sign (cached-sign bufnr :diagnostics v.lnum)]
sign (cached-sign :diagnostics bufnr v.lnum)]
(set self.sign sign)
(set self.has_sign (not= sign nil))))
:provider #(if $1.has_sign

View file

@ -6,10 +6,10 @@
augroup (vim.api.nvim_create_augroup :NifocLsp {:clear true})
aucmd vim.api.nvim_create_autocmd]
(fn setup-inlay-hint-toggle [bufnr]
(aucmd :InsertEnter {:callback #(vim.lsp.buf.inlay_hint bufnr false)
(aucmd :InsertEnter {:callback #(vim.lsp.inlay_hint bufnr false)
:buffer bufnr
:group augroup})
(aucmd :InsertLeave {:callback #(vim.lsp.buf.inlay_hint bufnr true)
(aucmd :InsertLeave {:callback #(vim.lsp.inlay_hint bufnr true)
:buffer bufnr
:group augroup}))
@ -20,7 +20,7 @@
(when (client.supports_method :textDocument/documentSymbol)
(navic.attach client bufnr))
(when (client.supports_method :textDocument/inlayHint)
(vim.lsp.buf.inlay_hint bufnr true)
(vim.lsp.inlay_hint bufnr true)
(setup-inlay-hint-toggle bufnr))
(diagnostic.maybe-enable-lsp client bufnr)
(formatting.maybe-enable-lsp client bufnr)))

View file

@ -111,8 +111,8 @@ in
src = fetchFromGitHub {
owner = "nvim-treesitter";
repo = "nvim-treesitter";
rev = "0b81ed9f18333949a74586a1ea0497ae4cbb7cd4";
sha256 = "1bfz64fg0zc9mckd9gqjh098c688aja1422wd0znfgm68w30n3b7";
rev = "1bf573896c7854ca5827074685cd53e81eb30cef";
sha256 = "1c7af7r9a7kjijwj2j17rhnc2szs2q2ggrrcjqs4nnkkwxlsxf8g";
fetchSubmodules = false;
};
};
@ -301,8 +301,8 @@ in
src = fetchFromGitHub {
owner = "L3MON4D3";
repo = "LuaSnip";
rev = "db0aba4a39b28ff5564def07c25bb4bd06a78fdc";
sha256 = "16khnc2zakxfiy6ikdd5afyfp0knplw3l95adzb98m61h4cvfnhi";
rev = "a658ae2906344a1d2b9c507738e585cf68e685c7";
sha256 = "1ffrm03aq6xnxm8jh34m81qr3s5hfx2idbyvmi1kgfqgv8h5azdl";
fetchSubmodules = false;
};
};

View file

@ -8,6 +8,7 @@
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedBrotliSettings = true;
recommendedZstdSettings = true;
recommendedTlsSettings = true;
commonHttpConfig = ''