vim and Python comments
I'm currently undergoing a profound revision (read "cleanup") of my .vimrc
and I recently had to choose a decent plug-in to comment python code.
The best so far is EnhancedCommentify. It's highly configurable, powerful and it supports a different number of languages (not only python).
The only one thing that wasn't easy to setup if the behaviour described here: being able to comment a block, respecting the indent, in both visual and normal mode.
A clean solution, without the need to define any function is to stick these lines into your .vimrc
:
let g:EnhCommentifyPretty='Yes' let g:EnhCommentifyRespectIndent='Yes' let g:EnhCommentifyUserBindings="Yes" let g:EnhCommentifyUseBlockIndent='Yes' vmap ,c (Plug)VisualComment vmap ,d (Plug)VisualDeComment vmap ,g (Plug)VisualTraditional vmap ,f (Plug)VisualFirstLine nmap ,c (Plug)Comment nmap ,d (Plug)DeComment nmap ,g (Plug)Traditional nmap ,f (Plug)FirstLine
(but remember to change "(" to "<" and ")" to ">" – Wordpress is strict about "<" and ">"…)
Enjoy!