Easily comment (C++) code in vim

后端 未结 4 2062
旧时难觅i
旧时难觅i 2021-02-13 12:52

I have looked at the following question:

How to comment out a block of Python code in Vim

But that does not seem to work for me. How do I comment code easily wit

4条回答
  •  既然无缘
    2021-02-13 13:10

    Use ctrl-V to do a block selection and then hit I followed by //[ESC].

    Alternatively, use shift-V to do a line-based select and then type :s:^://[Enter]. The latter part could easily go into a mapping. eg:

    :vmap // :s:^://
    

    Then you just shift-V, select the range, and type // (or whatever you bind it to).

提交回复
热议问题