tomtom / tcomment_vim

An extensible & universal comment vim-plugin that also handles embedded filetypes

Home Page:http://www.vim.org/scripts/script.php?script_id=1173

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When do the comment definitions for strange filetype take effect?

ckyoog opened this issue · comments

Hi @tomtom

This issue is actually a question. It might not be good to ask question here, but I really can't find a better way to contact you. I will be very glad to move it to better place if you like.

I am reading your code lately. The tcomment is really good. I compared it to other similar commentary plugins. Yours works just perfect, I like it so much. Thank you for your awesome work. Appreciate.

I also made some changes to fix some issues and meet my needs. I hope I will send you the pull request eventually when I make them perfect, like what you did.

And I also find some questions I can't get answer through the code.

Here is the one.
In source code file autoload/tcomment/types/default.vim, there are a series of custom comment definitions for different filetype. I found some strange filetypes, such as ruby_3, vim_3. For what kind of file will the Vim set filetype to ruby_3 or vim_3, i.e., for what kind of file, when I type gcc, the commentstring defined for vim_3, which is """ %s, will be used?

Another question is what the map gc{1-9}, gc{1-9}c and the like is used for. I found them in file plugin/tcomment.vim as follows,

for s:i in range(1, 9)
    exec 'nmap <silent> '. g:tcomment_opleader1 . s:i .' <Plug>TComment_gc'.s:i
    exec 'nmap <silent> '. g:tcomment_opleader1 . s:i .'c <Plug>TComment_gc'.s:i.'c'
endfor

ruby_3 can be accessed, e.g., via the <c-_>s map. These maps are a relict before tcomment handled count as intended. Today, they do the same as 3gcc (for ruby filetype).

The map mentioned below are supposed to be another take on that. I'm not sure if they currently work as intended, though. It could be that these are leftovers from an earlier version.

Thank you @tomtom for clearing up my confusion. And truly sorry for the la~~~~~~te response.