Created
February 1, 2017 14:46
-
-
Save holin/7fb7622a7599ec3d90620f27106e632e to your computer and use it in GitHub Desktop.
my Hammerspoon init file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local function keyCode(key, modifiers) | |
| modifiers = modifiers or {} | |
| return function() | |
| hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), true):post() | |
| hs.timer.usleep(1000) | |
| hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), false):post() | |
| end | |
| end | |
| hs.hotkey.bind({'ctrl'}, 'j', keyCode('left'), nil, keyCode('left')) | |
| hs.hotkey.bind({'ctrl'}, 'k', keyCode('down'), nil, keyCode('down')) | |
| hs.hotkey.bind({'ctrl'}, 'i', keyCode('up'), nil, keyCode('up')) | |
| hs.hotkey.bind({'ctrl'}, 'l', keyCode('right'), nil, keyCode('right')) | |
| -- home, end | |
| hs.hotkey.bind({'cmd', 'ctrl'}, 'k', function() | |
| hs.eventtap.event.newKeyEvent({}, 'home', true):post() | |
| end) | |
| hs.hotkey.bind({'cmd', 'ctrl'}, ',', function() | |
| hs.eventtap.event.newKeyEvent({}, 'end', true):post() | |
| end) | |
| -- focus | |
| hs.hotkey.bind({'cmd', 'shift'}, 'e', function() | |
| hs.application.launchOrFocus("Terminal") | |
| end) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment