Adding Code

In this section, we’ll cover the topic of adding code in more detail.

Raw Text

The type command is the simplest way to add text. type simply inserts text at the current cursor position. So, if you say:

type get value

You’ll see the text:

get value

You can also say symbols, like:

type get underscore value

To produce the text:


If you’d like to escape a symbol, then you can say:

type get escape underscore value

Which will produce:

get underscore value

You can also surround text with symbols. For instance, you can say:

type in parens get value
type in quotes get value
type in double quotes get value
type in brackets get value
type in braces get value
type in comparators get value

In order to produce:

(get value)
'get value'
"get value"
[get value]
{get value}
<get value>

If the text you’re trying to put inside the pair is really long, you might want to just use the individual characters so that you can write it out incrementally. For instance, rather than type in parens get value, you can also say:

type paren get value close paren

In order to produce the same thing.

Styled Text

We’ve been using the default text style, lowercase with spaces between words, but you can also use other text styles.

For instance, to insert capital letters, you can say:

type capital get value

Which will produce:

Get value

For camel case, you can say:

type camel case get value

Which will produce:


For pascal case, you can say:

pascal case get value

Which will produce:


For styling constant variables, you can say:

type all caps get value

Which will produce:


For inserting underscores between words, you can say:

type underscores get random value

Which will produce:



The type command is a useful way of adding raw text, but dictating programming language constructs can be a lot of speaking. To be more efficient, you can use the add command, which you can think of as a smarter version of type that takes into account what code you’d like to insert.

Recall that add commands all take the form:

add <selector> <text>

For example, you could say:

add if

That will produce:

if True:

Whereas type if will just add the string if at the current cursor position, add if will create a syntactically-correct block of code, without you needing to dictate the entire thing.

Let’s look at some more. Try saying:

add function get
add parameter value

That will produce:

def get(value):

Similarly, you could say:

add class request manager
add parent manager

That will produce:

class RequestManager(Manager):

Notice that the default styling of the class name is pascal case, since that’s a Python convention. You can also choose to style it differently using the same symbols and text styling commands you saw with the type command.

For example:

add class underscore camel case request manager

Will produce:

class _requestManager(object):

Finally, you can add full statements by saying things like:

add length equals len in parens string

That will produce:

length = len(string)

For a full list of selectors supported by add, see the Command Reference.