Search code examples
autocompletesublimetext2tab-completion

When using tab completion what is the fastest way to end your line of code?


When I am coding and using tab/auto completion one thing that slows down my flow is at the end of each line adding something like a semi-colon.

I am using the | (pipe) in my examples below to show my cursor location.

For example, lets say my completed line of code will be:

$myName = 'BitBug';

When I type the first single quote ' it will be paired with another ' for '' and my cursor is in-between the two single quotes like this:

$myName = '|'

I then type "BitBug" and now it looks like this:

$myName = 'BitBug|'

Now I want to add my semi-colon to end the line. But my cursor is right after the "g", not at the end of the line.

So either I have to arrow over the last single quote, or I have to hit the "end" key on my keyboard, then hit my semi-colon. Either way causes me to move a hand off my home row of keys and slows down my coding.

I am sure I could just add a new key binding to my Sublime Text 2 for this, however because so many programs and editors use tab/auto completion I figure this is a more universal issue and their may be a trick I am unaware of?

Is there a faster way to do this I am unaware of besides making a custom key-binding?

Thanks ahead of time!!


Solution

  • I think you might like the AutoSemiColon plugin.

    But a shortcut to move to the end of line is useful in many cases, so i suggest you put it your keymap file anyway. To prevent you from looking it up, here's the line:

    { "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": false} },