conjure 2026-09-28

Sometimes I write a map e.g.,

{:term (:term m)
 :soc foo
 :definition 123}
and realize the keys are not sorted in the code, which annoys me. Is there a (neo)vim/conjure way to select this and sort it? using the editor's native sorting breaks the code because vim doesn't care about curly brackets etc

if you're using clojure-lsp, there's a code action to sort maps

this sounds like what I want and I already have clojure-lsp running, but I used the default settings. Is it possible to send these commands to the server directly? I'm not finding that info 🤔

like you would do with native sort :'<,'>sort

do you have a way to trigger "code action at cursor"?

you can't see my keystrokes, but i put the cursor in normal mode over the unsorted map, type in g r a , type 4 to choose "sort map", then press enter to select it, and lsp applies the change directly

"no results found for lsp_references" I'll look up what is missing, thanks for the pointers!

lemme know if you wanna do a huddle, i can share my screen and walk you through what i did or help you debug

thanks for the offer! need to be quiet, kids not asleep yet 😄 I think I'm missing something in neovim's config, because I don't have those global keystrokes gra ? I mean gr immediately fails with lsp_references and does not let me type a (`gr` works as expected when over a function call: it jumps to the definition)

how does your lsp config look like?

hmm which version of neovim are you on?

and which lsp provider do you use? i just nvim-lspconfig for other stuff and manually turn on clojure-lsp

(vim.lsp.config
  :clojure-lsp
  {:cmd ["clojure-lsp"]
   :filetypes ["clojure"]
   :root_markers ["project.clj" "deps.edn" "build.boot" "shadow-cljs.edn" "bb.edn"]
   :init_options {:log-path "/tmp/clojure-lsp.out"}
   :trace "verbose"})

(vim.lsp.enable :clojure-lsp)

i use fennel (through olical/nfnl) but it's roughly the same in lua

what's your error message look like?

you can use :checkhealth vim.lsp to see what's happening too

I got it. A snacks.nvim config was overriding the gr keymap. I removed that and now gra works and shows me the code actions. I've been missing a lot from LSP 🥲

😍 1

thanks Noah!

:sort worked for me in the given example if I put a new line after the first open curly { bracket and highlighted the rest of the lines. But clojure-lsp should be good for more interesting maps laughcry

In Practicalli nvim-astro which uses snacks.nvim (and AstroNvim) its either g r a 7 or SPC l a 7 to sort maps with Clojure LSP.

I do this normally, in maps...

how come the final curly bracket did not end up on line 2?

<shrug> Just the way that the sort works for me

{;;
 :term (:term m)
 :soc foo
 :definition 123}

then it can sort

{;;
 :definition 123
 :soc foo
 :term (:term m)}

by selecting from :definition downwards...

Once sorted, I remove the ;;