Fork me on GitHub
#conjure
<
2022-06-22
>
practicalli-john16:06:47

How can I set the comment character for clojure to be ;; rather than ; , this is the clojure comment string which tpope/vim-comentary seems to be picking up? Which means it wont toggle any of my existing commented code that all uses ;; I’m using Neovim 0.7.0 and have a fennel configuration that includes Conjure It seems commentstring value needs to be set in the context of the Clojure FileType (while that makes sense, I havent found how to do it yet, at least nothing that works in the fennel config.)

dave16:06:51

I have this in my vimrc:

augroup commentary_config
  autocmd!
  autocmd FileType lisp,clojure,racket setlocal commentstring=;;\ %s
augroup END

dave16:06:17

I'm not sure how to do that in Fennel, but hopefully that's a good starting point!

practicalli-john16:06:20

Yes, a lua or fennel version of that should do the trick… I wonder if its something along the lines of this syntax

(nvim.ex.autocmd "FocusGained,BufEnter" "*" ":checktime")

practicalli-john17:06:34

Or maybe something like this in lua (although I think I’ll make sure everything is backed up before trying this…)

vim.api.nvim_create_autocmd("FileType", {
    group = "clojure,lisp,fennel,racket",
    command = "setlocal commentstring=;; ",
})
Nope, that gives an invalid augroup

dharrigan18:06:32

I believe it's already supported in conjure

dharrigan18:06:34

let g:conjure#eval#comment_prefix = ";; "

practicalli-john19:06:57

If I understand correctly that is the prefix used when specifically evaluating an expression to a comment. That setting will over-ride what is set for the FileType but I got the impression it doesnt change the commentstring for the actual FileType (i.e. clojure). I’ll give the config a try though, as I found an example of how to add that to the fennel configuration.

practicalli-john20:06:32

I got a very nice code example in the #vim channel https://clojurians.slack.com/archives/C0DF8R51A/p1655927529563829 Thanks for taking a look and suggesting ideas (this was a very tricky one to figure out myself)

🙌 1