vim

weavejester 2025-12-11T15:31:50.324959Z

What's the best way to tell Vim (well, Neovim) that a certain form should be indented like a macro? (I believe I'm using clojure.vim, though I can't determine where it's installed.)

2025-12-11T16:04:19.788249Z

what does "like a macro" mean?

weavejester 2025-12-11T16:29:13.455729Z

A constant 2-space indent, for example:

(let [x 1]
  (+ x 1))   ;; 2 space indent

2025-12-11T16:34:44.610169Z

on master, you can use g:clojure_special_indent_words : https://github.com/clojure-vim/clojure.vim?tab=readme-ov-file#gclojure_special_indent_words

2025-12-11T16:37:17.435469Z

if you're on the "rewrite indention code" branch (https://github.com/clojure-vim/clojure.vim/pull/31), you can use g:clojure_indent_rules (there's no docs for it yet, you gotta read the code vimscript lol)

2025-12-11T16:38:35.346689Z

on master, you can also use lispwords i think

weavejester 2025-12-11T16:41:04.177409Z

I'm currently using lispwords applied only to Clojure files, but the implementation feels rather clunky, so I was wondering if there's a more optimal "recommended" way of doing it.

2025-12-11T17:02:02.647569Z

no. you could connect to clojure-lsp and use its formatting functionality, which i think allows for selecting a single form (not just a whole file)

dominicm 2025-12-12T13:22:38.234849Z

Lsp works with gq, yep

dominicm 2025-12-12T13:22:52.773739Z

Why does lisp words feel clunky

weavejester 2025-12-12T15:23:48.260219Z

So currently I have an autocmd that adds to the local lispwords when Clojure is being used:

(vim.api.nvim_create_autocmd
  ["FileType"]
  {:pattern "clojure"
   :callback (fn []
               (vim.opt_local.lispwords:append
                 ["register-effect!"
                  "register-action!"
                  "register-placeholder!"]))})
(I'm using Fennel for the configuration.) This feels a little inelegant to me.

dominicm 2025-12-12T15:24:12.482819Z

Oh I think you're looking for ftplugin!

dominicm 2025-12-12T15:25:45.726939Z

I'd probably just use vimscript for this because I'm weird like that: ftplugin/clojure.vim Would contain: setlocal lispwords+=register-effect!,register-action!

➕ 1
weavejester 2025-12-12T15:26:44.190639Z

I think using Fennel is by far the weirder choice! Thanks for the hint, I'll look into ftplugin.

dominicm 2025-12-12T15:30:50.340089Z

I think ftplugin/*.lua is sourced now, but I won't swear to it.

dominicm 2025-12-12T15:30:54.819189Z

https://github.com/neovim/neovim/issues/12670 looking positive

practicalli-johnny 2025-12-13T00:27:24.276849Z

I use lua with after/ftplugin/clojure.lua and it works very nicely (although not for formating but settingnkey mallings) https://github.com/practicalli/nvim-astro5/blob/main/after%2Fftplugin%2Fclojure.lua