{"id":13419944,"url":"https://github.com/tomtom/tcomment_vim","last_synced_at":"2025-05-15T16:03:01.618Z","repository":{"id":1015400,"uuid":"841033","full_name":"tomtom/tcomment_vim","owner":"tomtom","description":"An extensible \u0026 universal comment vim-plugin that also handles embedded filetypes","archived":false,"fork":false,"pushed_at":"2024-03-25T10:36:44.000Z","size":780,"stargazers_count":1404,"open_issues_count":40,"forks_count":103,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-07T20:12:06.233Z","etag":null,"topics":["vim","vim-plugin"],"latest_commit_sha":null,"homepage":"http://www.vim.org/scripts/script.php?script_id=1173","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomtom.png","metadata":{"files":{"readme":"README","changelog":"CHANGES.TXT","contributing":null,"funding":null,"license":"LICENSE.TXT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-08-16T13:15:34.000Z","updated_at":"2025-04-07T00:43:55.000Z","dependencies_parsed_at":"2024-01-06T23:57:10.411Z","dependency_job_id":"d7319cb6-34d0-4bdd-a160-331d2a26f16e","html_url":"https://github.com/tomtom/tcomment_vim","commit_stats":{"total_commits":465,"total_committers":77,"mean_commits":6.038961038961039,"dds":"0.25161290322580643","last_synced_commit":"b4930f9da28647e5417d462c341013f88184be7e"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom%2Ftcomment_vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom%2Ftcomment_vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom%2Ftcomment_vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom%2Ftcomment_vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomtom","download_url":"https://codeload.github.com/tomtom/tcomment_vim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374398,"owners_count":22060609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["vim","vim-plugin"],"created_at":"2024-07-30T22:01:23.264Z","updated_at":"2025-05-15T16:03:01.600Z","avatar_url":"https://github.com/tomtom.png","language":"Vim Script","readme":"tcomment provides easy to use, file-type sensible comments for Vim. It \ncan handle embedded syntax.\n\nTComment works like a toggle, i.e., it will comment out text that \ncontains uncommented lines, and it will remove comment markup for \nalready commented text (i.e. text that contains no uncommented lines).\n\nIf the file-type is properly defined, TComment will figure out which \ncomment string to use. Otherwise you use |tcomment#type#Define()| to \noverride the default choice.\n\nTComment can properly handle an embedded syntax, e.g., ruby/python/perl \nregions in vim scripts, HTML or JavaScript in php code etc.\n\ntcomment favours the use of line-wise comment styles. This implies that usually \nwhole line will be commented out. tcomment also knows block-style and inline \ncomments that can be used via special maps (see below) or the |:TCommentAs| \ncommand.\n\nDemo:\nhttp://vimsomnia.blogspot.com/2010/11/tcomment-vim-plugin.html\n\n\n                                                    *tcomment-maps*\nKey bindings~\n\nMost of the time the default toggle keys will do what you want (or to be \nmore precise: what I think you want it to do ;-).\n\n                                                    *tcomment-operator*\nAs operator (the prefix can be customized via |g:tcomment_opleader1|):\n\n    gc{motion}   :: Toggle comments (for small comments within one line \n                    the \u0026filetype_inline style will be used, if \n                    defined)\n    gc\u003cCount\u003ec{motion} :: Toggle comment with count argument \n                    (see |tcomment#Comment()|)\n    gcc          :: Toggle comment for the current line\n\nForce line-wise operation:\n    gC{motion}   :: Toggle comments by line\n    gC\u003cCount\u003ec{motion} :: Toggle comment by line with count argument \n                    (see |tcomment#Comment()|)\n\nExplicit commenting/uncommenting:\n\n    g\u003c{motion}   :: Uncomment region\n    g\u003cc          :: Uncomment the current line\n    g\u003cb          :: Uncomment the current region as block\n\n    g\u003e{motion}   :: Comment region\n    g\u003ec          :: Comment the current line\n    g\u003eb          :: Comment the current region as block\n\nIn visual mode:\n\n    gc           :: Toggle comments\n    g\u003e           :: Comment selected text\n\nCAVEAT: If you visually select text within a line, the visual mode map will \ncomment out the selected text. If you selected text across several lines, the \nvisual mode map will assume though that you wanted to comment out lines -- \nsince this is how many vim maps work. In order to make tcomment use e.g. inline \ncomments anyway, use the \u003cc-_\u003ei map -- see below.\n\nBy default the cursor stays put. If you want the cursor to the end of \nthe commented text, set |g:tcomment#operator#mode_extra| to '\u003e' (but this may not \nwork properly with exclusive motions).\n\nPrimary key maps for normal and insert mode (see also |g:tcomment_mapleader1|):\n\n    \u003cc-_\u003e\u003cc-_\u003e   :: :TComment\n    \u003cc-_\u003e\u003cspace\u003e :: :TComment \u003cQUERY COMMENT-BEGIN ?COMMENT-END\u003e\n    \u003cc-_\u003eb       :: :TCommentBlock\n                    In insert mode, the cursor will be positioned inside \n                    the comment. In normal mode, the cursor will stay \n                    put.\n    \u003cc-_\u003ea       :: :TCommentAs \u003cQUERY COMMENT TYPE\u003e\n    \u003cc-_\u003en       :: :TCommentAs \u0026filetype \u003cQUERY COUNT\u003e\n    \u003cc-_\u003es       :: :TCommentAs \u0026filetype_\u003cQUERY COMMENT SUBTYPE\u003e\n    \u003cc-_\u003ei       :: :TCommentInline (in normal and insert mode, this map will \n                    create an empty inline comment, which isn't suitable for \n                    all filetypes though)\n                    In insert mode, the cursor will be positioned inside \n                    the comment. In normal mode, the cursor will stay \n                    put.\n    \u003cc-_\u003er       :: :TCommentRight\n    \u003cc-_\u003ep       :: Comment the current inner paragraph\n    \u003cc-_\u003e\u003cCount\u003e :: Set the count argument (a number from 1 to 9) for use with \n                    the subsequent tcomment map/command (see \n                    |tcomment#Comment()|)\n                    E.g. in JavaScript, in order to get an empty /** */ \n                    comment for documentation purposes, in insert mode type \n                    \u003cc-_\u003e2\u003cc-_\u003ei\n                    In order to get an empty block comment like \u003e\n                      /**\n                       *\n                       */\n\u003c                   type \u003cc-_\u003e2\u003cc-_\u003eb\n\nMost of the above maps are also available in visual mode.\n\nA secondary set of key maps is defined for normal and insert mode (see also \n|g:tcomment_mapleader2|):\n\n    \u003cLeader\u003e__       :: :TComment\n    \u003cLeader\u003e_p       :: Comment the current inner paragraph\n    \u003cLeader\u003e_\u003cspace\u003e :: :TComment \u003cQUERY COMMENT-BEGIN ?COMMENT-END\u003e\n    \u003cLeader\u003e_i       :: :TCommentInline\n    \u003cLeader\u003e_r       :: :TCommentRight\n    \u003cLeader\u003e_b       :: :TCommentBlock\n    \u003cLeader\u003e_a       :: :TCommentAs \u003cQUERY COMMENT TYPE\u003e\n    \u003cLeader\u003e_n       :: :TCommentAs \u0026filetype \u003cQUERY COUNT\u003e\n    \u003cLeader\u003e_s       :: :TCommentAs \u0026filetype_\u003cQUERY COMMENT SUBTYPE\u003e\n\n... and for select mode:\n\n    \u003cLeader\u003e__       :: :TComment\n    \u003cLeader\u003e_i       :: :TCommentInline\n\n\n\n-----------------------------------------------------------------------\n                            *tcomment-new-filetype* *tcomment-debug*\nAdding a new filetype~\n\nIf tcomment doesn't know a filetype, it makes use of 'commentstring' or \n'comments'. If the result still does not satisfy your needs, you might have to \nadd a custom filetype definition. This could be done in a file like \n`autoload/tcomment/types/mytypes.vim` somewhere in your 'runtimepath', which \nwill be loaded on startup.\n\nNew comment types can be defined via the |tcomment#type#Define()| function. If \nthe file may contain embedded code of another filetype, you might also want to \nset `g:tcomment#filetype#guess_{FILETYPE}` to 1 or the name of a default \nfallback filetype.\n\nIf nothing helps:\n\n1. Make sure 'filetype' is set correctly.\n2. Place the cursor at an appropriate position -- e.g. the first non-blank \n   character of a line of code.\n3. Call |tcomment#debug#CollectInfo()|.\n4. File an issue on github and post the output of `:call \n   tcomment#debug#CollectInfo()`. The output will also be copied to the \n   clipboard.\n\nIf this still doesn't help, please install tlib \n(https://github.com/tomtom/tlib_vim), please try:\n\n    Tlibtraceset --file=tcomment.log +tcomment\n\nThen comment out the text in question and send me the log file.\n\n\n-----------------------------------------------------------------------\nInstall~\n\nEither use the zip archive:\n\n- Download the zip archive\n- Extract it to `~/.vim/pack/tml/start/tcomment`\n\nor install from github:\n\n- Start a terminal\n- Change the working directory to `~/.vim/pack/tml/start/`\n- Type: `git clone https://github.com/tomtom/tcomment_vim`\n\nNOTE: If you don't want to run this plugin on startup, use \n`~/.vim/pack/tml/opt/`.\n\nNOTE: On Windows, ~/.vim might be ~/vimfiles. Please see 'runtimepath' for \ndetails.\n\n\n\n\n\nLicense: GPLv3 or later\n\n\n","funding_links":[],"categories":["Vim Script","Tools","Plugins / Themes / Dependencies"],"sub_categories":["Editing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomtom%2Ftcomment_vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomtom%2Ftcomment_vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomtom%2Ftcomment_vim/lists"}