Introducing Arpeggio… map a chord to any text you want


#1

Hello! This is my first package on Atom. It is based on my favorite Vim plugin with the same name, vim-arpeggio.

It helps you type faster by letting you define “chords,” a combination of keys that you must press at the same time.

For example, if you define a chord mapping like this in your config.cson:

      fun: 'function'

Then if you press f u n at the same time, then you have typed the word function. You can also map chords to any Atom command, as well as snippets.

Here’s a 30-second video demo:

In that video, I used these chords for typing code:

      var: 'var '
      fun: 'function'
      '{}': { snippet: '{\n  $1\n}' }
      ret: 'return '
      tru: 'true'
      con: { snippet: 'console.log($1)' }

I also defined chords for common English words such as ‘the’, ‘and’, ‘that’, ‘have’, ‘has’, ‘been’, and so on. In addition to that, I also define chords for some unicode characters that I may use in variable names.

Enjoy. :smiley:


#2

That seems terribly acrobatic. Why not use snippets instead?


#3

I’m a kind of person who prefers to have a direct manipulation of the code I write. Snippets is a way to write code indirectly through invoking a snippet with a correct prefix, and for me that adds some mental overhead. I prefer to just type it in directly.

So personally, I think of chords as a way to type some commonly used words really fast. I want a var, so I just press var at the same time. I don’t have to think of what is the right snippet to use.

For example, to import a CommonJS module, var $ = require('jquery'), you’d use the req snippet. Note that what you want to see is not what you type.

With Arpeggio I’d press var$ = reqjquery, which I feel that I wrote the code more directly.

I do use snippets when I want a larger block of boilerplate code, such as a Jekyll post template, or a whole React component module boilerplate, but using a snippet just to type a var statement seems to be an overkill for me.

By the way, it also has to do with keyboard layouts. Most of the chords I use can be comfortably typed with my hands on the home row using the Colemak keyboard layout.


#5

Hm, I respect that preference, even though I can’t understand it at all.
For some reason, having to press three letters at the same time, would take me so much longer than just typing v a r, one letter after the next (as a snippet).

It’s muscle memory to most people who are used to using a keyboard. Comes naturally, don’t even have to pay attention.
Having to make sure all three are pressed at the same time takes quite some effort to fight that muscle memory.

A matter of habit, I suppose. I’ve just never seen this before.


#6

Can you touch-type the chords without looking? If not then I know I can type it faster than you.


#7

I’m not a skilled typist (I just type at around 70 WPM when I am not thinking), but yes, I touch-type all the chords without looking at all.

The real benefits for me are chords like this, and I seem to type them naturally now:

  • fun function
  • con console.log()
  • req require('')
  • ret return
  • mex module.exports

If you look at the Colemak layout chart, you’ll see that all these key combinations can be typed very comfortably.


#8

You are correct that it takes a bit of time to get used to.

There is a kind of keyboard, called a Chorded keyboard, such as a Stenotype. With only 22 keys on the keyboard, they claim that many stenotypists can reach 300WPM with 3 years of training. It has been used in real-time court reporting.

That’s where I got the idea of chorded typing from. I found out that there is already a Vim plugin to enable chords in the editor. So I tried to use it for commonly-typed words (function is a very frequent word in JavaScript). I found that it works very well.

When I switched to Atom, I really missed my chords. The “snippets” way to get a console.log() is to use the log snippet. For me, typing log took much more time than slamming con at the same time. I also tend to use put the first letters of the text I want to type into chords (e.g. con instead of log), which makes it feel more “direct.”

And that’s the inspiration of this plugin.


#9

I moved 4 posts to a new topic: Crazy 3D angled Tree View?