-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e00344
commit 0dd99ff
Showing
6 changed files
with
126 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,6 @@ package-lock.json | |
|
||
# BFG | ||
..bfg-report/ | ||
|
||
# Hammerspoon Spoons | ||
hammerspoon/Spoons/ |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"diagnostics.globals": [ | ||
"vim", | ||
"args" | ||
"args", | ||
"hs", | ||
"spoon" | ||
] | ||
} | ||
} |
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
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
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,100 @@ | ||
-- Config reload | ||
hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "R", function() | ||
hs.reload() | ||
end) | ||
hs.alert.show("Hammerspoon re-loaded") | ||
|
||
-- Load & initialize Ki spoon | ||
hs.loadSpoon("Ki") | ||
|
||
-- Set state events to enable transitions for scroll mode. | ||
-- Expose `enterScrollMode` in the FSM to allow transition from normal mode to scroll mode, | ||
-- and `exitMode` to exit from scroll mode back to desktop mode. | ||
spoon.Ki.stateEvents = { | ||
{ name = "enterScrollMode", from = "normal", to = "scroll" }, | ||
{ name = "exitMode", from = "scroll", to = "desktop" }, | ||
} | ||
|
||
-- Set custom scroll mode transition events. | ||
spoon.Ki.transitionEvents = { | ||
-- Add normal mode transition event to enter scroll mode with cmd+ctrl+s from normal mode | ||
normal = { | ||
{ | ||
{ "cmd", "alt", "ctrl" }, | ||
"s", | ||
function() | ||
spoon.Ki.state:enterScrollMode() | ||
end, | ||
{ "Normal Mode", "Transition to Scroll Mode" }, | ||
}, | ||
}, | ||
-- Add scroll mode transition event to exit scroll mode with escape back to desktop mode. | ||
scroll = { | ||
{ | ||
nil, | ||
"escape", | ||
function() | ||
spoon.Ki.state:exitMode() | ||
end, | ||
{ "Scroll Mode", "Exit to Desktop Mode" }, | ||
}, | ||
}, | ||
} | ||
|
||
-- Scroll event handler helper method | ||
local function createScrollEvent(offsets) | ||
return function() | ||
hs.eventtap.event.newScrollEvent(offsets, {}, "pixel"):post() | ||
end | ||
end | ||
|
||
-- Define custom scroll mode shortcuts | ||
local scrollEvents = { | ||
{ nil, "h", createScrollEvent({ 50, 0 }), { "Scroll Events", "Scroll Left" } }, | ||
{ nil, "k", createScrollEvent({ 0, 50 }), { "Scroll Events", "Scroll Up" } }, | ||
{ nil, "j", createScrollEvent({ 0, -50 }), { "Scroll Events", "Scroll Down" } }, | ||
{ nil, "l", createScrollEvent({ -50, 0 }), { "Scroll Events", "Scroll Right" } }, | ||
{ { "ctrl" }, "d", createScrollEvent({ 0, -500 }), { "Scroll Events", "Scroll Half Page Down" } }, | ||
{ { "ctrl" }, "u", createScrollEvent({ 0, 500 }), { "Scroll Events", "Scroll Half Page Up" } }, | ||
} | ||
|
||
-- Set custom workflows | ||
spoon.Ki.workflowEvents = { | ||
scroll = scrollEvents, | ||
} | ||
|
||
-- Start Ki Spoon | ||
spoon.Ki:start() | ||
|
||
-------------------------------- | ||
-- START VIM CONFIG | ||
-------------------------------- | ||
local VimMode = hs.loadSpoon("VimMode") | ||
local vim = VimMode:new() | ||
|
||
-- Configure apps you do *not* want Vim mode enabled in | ||
vim:disableForApp("Code") | ||
:disableForApp("zoom.us") | ||
:disableForApp("iTerm") | ||
:disableForApp("iTerm2") | ||
:disableForApp("Terminal") | ||
:disableForApp("Kitty") | ||
:disableForApp("kitty") | ||
|
||
-- If you want the screen to dim (a la Flux) when you enter normal mode | ||
-- flip this to true. | ||
vim:shouldDimScreenInNormalMode(false) | ||
|
||
-- If you want to show an on-screen alert when you enter normal mode, set | ||
-- this to true | ||
vim:shouldShowAlertInNormalMode(true) | ||
|
||
-- You can configure your on-screen alert font | ||
vim:setAlertFont("Courier New") | ||
|
||
-- Enter normal mode by typing a key sequence | ||
vim:enterWithSequence("jk") | ||
|
||
-------------------------------- | ||
-- END VIM CONFIG | ||
-------------------------------- |
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,14 @@ | ||
version: "3" | ||
tasks: | ||
all: | ||
desc: Install Hammerspoon's plugins | ||
cmds: | ||
- task: all:spoons | ||
all:spoons: | ||
desc: Install Spoons | ||
status: | ||
- test -d ~/.dotfiles/hammerspoon/Spoons/Ki.spoon | ||
- test -d ~/.dotfiles/hammerspoon/Spoons/VimMode.spoon | ||
- test -d ~/.dotfiles/hammerspoon/Spoons/SpoonInstall.spoon | ||
cmds: | ||
- bash <(curl -s https://raw.githubusercontent.com/dbalatero/VimMode.spoon/master/bin/installer) |