Fork me on GitHub

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.)


I have this in my vimrc:

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


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


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")


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


I believe it's already supported in conjure


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


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.


I got a very nice code example in the #vim channel Thanks for taking a look and suggesting ideas (this was a very tricky one to figure out myself)

🙌 1