From 1a7664b8edb49fb93e7cfee0a26b4e538385a252 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Wed, 9 Aug 2023 20:33:03 +0200 Subject: [PATCH] Update deps --- flake.lock | 6 ++-- home/config/nvim/plugins/formatter.fnl | 43 ++++++++++++-------------- home/programs/nvim/plugins.nix | 6 ++-- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/flake.lock b/flake.lock index 9a7f53b..04f0674 100644 --- a/flake.lock +++ b/flake.lock @@ -415,11 +415,11 @@ ] }, "locked": { - "lastModified": 1691506824, - "narHash": "sha256-Z2Ms7036CCEAfCmDBDy+sFauO6/7fx2UN3aoPCpp4tA=", + "lastModified": 1691599243, + "narHash": "sha256-Lw3VRCFFbjQLxZu37rL/o2RBb95VG8iThEhEkqo3SV8=", "owner": "nix-community", "repo": "home-manager", - "rev": "7b8d43fbaf8450c30caaed5eab876897d0af891b", + "rev": "a8f8f48320c64bd4e3a266a850bbfde2c6fe3a04", "type": "github" }, "original": { diff --git a/home/config/nvim/plugins/formatter.fnl b/home/config/nvim/plugins/formatter.fnl index e0bda33..ead2c83 100644 --- a/home/config/nvim/plugins/formatter.fnl +++ b/home/config/nvim/plugins/formatter.fnl @@ -3,7 +3,13 @@ format-core (require :core) toml (require :toml) treefmt-config-file vim.env.TREEFMT_CONFIG_FILE - treefmt-exts []] + treefmt-exts [] + level vim.log.levels] + (var latest-used-formatter :unknown) + + (fn notify [msg lvl] + (vim.notify (.. msg " [" latest-used-formatter "]") lvl {:title :Format})) + (fn read-file [file] (with-open [f (io.open file :rb)] (f:read :*all))) @@ -17,12 +23,16 @@ (let [ext (format-core.file.extension file-path) ext-glob (.. "*." ext)] (if (vim.list_contains treefmt-exts ext-glob) - [{:cmd :treefmt - :args [file-path] - :ignore_err (fn [err data] - (and (= err nil) (not (string.find data :Error))))}] + (do + (set latest-used-formatter :treefmt) + [{:cmd :treefmt + :args [file-path] + :ignore_err (fn [err data] + (and (= err nil) (not (string.find data :Error))))}]) (= (vim.fn.executable fallback.cmd) 1) - [fallback] + (do + (set latest-used-formatter fallback.cmd) + [fallback]) []))) (fn formatter-prettier [file-path] @@ -58,21 +68,8 @@ :yaml (fn [file-path] (treefmt-or-fallback file-path {:cmd :yamlfmt - :args [file-path]}))}}) - ;; (formatter.setup {:format_on_save #(not= vim.b.nifoc_formatter_disabled 1) - ;; :filetype {:css #(do-format :prettier (args-prettier :css)) - ;; :fennel #(do-format :fnlfmt {:args ["-"]}) - ;; :fish #(do-format :fish_indent {}) - ;; :html #(do-format :prettier - ;; (args-prettier :html)) - ;; :javascript #(do-format :prettier - ;; (args-prettier :javascript)) - ;; :json #(do-format :prettier - ;; (args-prettier :json)) - ;; :sh #(do-format :shfmt (args-shfmt)) - ;; :toml #(do-format :taplo {:args [:fmt "-"]}) - ;; :typescript #(do-format :prettier - ;; (args-prettier :typescript)) - ;; :yaml #(do-format :yamlfmt {:args [:-in]})} - ;; :lsp [:elixirls :nil_ls]}) + :args [file-path]}))} + :hooks {:on_success #(notify "Formatting Succeed" level.INFO) + :on_err #(notify "Formatting Failed" level.ERROR) + :on_timeout #(notify "Formatting Timeout" level.ERROR)}}) M) diff --git a/home/programs/nvim/plugins.nix b/home/programs/nvim/plugins.nix index dd63e92..9a8c8a1 100644 --- a/home/programs/nvim/plugins.nix +++ b/home/programs/nvim/plugins.nix @@ -140,12 +140,12 @@ in }; rainbow-delimiters-nvim = buildVimPluginFrom2Nix { pname = "rainbow-delimiters.nvim"; - version = "2023-08-01"; + version = "2023-08-09"; src = fetchFromGitHub { owner = "HiPhish"; repo = "rainbow-delimiters.nvim"; - rev = "c6380e218a2b4ffcc957a71606900a24e5c7b618"; - sha256 = "1r0ws77n012wf0y12kql28fqqr8x3ywhllw1r5ywp519r8zag1ql"; + rev = "8c6697b293d44b9bbbbdcf37e200cd01c9b66355"; + sha256 = "16kk83f5rpv9vj0y7q4bkp3vrpprzwpijk2pdfi6vwg9gcv6ggy7"; fetchSubmodules = false; }; };