Practicalli Neovim updates • added a page on http://localhost:7777/neovim/neovim-basics/notifications/ (nvim-notify) • updated https://practical.li/neovim/repl-driven-development/ (Conjure, parinfer, testing, refactor tools) Note that Practicalli configurations for Conjure hide the HUD log popup that is otherwise shown by default when Conjure connects to the REPL. Personally I find it easier to rely on in-line evaluation results and show the log in a separate tab page and mostly When using Conjure with larger evaluation results, I use nrepl middleware to automatically tap> all results to portal, which provides additional tools to visualise and navigate the code.
Tks, I'll see what tweaks I can do. Parinfer has been working fine for the most part. The problem is when I have to paste some code, then I have to align things myself and can't just rely on lsp formatting.
This exemplifies what I mean. I'd like to paste that map as the value for :give-me and just hit SPC l f
I have a binding for 'parinfer off - paste - lsp-format - parinfer on' which works pretty well
["p"] = {
function()
vim.cmd "ParinferOff" -- turns Parinfer off
vim.cmd 'normal! "+gP' -- pastes from clipboard
vim.lsp.buf.format() -- formats the code
vim.cmd "ParinferOn" -- turns Parinfer on
end,
desc = "Paste and format with Parinfer",
}, @luciolucio using the command :ParinferOff or :Parinfer toggle before pasting the code should keep the structure of the map. Saving the file will automatically format using the clojure LSP server and correct the indentation. (ah, that was essentially what Alex said 🙂 )
If the default behaviour is not preferred, then try setting parinfer to paren mode.
I added the following inside the return map in the plugins/community.lua file and this indents as you are expecting. I havent tried other scenarios yet...
{
"gpanders/nvim-parinfer",
ft = { "clojure" },
config = function()
vim.g.parinfer_force_balance = true
vim.g.parinfer_comment_chars = ";;"
vim.g.parinfer_mode = "paren"
end,
},Thanks guys. I've tried something like Alex's suggestion for now.
Is there a simple way to switch to paredit?
https://github.com/dundalek/parpar.nvim could be used to include both parinfer and paredit, although I remember having key binding issues when trying that with the Clojure pack I added to AstroCommunity. Either key bindings or something wasnt loading... I didnt spend time figuring that out yet. Or rather than use the AstroCommunity Clojure pack, add the conjure and paredit plugins via the user config, which again may require some wrangling of the key bindings. I found parinfer really easier to get working and get used to that I have not spent much time trying to get paredit to work. I would be interested in having a paredit config that works though... or even better a parpar config that works with AstroNvim.
small typo
,ls in horizontal split, ,ls in vertical tabshould be ,lv for vertical
ooops... copy paste strikes again facepalm ... publishing a fix...
I'm going to set aside some time to learn your portal setup, I always use ,lv to pop up a conjure buffer and its not ideal, but portal is such a faff to setup. if theres a way to inject the setup into the repl start then that sounds super handy
I use a custom user namespace to configure portal, which recieves all REPL evaluations using nREPL middleware (added via a Clojure CLI alias along with the library of course).
I also publish mulog logs into portal for the complete experience.
I have a dev/portal.clj file that starts up (only one instance) of portal and listens to all evals via the submit function, which is loaded from the dev/user.clj file as a require. The portal code could all be inside the dev/user.clj file but I separate out each tool config to make the user namespace easier to follow.
(ns portal
(:require
;; Data inspector
[portal.api :as inspect]))
;; ---------------------------------------------------------
;; Start Portal and capture all evaluation results
;; Open Portal window in browser with dark theme
;;
;; Portal options:
;; - light theme {:portal.colors/theme :portal.colors/solarized-light}
;; - dark theme {:portal.colors/theme :portal.colors/gruvbox}
(def instance
"Open portal window if no portal sessions have been created.
A portal session is created when opening a portal window"
(or (seq (inspect/sessions))
(inspect/open {:portal.colors/theme :portal.colors/gruvbox})))
;; Add portal as tapsource (add to clojure.core/tapset)
(add-tap #'portal.api/submit)
;; --------------------------------------------------------- Then I use an alias that includes the portal middleware and dev directory on the class path (as well as starting nrepl server with the cider extensions for cider or conjure)
This is a simplified version of the :repl/reloaded alias from Practicalli Clojure CLI Config
:repl/inspect
{:extra-paths ["dev" "test"]
:extra-deps {nrepl/nrepl {:mvn/version "1.0.0"}
cider/cider-nrepl {:mvn/version "0.37.0"}
djblue/portal {:mvn/version "0.46.0"} ; portal data inspector
clj-commons/clj-yaml {:mvn/version "1.0.27"}} ; portal yaml support (optional)}
:main-opts ["--main" "nrepl.cmdline"
"--middleware" "[cider.nrepl/cider-middleware,portal.nrepl/wrap-portal]"
"--interactive"]}
Then is clojure -M:repl/inspect to start the repl, nrepl server, portal, etcThis Portal (and mulog) code is generate when creating Clojure projects from https://practical.li/clojure/clojure-cli/projects/templates/practicalli/
Thanks! will also share with my team (who are slowly switching to vim + your config after they see me use it 😄 )
Actually while its on my mind, is there a way to jump to definition of a clojure library? I think this did work at some point (maybe when I was on emacs...) but now just gives an error when I try with gd
I also seem to get an error or it opens an empty file with the library short form name. It's not something I've done since neovim. If I find anything I'll share it. It seems to work for symbols defined within the project though, maybe something at the LSP client end is not using all of the data feature m the lsp server... But I am just guessing