I'm not sure if this is possible, but I am interested in making this happen.
Ideally, I would like to map this function to SHIFT + CTRL + 3 .
I am looking for a way to get Vim to enter a comment (single line) that matches the syntax of the file I'm editing. If there are several one-line comment styles, Vim can either automatically select one or give me a choice. If a single-line comment has two parts (for example, /* and */ ), then pressing SHIFT + CTRL + 3 for the first time will start the comment, and the second time will close the comment.
Examples:
- Python:
# - JavaScript:
// - C, C ++:
/* c */ or //
I know that there are scripts that will insert comments for you, but I have not seen those that will do this based on the file syntax.
syntax comments vim autocomplete
Nick presta
source share