In Sublime I could easily set a more complex hotkey that lets me exit quotes and parenthesis by pressing Enter. It is here below:
// Move out of single and double quotes with `Enter`
{
"keys": ["enter"],
"command": "move",
"args": {"by": "characters", "forward": true},
"context": [
{ "key": "following_text", "operator": "regex_match", "operand": "(?:\"|').*", "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "(?:\"|')", "match_all": true }
]
},
In VS Code, is there any way to achieve this? This in keybindings.json
moves the cursor, but it is active when I don't want too. Thanks.
{ "key": "enter", "command": "cursorRight",
"when": "editorTextFocus" }
In VS Code, you can type the closing quote (i.e. if using double quotes)
{shift+'}
while you are INSIDE the quotes to have it exit outside the closing quote. This also works for parenthesis and brackets, just type the closing one (i.e. ) or ]). You can also jump straight to a new line by pressing
{ctrl+enter}
which exits out of any brackets, parenthesis, quotes you are already in. These 2 methods here should be embedded in standard VS Code AFAIK.
Check out this extension which does what you want - https://marketplace.visualstudio.com/items?itemName=albert.TabOut
And you can find the implementation here - https://github.com/albertromkes/tabout
I found Ctrl+Shift+\
useful for moving out of quotes. Also, it could be remapped by searching jumpToBracket
in Keyboard Shortcuts.
See full VSCode keyboard binding here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With