Vim has the option to automatically continue comments when a new line is entered as described here. This currently works perfectly for // and # in .cpp and .python files respectively.

I tried to add the following line to the .vimrc for lisp

autocmd filetype lisp,clojure setlocal comments+=:;;

I also tried to set it manually in a file via :set comments=:;;. All to no avail.

I have checked that vim is compiled with the comments flag set.

1 Answer 1


Check your filetype:

:set filetype?

It should show


If it is empty, then auto-comments would not work.

Same applies to

:set formatoptions?

The should look like


and not be empty.

  • The important part was the l in formatoptions. Thanks.
    – rex123
    Commented Sep 21, 2018 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.