Eric Luo wrote:
I want to comment a new line or comment an existing line at the end of
the current line. In Emacs, I have M-; to do the job.

Could anyone tell me that weather the similar functionality existed?


A line starting with (zero or more whitespace and) a double quote is, in a Vim script, a comment.

A comment can also be added after most (but not all) commands by adding a double quote and text on the same line. The problem is that some commands will regard the double quote and what follows it as part of their arguments. In that case you can either move the comment to another line, or wrap the command in an ":execute" statement followed by a bar and the comment:

   " This is a comment
   set nobackup writebackup " Here we set the backup options
exe "! ls" | " here is how to add a comment on the line of an external command

See
   :help :quote
   :help :bar
   :help :execute


Best regards,
Tony.

Reply via email to