2

So I decided I should learn how to comment and uncomment code in a fancy way. So I tried vim plugin tcomment. I googled that I needed to open the vba file I downloaded with vim and type

:source %

I google around but I am still not sure how to run the plugin. What do I type in in normal mode to toggle comments? Just simple one line comments. I cannot figure it out. I am convinced I installed the plugin right, but how can I make sure?

Community
  • 1
  • 1
sup
  • 680
  • 1
  • 6
  • 17
  • 1
    I would recommend looking at pathogen or vundle for installing vim plugins. Vimball is an outdated method (although it works uninstalling is a bigger hassle). But to check if it is installed you can run `:scriptnames`. You should see a line that ends in `tcomment.vim` somewhere. – FDinoff Jul 31 '14 at 14:34
  • Thanks, vundle seems to work nice (even though I am not sure why I have to manually edit .vimrc file to install plugin, it would be nice if it were automated too). – sup Aug 02 '14 at 12:49
  • If you use pathogen to install plugins then you don't have to modify your vimrc everytime you install a plugin. You just have to put them in the bundle directory and you're done. – Zach Aug 02 '14 at 13:44
  • Hm, but I need to do it with vundle, as per this: https://www.digitalocean.com/community/tutorials/how-to-use-vundle-to-manage-vim-plugins-on-a-linux-vps no? (Well, if I want it to auto-load, which is generally the case, I guess) – sup Aug 02 '14 at 13:48
  • @sup how were you able to install tcomment with pathogen? I tried cloning the repo into ~/.vim/bundle and restarting vim: no dice. – webdevguy Dec 16 '14 at 14:35
  • @webdevguy I used vundle and that worked (I do not remember how at all), I cannot help you with pathogen, sorry. – sup Dec 16 '14 at 17:58

1 Answers1

4

To make sure you have installed the plugin you can run :scriptnames. This will list all enabled plugins and scripts (you are looking for tcomment.vim).

The commands for tComment are the following:

gc{motion}   :: Toggle comments (for small comments within one line 
                the &filetype_inline style will be used, if 
                defined)
gcc          :: Toggle comment for the current line
gC{motion}   :: Comment region
gCc          :: Comment the current line

More info here

And the full documentation is here

Zach
  • 4,652
  • 18
  • 22
  • Ok, thanks, so the problem was tha tcomment somehow was not installed. Now it is installed and I just need to type "gcc" to toggle comments. – sup Aug 02 '14 at 12:48