Navigating (tabbing) through elements and function arguments


#1

When creating a function in JS, such as:

function foo(“arg1”)

and my cursor is in front of the ‘1’, I can’t use Tab to move the cursor behind the quotation mark. Tab just adds one space, like I’m pressing the spacebar once. The same is true when making an array or an object, such as here:

var dog = {name: “spots”}
var array = [“cat”]

If my cursor is in front of the quotation mark, I can’t use Tab to move in behind of it. Am I supposed to be using another key instead of tab? I’d rather not resort to the arrow keys.


#2

If I’m understanding you correctly, you can only tab between fields like what you’re describing if you’re in the middle of a snippet. See the Atom Flight Manual for the basics on Atom snippets:

http://flight-manual.atom.io/using-atom/sections/snippets/


#3

So if I don’t want to use snippets, I have to use the arrow keys when typing strings in an array, object, or function parameter? I have the same problem when making a string variable, like:

var name = “cat”

If my cursor is inbetween the ‘t’ and quotation mark, I can’t use tab to move behind the quotation mark and type a semicolon. I have to use the arrow keys.

Also, I edited my first post, changing 'in front of the quotation mark' to 'behind the quotation mark'.


#4

Or you can just type the double-quote character and it will move behind the double-quote instead of repeating it.


#5

Or you can just type the double-quote character and it will move behind the double-quote instead of repeating it.

Thanks, that actually helps a lot. I hadn’t tried that and wasn’t sure how people were able to type strings quickly without tab or some other shortcut. I guess I’m just too used to eclipse and visual studio.

Do people do the same thing with arrays and objects, where they just type a ']' or a '}' to move behind the bracket? It still feels slower to me than what I"m used to, using tab to navigate, but at least its better than using the arrow keys


#6

Yes, it works for most common paired punctuation.


#7

With quotes, it’s less unclear, but many ] and } characters, and quite a number of )s in code appear at the beginning of the line after whitespace. It’s difficult for Atom to know if a tab in front of one of those three characters is meant to indent the character or get past it. If you want that behavior, though, it wouldn’t be hard to write a command to move the cursor to behind the next quote, parenthesis character, or bracket. That could be bound to tab, ctrl-tab, or whatever. You could make a tool-bar button to turn the behavior on and off. Atom gives a lot of choices.