The tcomment vim plugin

In this video of the tcomment vim plugin we demonstrate the gc operator and automatic recognition of filetypes.

In a HTML paragraph, we type gcip (that is gc + ip for "inner paragraph" to comment this paragraph out (and then again to uncomment it). Since this paragraph contains HTML syntax, tcomment recognizes it as HTML and uses the appropriate markup.

We then use <c-_>b to comment the visually selected paragraph as block.

We try the same with PHP code.


  1. May I ask what keys exactly I have to press for the combination < c - _ > b?
    I think I'm a slightly experienced Vim user, but I've never seen this combination nor does the Vim help file or Google know anything about it.

    1. This comment has been removed by the author.

    2. To get an answer to this enter

      :help <>

  2. Basically means pressing the control and the "_"-key. Unfortunately, for different operating systems, GUIs, and different keyboards layouts this requires pressing different keys.

    If you cannot find out which combination is , I'd suggest to change the default tcomment map leader (the default is '') by setting the variable g:tcommentMapLeader1 in your vimrc file.


  3. Can't toggle comments:

    <!--       <xmlnode value="true" />           -->

  4. @coresh: If the filetype is set to xml, the above example works perfectly well. What happens if you press gcc?

  5. Regarding to above, seems to be a local/temporary issue. Fixed by: restarting vim.
    After un-commenting source code in example of above, unnecessary spaces located after tag "/>...........$"

  6. PS: unnecessary trailing white space, which is usually deleted by command: ":%s/\s\+$//"

  7. Using the code example here : https://gist.github.com/1506036

    I experience a bug which duplicate '\' each time I toogle Comment.

    I place the cursor on the desired line select visually the line then I type :TComment

    and my line which previously was printf("toto%d\n"); becomes printf("toto%d\\\\\n");

  8. @totouser That was a problem of an older version of the plugin that should have been fixed in version 1.03. If the problem persists with the current version, please file a bug report at https://github.com/tomtom/tcomment_vim/issues

  9. Thanks I was using an another repository on Github it's fixed now. And will use github Issues for my next problem.