From d64d788e163f6d759e8a1adf4281dd5dd2841a78 Mon Sep 17 00:00:00 2001 From: Practicalli Johnny <250870+practicalli-johnny@users.noreply.github.com> Date: Sat, 25 May 2024 16:21:48 +0100 Subject: [PATCH] docs(clojure): update pack description & simplify examples (#991) --- lua/astrocommunity/pack/clojure/README.md | 136 ++-------------------- 1 file changed, 10 insertions(+), 126 deletions(-) diff --git a/lua/astrocommunity/pack/clojure/README.md b/lua/astrocommunity/pack/clojure/README.md index b3e8707f5..24e802e8a 100644 --- a/lua/astrocommunity/pack/clojure/README.md +++ b/lua/astrocommunity/pack/clojure/README.md @@ -14,13 +14,11 @@ The Clojure pack requires: The Clojure language pack includes: - `clojure` treesitter parsers -- `clojure-ls` language server +- [clojure-lsp](https://clojure-lsp.io/) language server - Clojure REPL client: [Olical/conjure](https://github.com/Olical/conjure) -- Structural editing: [gpanders/nvim-parinfer](https://github.com/gpanders/nvim-parinfer) & plugins -- Add autocmd to disable lsp diagnostics in Conjure log -- Add autocmd to configure comments to Clojure style guide +- Structural editing: [gpanders/nvim-parinfer](https://github.com/gpanders/nvim-parinfer) & [PaterJason/nvim-treesitter-sexp](https://github.com/PaterJason/nvim-treesitter-sexp) -> NOTE: The conjure HUD is not shown by default. Consider using `,lt` to open the REPL log in its own tab split, with `gt` to toggle between code and REPL log. +> NOTE: Conjure is available as a [code-runner](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/code-runner) plugin config. nvim-treesitter-sexp and nvim-parinfer are available as [editing-support plugin configurations](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/editing-support) ## Clojure Guides @@ -28,63 +26,21 @@ The Clojure language pack includes: - [Clojure.org](https://clojure.org/index) API reference and guides - [Conjure - Clojure guide](https://github.com/Olical/conjure/wiki/Quick-start:-Clojure) -- [Practicalli Neovim](https://practical.li/neovim/) Clojure development workflow +- [Practicalli Neovim](https://practical.li/neovim/) Clojure development workflow and examples of [configuring Astrocommunity clojure pack](https://practical.li/neovim/configuration/astronvim/astrocommunity/) -## Override Configuration - -Configuration in the AstroNvim Community clojure language pack can be overridden and plugins disabled to meet your needs - -### Parinfer -By aligning clojure code correctly, parinfer will automatically correct the position of parenthesis and other delimiters, i.e. `()`, `[]`, `{}` +## Override Configuration -Parinfer can be disabled if preferred and the more traditional slurp/barf structural editing be done via [nvim-treesitter-sexp](#nvim-treesitter-sexp) +Plugins in the language pack can be disabled and default options overridden. -Include the Clojure language pack and disable the parinfer plugin by setting the plugin name to equal false +Example: Include the Clojure language pack and disable the parinfer plugin by setting the `enabled` key to false. ```lua { import = "astrocommunity.pack.clojure" }, { "gpanders/nvim-parinfer", enabled = false }, ``` -### Conjure - -Configure the Clojure REPL client via the conjure plugin. - -> NOTE: `:help conjure-client-clojure-nrepl` for full list of Conjure options for Clojure. - -Enable the REPL log HUD and set location to full width along the bottom of the sCReen. Note: without setting the location, the HUD will appear in the top right corner of the sCReen. - -```lua - ["conjure#log#hud#enabled"] = true, -- enable HUD - ["conjure#log#hud#width"] = 1, - ["conjure#log#hud#anchor"] = "SE", - ["conjure#log#botright"] = true, -``` - -Disable the auto repl (babashka) if an nREPL process is not listening, i.e. `.nrepl-port` file does not exist or does not contain a port number. - -```lua - -- Disable auto repl (babashka) - ["conjure#client#clojure#nrepl#connection#auto_repl#enabled"] = false, - ["conjure#client#clojure#nrepl#connection#auto_repl#hidden"] = true, - ["conjure#client#clojure#nrepl#connection#auto_repl#cmd"] = nil, - ["conjure#client#clojure#nrepl#eval#auto_require"] = false, - -``` - -Change the test runner used by Conjure. `clojure.test` runner is used by default - -- `"clojure"` clojure.test (default) -- `"clojuresCRipt" cljs.test -- `"kaocha"` lambdaisland/kaocha - -```lua - -- Set Test runner: "clojure", "clojuresCRipt", "kaocha" - ["conjure#client#clojure#nrepl#test#runner"] = "kaocha", -``` - -Working example with additional configuration options to show HUD along bottom, enable auto repl if no nREPL process found and set test runner to use lambdaisland/kaocha. +Example: Change the test runner used by Conjure. `clojure.test` runner is used by default ```lua { import = "astrocommunity.pack.clojure" }, @@ -93,19 +49,7 @@ Working example with additional configuration options to show HUD along bottom, opts = { options = { g = { - -- Enable HUD and show full lenght along bottom - ["conjure#log#hud#enabled"] = true, -- show log by default? - ["conjure#log#hud#width"] = 1, - ["conjure#log#hud#anchor"] = "SE", - ["conjure#log#botright"] = true, - - -- Disable auto repl (babashka) - ["conjure#client#clojure#nrepl#connection#auto_repl#enabled"] = false, - ["conjure#client#clojure#nrepl#connection#auto_repl#hidden"] = true, - ["conjure#client#clojure#nrepl#connection#auto_repl#cmd"] = nil, - ["conjure#client#clojure#nrepl#eval#auto_require"] = false, - - -- Set Test runner: "clojure", "clojuresCRipt", "kaocha" + -- Set Test runner: "clojure", "clojurescript", "kaocha" ["conjure#client#clojure#nrepl#test#runner"] = "kaocha", }, }, @@ -113,64 +57,4 @@ Working example with additional configuration options to show HUD along bottom, }, ``` -### nvim-treesitter-sexp - -Treesitter based structural editing with normal mode key mappings, which can be set to false to disable. Two commands are disabled in the example. - -Additional which-key keymaps can be included for greater discoverability. Example includes keymaps inspired by Spacemacs Lisp mode, `SPC k`. - -```lua - { import = "astrocommunity.pack.clojure" }, - { - "PaterJason/nvim-treesitter-sexp", - dependencies = { - "AstroNvim/astrocore", - opts = { - -- configuration & keymaps overrides: - -- https://github.com/PaterJason/nvim-treesitter-sexp#configuration - -- enabled = false, -- Set to false to disable individual keymaps - -- set_cursor = true, - -- keymaps = { -- (1)! - -- Default key bindings - set to false to disable - -- commands = { - -- promote_elem = false, - -- promote_form = false, - -- }, - -- motions = { - -- }, - -- textobjects = { - -- }, - -- }, - options = { - g = {}, - }, - mappings = { -- (2)! - n = { - -- Additional Which-key key bindings for nvim-treesitter-sexp - ["k"] = { name = "Structural Editing" }, - ["kE"] = { "TSSexp swap_prev_elem", desc = "Swap Previous Element" }, - ["ke"] = { "TSSexp swap_next_elem", desc = "Swap Previous Element" }, - ["kF"] = { "TSSexp swap_prev_form", desc = "Swap Previous Form" }, - ["kf"] = { "TSSexp swap_next_form", desc = "Swap Previous Form" }, - ["kk"] = { "TSSexp promote_elem", desc = "Promote Element" }, - ["kr"] = { "TSSexp promote_form", desc = "Promote Form" }, - ["k@"] = { "TSSexp splice", desc = "Splice" }, - ["kS"] = { "TSSexp slurp_left", desc = "Slurp Left" }, - ["ks"] = { "TSSexp slurp_right", desc = "Slurp Right" }, - ["kB"] = { "TSSexp barf_left", desc = "Barf Left" }, - ["kb"] = { "TSSexp barf_right", desc = "Barf Right" }, - ["kI"] = { "TSSexp barf_right", desc = "Insert Head" }, - ["ki"] = { "TSSexp barf_right", desc = "Insert Tail" }, - }, - t = { - -- terminal? mode key bindings - }, - v = { - -- visual mode key bindings - }, - }, - }, - }, - }, - -``` +> NOTE: `:help conjure-client-clojure-nrepl` for full list of Conjure options for Clojure.