Self-closing parentheses in text editors can be annoying - how to deal with them?
I am starting to find parentheses / square bracket autocompletion annoying. The cursor remains inside the braces, and I have to reach the right arrow with my right pinky to get out of the bracket and continue typing.
On the other hand, I recognize that it saves time by not having to close it myself.
Is there any common feature in IDEs that would allow me to keep the best of both words, ie, keep the autocompletion, while having a quicker shortcut to jump out of them than the right arrow?
I'm currently using VS Code with Vim mode, but I'd also be interested in hearing general solutions from other text editors / IDEs.
Solution 1:
In VS Code with vim mode, you can choose between following options
- Esc to normal mode and use the right arrow as you are doing (or the vim way: L)
- Esc to normal mode and use A (append to end of line)
- Stay in insert mode and type the closing delimiter. VS Code automatically jumps past the delimiter it started with autocomplete and you can just continue typing.
Solution 2:
The idea of auto-close functionality is that it saves you time if there are brace(s) at the end of the typed text, so you can just leave insert mode before them, and don't need to type them. Also, you don't need to count to get the right amount of closing braces.
If you need to move over some braces, much of the promise of the functionality is lost (you could have just typed the closing brace(s) yourself). The plugin should ensure that there's no loss of efficiency; i.e. moving over braces should be easy. Instead of using →, many plugins support just typing the brace character itself (I use this plugin for Vim, and it has this), and it will move over the identical character to the right of the cursor, instead of inserting a new one. That's faster and easier than leaving the home row for the cursor keys.