When selecting Preferences: Key Bindings in the Command Palette, you can search for enter
on the left side to see the default bindings. You will see this binding:
{ "keys": ["enter"], "command": "insert", "args": {"characters": "\n"} },
Now, the easy solution would be to just copy this to the user file on the right and replace \n
with \n\n
, but that will end up overriding various other bindings that use the enter key but are only active in certain contexts. What we need to do now is to negate the contexts’ conditions in our custom binding, since it would otherwise take priority and always be active.
As a result, put this on the right panel in your user keymap:
{ "keys": ["enter"], "command": "insert", "args": {"characters": "\n\n"}, "context": [
{ "key": "auto_complete_visible", "operand": false },
{ "key": "panel_has_focus", "operand": false },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "\\{$|>$" },
] },