-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CONF: Try adding key config on darwin
- Loading branch information
Showing
3 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
68 changes: 68 additions & 0 deletions
68
dot_config/private_karabiner/private_assets/private_complex_modifications/hyper_caps.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"title": "CAPS to fake hyper (f19) and Shift CAPS", | ||
"rules": [ | ||
{ | ||
"description": "CAPS_LOCK : (HYPER)", | ||
"manipulators": [ | ||
{ | ||
"from": { | ||
"key_code": "caps_lock", | ||
"modifiers": { | ||
"optional": ["any"] | ||
} | ||
}, | ||
"to": | ||
{ | ||
"key_code": "f19" | ||
}, | ||
"type": "basic" | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "Toggle CAPS_LOCK with LEFT_SHIFT + RIGHT_SHIFT", | ||
"manipulators": [ | ||
{ | ||
"from": { | ||
"key_code": "left_shift", | ||
"modifiers": { | ||
"mandatory": ["right_shift"], | ||
"optional": ["caps_lock"] | ||
} | ||
}, | ||
"to": [ | ||
{ | ||
"key_code": "caps_lock" | ||
} | ||
], | ||
"to_if_alone": [ | ||
{ | ||
"key_code": "left_shift" | ||
} | ||
], | ||
"type": "basic" | ||
}, | ||
{ | ||
"from": { | ||
"key_code": "right_shift", | ||
"modifiers": { | ||
"mandatory": ["left_shift"], | ||
"optional": ["caps_lock"] | ||
} | ||
}, | ||
"to": [ | ||
{ | ||
"key_code": "caps_lock" | ||
} | ||
], | ||
"to_if_alone": [ | ||
{ | ||
"key_code": "right_shift" | ||
} | ||
], | ||
"type": "basic" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
-- Reload config when any lua file in config directory changes | ||
-- From https://gist.github.com/prenagha/1c28f71cb4d52b3133a4bff1b3849c3e | ||
function reloadConfig(files) | ||
doReload = false | ||
for _,file in pairs(files) do | ||
if file:sub(-4) == '.lua' then | ||
doReload = true | ||
end | ||
end | ||
if doReload then | ||
hs.reload() | ||
end | ||
end | ||
local myWatcher = hs.pathwatcher.new(os.getenv('HOME') .. '/.hammerspoon/', reloadConfig):start() | ||
hs.alert.show('Config loaded') | ||
|
||
-- A global variable for the Hyper Mode | ||
hyper = hs.hotkey.modal.new({}, 'F18') | ||
|
||
-- Enter Hyper Mode when F19 (Hyper/Capslock) is pressed | ||
function enterHyperMode() | ||
hyper.triggered = false | ||
hyper:enter() | ||
end | ||
|
||
-- Leave Hyper Mode when F19 (Hyper/Capslock) is pressed, | ||
-- send ESCAPE if no other keys are pressed. | ||
function exitHyperMode() | ||
hyper:exit() | ||
if not hyper.triggered then | ||
-- local app = hs.application.frontmostApplication() | ||
-- if app:name() == "Emacs" then | ||
-- Do nothing | ||
-- else | ||
-- hs.eventtap.keyStroke({}, 'ESCAPE') | ||
-- end | ||
end | ||
end | ||
|
||
-- Bind the Hyper key | ||
f19 = hs.hotkey.bind({}, 'F19', enterHyperMode, exitHyperMode) | ||
f19cmd = hs.hotkey.bind({'cmd'}, 'F19', enterHyperMode, exitHyperMode) | ||
|
||
-- Vim Colemak bindings (hzColemak) | ||
|
||
-- Basic Movements {{{2 | ||
|
||
-- h - move left {{{3 | ||
function left() hs.eventtap.keyStroke({}, "Left", 0) end | ||
hyper:bind({}, 'h', left, nil, left) | ||
-- }}}3 | ||
|
||
-- n - move down {{{3 | ||
function down() hs.eventtap.keyStroke({}, "Down", 0) end | ||
hyper:bind({}, 'n', down, nil, down) | ||
-- }}}3 | ||
|
||
-- e - move up {{{3 | ||
function up() hs.eventtap.keyStroke({}, "Up", 0) end | ||
hyper:bind({}, 'e', up, nil, up) | ||
-- }}}3 | ||
|
||
-- i - move right {{{3 | ||
function right() hs.eventtap.keyStroke({}, "Right", 0) end | ||
hyper:bind({}, 'i', right, nil, right) | ||
-- }}}3 | ||
|
||
-- ) - right programming brace {{{3 | ||
function rbroundL() hs.eventtap.keyStrokes("(") end | ||
hyper:bind({}, 'k', rbroundL, nil, rbroundL) | ||
-- }}}3 | ||
|
||
-- ) - left programming brace {{{3 | ||
function rbroundR() hs.eventtap.keyStrokes(")") end | ||
hyper:bind({}, 'v', rbroundR, nil, rbroundR) | ||
-- }}}3 | ||
|
||
-- o - open new line below cursor {{{3 | ||
hyper:bind({}, 'o', nil, function() | ||
local app = hs.application.frontmostApplication() | ||
if app:name() == "Finder" then | ||
hs.eventtap.keyStroke({"cmd"}, "o", 0) | ||
else | ||
hs.eventtap.keyStroke({}, "Return", 0) | ||
end | ||
end) | ||
-- }}}3 | ||
|
||
-- Extend+AltGr layer | ||
-- Delete {{{3 | ||
|
||
-- cmd+h - delete character before the cursor {{{3 | ||
local function delete() | ||
hs.eventtap.keyStroke({}, "delete", 0) | ||
end | ||
hyper:bind({"cmd"}, 'h', delete, nil, delete) | ||
-- }}}3 | ||
|
||
-- cmd+i - delete character after the cursor {{{3 | ||
local function fndelete() | ||
hs.eventtap.keyStroke({}, "Right", 0) | ||
hs.eventtap.keyStroke({}, "delete", 0) | ||
end | ||
hyper:bind({"cmd"}, 'i', fndelete, nil, fndelete) | ||
-- }}}3 | ||
|
||
-- ) - right programming brace {{{3 | ||
function rbcurlyL() hs.eventtap.keyStrokes("{") end | ||
hyper:bind({"cmd"}, 'k', rbcurlyL, nil, rbcurlyL) | ||
-- }}}3 | ||
|
||
-- ) - left programming brace {{{3 | ||
function rbcurlyR() hs.eventtap.keyStrokes("}") end | ||
hyper:bind({"cmd"}, 'v', rbcurlyR, nil, rbcurlyR) | ||
-- }}}3 | ||
|
||
-- Extend+Shift | ||
|
||
-- ) - right programming brace {{{3 | ||
function rbsqrL() hs.eventtap.keyStrokes("[") end | ||
hyper:bind({"shift"}, 'k', rbsqrL, nil, rbsqrL) | ||
-- }}}3 | ||
|
||
-- ) - left programming brace {{{3 | ||
function rbsqrR() hs.eventtap.keyStrokes("]") end | ||
hyper:bind({"shift"}, 'v', rbsqrR, nil, rbsqrR) | ||
-- }}}3 | ||
|
||
-- Special Movements | ||
-- w - move to next word {{{3 | ||
function word() hs.eventtap.keyStroke({"alt"}, "Right", 0) end | ||
hyper:bind({}, 'w', word, nil, word) | ||
-- }}}3 | ||
|
||
-- b - move to previous word {{{3 | ||
function back() hs.eventtap.keyStroke({"alt"}, "Left", 0) end | ||
hyper:bind({}, 'b', back, nil, back) | ||
-- }}}3 |