From 7425eda3e544fcb1ce81a09c5ff49d839e58ac94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Vulquin?= Date: Tue, 6 Aug 2024 14:11:59 +0200 Subject: nvim: rework lsp module There's still some improvements to be made, but this is cleaner. We lose global caps defaults, but those made no sense to begin with. We do also lose caps overrides, I'll add them back in if I need them. In the process, we gain `every?` and `executable?`. There's also a misc comp print vim.inspect to vim.print change. --- dot_config/nvim/fnl/toast/core.fnl | 8 ++++++++ dot_config/nvim/fnl/toast/nvim.fnl | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 dot_config/nvim/fnl/toast/nvim.fnl (limited to 'dot_config/nvim/fnl/toast') diff --git a/dot_config/nvim/fnl/toast/core.fnl b/dot_config/nvim/fnl/toast/core.fnl index 2a426d1..82b0c40 100644 --- a/dot_config/nvim/fnl/toast/core.fnl +++ b/dot_config/nvim/fnl/toast/core.fnl @@ -19,6 +19,13 @@ "Returns true if the argument is a number." (= :number (type n))) +(fn every? [pred xs] + "Returns true if (pred x) is logical true for every x in xs, else false." + (accumulate [pass true + _ x (ipairs xs) + &until (not pass)] + (pred x))) + ; sequences (fn drop [n xs] "Returns a table of all but the first n elements in xs." @@ -81,6 +88,7 @@ : empty? : nil? : number? + : every? ; sequences : drop : first diff --git a/dot_config/nvim/fnl/toast/nvim.fnl b/dot_config/nvim/fnl/toast/nvim.fnl new file mode 100644 index 0000000..fddc0e7 --- /dev/null +++ b/dot_config/nvim/fnl/toast/nvim.fnl @@ -0,0 +1,7 @@ +(local {: every?} (require :toast.core)) + +(fn executable? [& paths] + "Check if every argument specified is an executable that neovim can resolve." + (every? #(not= 0 (vim.fn.executable $)) paths)) + +{: executable?} -- cgit v1.2.3