Skip to content

dccxi/ShiftParentheses.spoon

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShiftParentheses.spoon

Supercharge your shift key. Tap it for parentheses. Hold it for shift.

A more useful shift key

As Steve Losh points out in his Modern Space Cadet post, there are "keys you hold down to change how other keys behave, but that (usually) don’t do anything if you use them on their own" (e.g., shift), and there are "keys that you press and release but don’t want to 'repeat' as you hold them" (e.g., parentheses). "There are two [distinctly] different ways to use [these keys] and they’re each only useful in one of those ways. This means that we can combine them onto a single key without losing any useful functionality!"

With that in mind, we can teach the shift key to pull double duty:

  • If shift is pressed and released in isolation, we can generate a pair of parentheses and locate the cursor between them
  • If shift is held down and used in combination with another key, then we can let it provide the normal shift key behavior

Dependencies

This functionality is developed and tested with the following dependencies:

Installation

Just the basics

mkdir -p ~/.hammerspoon/Spoons

git clone https://github.com/dccxi/ShiftParentheses.spoon.git ~/.hammerspoon/Spoons/ShiftParentheses.spoon

cd ~/.hammerspoon/Spoons/ShiftParentheses.spoon

script/setup

Now you're ready to rock. 🤘

Where can I get this code as a Spoon?

If you prefer to roll your own Hammerspoon config, this code is also available as a Spoon. Just look for ShiftParentheses.spoon.zip included with the latest release.

Shout-outs

Shout-out to @arbelt and @jasoncodes for the original implementation of this functionality. ⚡️🍻🌟

This code is an adaptation of their work:

You might also like...

Still reading? Dude, you're pretty serious about your keyboard. :neckbeard:

Lucky for you, there's more where this came from. Check out jasonrudolph/keyboard for even more fun. ⌨🤓

About

⌨ Supercharge your Shift key: Tap it for parentheses. Hold it for Shift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Lua 69.0%
  • Shell 30.1%
  • Ruby 0.9%