I am trying to use EnhancedCommentify plugin for vim and mostly using C. However I can't figure out the issue but when I comment/uncomment it uses (* ---- \*) instead of /* ----- \*/. I tried to change the plugin itself, it didn't change anything. I also verified wit :set filetype? that vim recognizes the C code, and it does. I even looked for the languages that use (* *) for comment and simply removed the lines from the plugin : issue is still there !

It works fine for fortran, python and .vimrc however...

I am kinda puzzled at this, anyone has any idea ?

Also, the plugin did output an error when first using it :

Erreur détectée en traitant /home/jacques/.vim/plugin/EnhancedCommentify-2.3/ftplugin/php_enhcomm.vim :
ligne    6 :
E117: Fonction inconnue : EnhCommentifyFallback4Embedded

I opened the file and commented the line as i seemed to me it's only relevant for php, but maybe I am wrong...

On another note, I am also trying to remap the smart comment but it seems that I fail, here is the vimrc for now

vmap <unique> <C-c> <Plug>VisualComment
nmap <unique> <C-c> <Plug>Comment
imap <unique> <C-c> <ESC><Plug>Comment
vmap <unique> <F3> <Plug>VisualDeComment
nmap <unique> <F3> <Plug>DeComment
imap <unique> <F3> <ESC><Plug>DeComment

and i tried with "Guess" instead of "Comment" but it didn't seem to work. I remember doing this a long time ago but can't find my .vimrc from back then...

vmap VisualComment nmap Comment imap Comment vmap VisualDeComment nmap DeComment imap DeComment

  • Hi @Jacques did you try the answers? Did one solved your problem? If so maybe could you validate the corresponding solutio using the v button next to the voting buttons? Feb 18, 2023 at 12:37

1 Answer 1


I cannot answer directly your answer, cannot add a comment, but I'll still answer.

It seems like EnhancedCommentify have not beed updated for 6 years now. I suggest you try another plugin. I personnally use NerdCommenter and love it. You can find other such plugins on Vim Awesome.


Actually NerdCommenter was my very first comment plugin but I rapidly switched to Commentary, the gc mappings sticks very fine in muscle memory. Can't tell why I messed-up.

@Jacques, Commentary has the :Commentary command, so for insert-mode mapping, use

inoremap <C-c> <C-o>:Commentary<cr>

Now, for "unsupported" file formats, from :h commentary we can tell that it

Relies on 'commentstring' to be correctly set, or uses b:commentary_format if it is set.

So you can set the commentstring option for any filetype and it will work. See :h 'commentstring'. For example to add for python :

autocmd! BufNewFile,BufRead *.py setlocal commentstring=#\ %s


  1. The python 'commentstring' is already set in default ftplugin/python.vim. It is just an example.
  2. This "answer" is off-topic regarding your initial question.
  • 3
    tpope’s commentary is also good.
    – D. Ben Knoble
    Jul 8, 2019 at 20:36
  • ok i'll try those, thanks for your help !
    – jacques
    Jul 8, 2019 at 21:13
  • could you help me configure tpope's commentary ? I am kinda lost trying to fine tune it, to change the gc / gcc trigger to Ctrl-C and allow it to work on insert mode !
    – Jacques
    Jul 9, 2019 at 9:11
  • well I kinda prefered enhancedcommentify coimpared to those two. It allows for insert mode commentary too, and also supports many more files (which i couldn't find how to add for tpope). I guess i'll try and make it work again...
    – Jacques
    Jul 11, 2019 at 8:14
  • 1
    Commentary mappings are made in a vim way, which is usual with tpope's plugins. I understand you'd like to keep with your habits, but I think you should reconsider. gcap and gciB are so powerful (and only a few keystrokes). You'd do daB to delete a block, vip to select a paragraph: that's what these mappings are vim like. Besides, <c-o> opens any normal mapping to insert mode.
    – Biggybi
    May 4, 2020 at 23:17

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.