Best solution for this is recording a macro on Sublime Text and then assigning it to a keyboard shortcut. Follow these steps:
- Create a line such as alert(‘hello’) and leave the cursor right
after letter ‘o’. - Then go to Tools > Record a Macro to start recording.
- Press Command+→ to go to the end of line.
- Press ; and hit Enter
- Stop recording the macro by going to Tools > Stop Recording Macro
- You can now test your macro by Tools > Playback Macro (optional)
- Save your macro by going to Tools > Save Macro (ex: EndOfLine.sublime-macro)
-
Create a shortcut by adding this between the square brackets in your
in your Preferences > Key Bindings – User file:{ "keys": ["super+;"], "command": "run_macro_file", "args": {"file": "Packages/User/EndOfLine.sublime-macro"} }
- Now, every time you hit Command+;, it will
magically place the semicolon at the end of current line and move the cursor to the next line.
Happy coding!