dtinth / atom-arpeggio

Define chords (simultaneously pressed keys) for speedy typing!
https://atom.io/packages/arpeggio
MIT License
8 stars 1 forks source link

arpeggio

Define chords (simultaneously pressed keys) for speedy typing! Video demo.

This plugin is heavily inspired by kana/vim-arpeggio.

Usage

Put the chord definitions in the arpeggio.chords section of your config.cson:

"*":
  arpeggio:
    chords:
      fun: 'function'

Now, whenever you press f, u, n at the same time, you type the word function.

Running a command

      sd:
        command: "editor:delete-to-beginning-of-word"
      kl:
        command: "editor:delete-to-beginning-of-word"

If you press the chord sd or kl, it will remove the last typed word. I use it when I want to delete a lot of text without moving my hands away from the home row.

Inserting a snippet

      con:
        snippet: 'console.log($1)'

If you press the chord con, then console.log() will be typed, with the cursor between the parentheses.

Note: The snippets package must be activated in order for this feature to work.

Use Cases

Quickly type some hard-to-type unicode characters

      kaw: "川"
      kuc: "口"
      del: "∆"
      pri: "ʹ"

This allows you to type code like this very easily:

var ∆x = xʹ - x

For quickly typing common words

      the: "the"

If you press t, h, e at the same time, you will always get the word the, no matter in which order you pressed these keys.

Quickly insert a brackets block

      "{}":
        snippet: '''
          {
            $1
          }
        '''

If you press { and } at the same time, you will get an empty curly braces block, with the cursor positioned at the $1 placeholder.

Share your chords in the wiki!

Configuration Reference

"*":
  arpeggio:
    chords:
      <trigger>: <expansion>

Expansion Object

An expansion is a text with the following keys:

Key Type Description
text Action The text to expand to.
snippet Action The snippet source to expand to.
command Action The command to invoke.
timeout Option The timeout in milliseconds. The keys in this particular chord must be pressed successively within the specified timeout in order for the chord to be triggered. This is useful when the chord is often accidentally triggered during normal typing.