Skip to content

Instantly share code, notes, and snippets.

@jpf
Created January 5, 2021 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpf/e6a83f7c80eb1556144835b679d258c1 to your computer and use it in GitHub Desktop.
Save jpf/e6a83f7c80eb1556144835b679d258c1 to your computer and use it in GitHub Desktop.
Hammerspoon code to do a "turret paste"
popHopper = function()
return nil
end
turretPaste = function()
next = popHopper()
if next == nil then
-- this will result in no action after a keypress
clip = hs.pasteboard.readString()
popHopper = string.gmatch(clip, "[^%s]+")
else
hs.eventtap.keyStrokes(next)
end
end
-- Clear "turret"
hs.hotkey.bind('', 'f17', function()
popHopper = function()
return nil
end
end)
hs.hotkey.bind('', 'f18', function()
turretPaste()
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment