In atom editor, when I type console.log(
for example, it becomes console.log()
and the cursor stays between the two parenthesis. So I have to use End button or Right arrow key to jump out of there.
Is there any way to use Tab instead (to jump out of ending parenthesis/brackets/quotation) ?
Space is just a space, and Cmd+Space moves the cursor to the end of the text on that line. Thanks so much!
When in a file that needs reverting, press ctrl-cmd-r to revert the file.
If you just keep typing, then the closing ) will be 'swallowed' by Atom's bracket matcher, so you don't need to press End or →.
However, there are some situations where Atom's bracket matcher doesn't swallow up keypresses and you can't just keep typing. For example, when you enter the following code, after pressing ; you might need to move the cursor past the closing curly brace (which Atom automatically inserted):
if (someCondition) {
doSomething();
}
In situations like this, you can use a custom command and a custom keymap to jump the cursor forward. Here's how...
Go to the file menu and select 'Open Your Init Script', then paste the following code into the file. This defines a command that can move the cursor forward, jumping over a single bracket, brace, or quotation mark.
SymbolRegex = /\s*[(){}<>[\]/'"]/
atom.commands.add 'atom-text-editor', 'custom:jump-over-symbol': (event) ->
editor = atom.workspace.getActiveTextEditor()
cursorMoved = false
for cursor in editor.getCursors()
range = cursor.getCurrentWordBufferRange(wordRegex: SymbolRegex)
unless range.isEmpty()
cursor.setBufferPosition(range.end)
cursorMoved = true
event.abortKeyBinding() unless cursorMoved
You have to close and re-open Atom to reload the init script.
Next, go to the file menu, select 'Open Your Keymap', and enter a keybinding for the new command. You could use the TAB key, but that would conflict with Atom's default keymap for snippets, so here I have used Alt+) instead:
'atom-text-editor:not([mini])':
'alt-)': 'custom:jump-over-symbol'
Another option is just to disable Atom's automatic insertion of closing brackets. I think you can do that by going to Settings → Packages → bracket-matcher → Settings, and clearing the option 'Autocomplete Brackets'.
I also wanted this in Atom so I went ahead and made a package for it. https://atom.io/packages/tab-through
Added value over crumbletown's solution is that you can change the keybinding (I personally prefer tab, hence the package name) and characters you want via package settings, vs. having to make edits to the init script.
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