Vim is almost perfect for me. But I still want a line comment and block comment feature, I want to know how to write a vimrc to do this in python and javascript.
No Addons
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want c-style line comments (which I believe are legal in javascript), you can set the following in your .vimrc, which will comment out the line the cursor (in normal mode) is currently on.
If you want python comments, you can do the following:
If you want to only have one statement, you could do:
which will use the # comment if you are editing a .py file, and otherwise use the /* … */ comment.
EDIT: the following function will comment out a visually selected block with the appropriate style comments by checking the filetype. You can then map it to something easy like the vmap statement following the function.
Ignore the wacky syntax highlighting. It appears that the syntax highlighter is not vimscript-aware.