OSX default kill(ctrl + k
) and yank(ctrl + y
) function doesn't work when using Thai or Korean input mode.
Other key bindings for cursor movements are also disabled.
So I'm trying to emulate the function by using Hammerspoon
.
But I couldn't find out how to call the kill
and yank
function from hammerspoon.
I could only implemente for cursor movements by this code.
local EmacsKeyMap = hs.hotkey.modal.new()
local function sendKey(mods, key)
return function()
hs.eventtap.keyStroke(mods, key, 10000)
end
end
local function bindToEmacsKeyMap(mods, key, func)
EmacsKeyMap:bind(mods, key, func, nil, func)
end
bindToEmacsKeyMap({'ctrl'}, 0, sendKey({'command'}, 'left')) -- C-a
bindToEmacsKeyMap({'ctrl'}, 14, sendKey({'command'}, 'right')) -- C-e
bindToEmacsKeyMap({'ctrl'}, 11, sendKey({}, 'left')) -- C-b
bindToEmacsKeyMap({'ctrl'}, 3, sendKey({}, 'right')) -- C-f
bindToEmacsKeyMap({'ctrl'}, 45, sendKey({}, 'down')) -- C-n
bindToEmacsKeyMap({'ctrl'}, 35, sendKey({}, 'up')) -- C-p
bindToEmacsKeyMap({'ctrl'}, 4, sendKey({}, 'delete')) -- C-h
EmacsKeyMap:enter()
I googled some hammerspoon scripts for emacs emulation, but they are just using key strokes for the function.
Is there a way to call the kill and yank directly from a Hammerspoon script?
Edit 2019/02/21
If Karabiner
or other applications can accomplish same behavior, I'm going to use it.