Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I enter the command :fold inside my python code in .py files, Vim inserts the /*{{{*/ and /*}}}*/ tags. They, of course, cannot be parsed by python interpreter.

When I'm in python I would like something like #{{{

Do you know how I could do that ? Of course, keeping the /*{{{*/ for my C/C++ files.

share|improve this question
What is commentstring set to? For Python :set commentstring=#%s is reasonable, I guess. – Marco Mar 27 '13 at 16:50
how do I reset it for python only ? – Stephane Rolland Mar 27 '13 at 17:18
up vote 2 down vote accepted

The string used is determined by the variable commentstring. To set it to a different value you can use an autocommand:

augroup ft_python
  au FileType python setlocal commentstring=#%s
augroup END
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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