geddski / macros

macros support for VS Code
MIT License
166 stars 36 forks source link

Simulate Enter keypress #15

Closed ghost closed 7 years ago

ghost commented 7 years ago

General usability question. I am attempting the following, but I can't seem to get the macro to execute the "enter" key. There's no key bindings that describe the "enter" action in keybindings.json (such as CR + LF) nor can I find it in vscode docs. Any ideas on how I might achieve it?

"macros": { "temp": [ "enter", "cursorEnd", "deleteWordRight", "cursorEnd", "cursorLeft" ] The macro is to be used to move commas from the end of a line to the start of the next. Cursor starts before the comma to be moved and (generally) will end before the next one.

osdavison commented 7 years ago

To add a new line you can use the type command and pass \n as the text to enter. Just put the following code in place of "enter" in your current code

{"command": "type", "args": {"text": "\n"}}