Sublime Forum

Sublime-keymap--user

#1

Hello,
I would like to create a new keymap as follow : :
crtl+alt+c that will give the result as "/--------------------------------------\

                                                 \*---------------------------------------*/"

This is a comment lines block.
Could you help me to code it in sublime-keymap–user on windows ?
Best regards

0 Likes

#2

use snippet

0 Likes

#3

This key binding is an example of inserting text in response to a key press. Modify the contents as needed to get the text you want. Note that some characters need to be quoted with a \ character because they’re special. If you want to insert a " or \ character in particular, you would need to use \" or \\ instead.

    { 
        "keys": ["ctrl+alt+c"],
        "command": "insert_snippet",
        "args": {
            "contents": "/*--------------------------------------*\\"
        }
    },
0 Likes

#4

Thanks, but what i want is exactly for the first line, and i want also a blank line and a third as :
“------------------------------------------------/”.
I am new in sublime, so could you help me to finish this key binding.
Best regards

0 Likes

#5

Adding in \n will insert a newline, so doing that twice would at the end would make it insert a blank line. Then just add the text you have there after both of them so it gets inserted after the blank line.

0 Likes