ウィンドウズで MacBook みたいなきーばいどにしたくて AutoHotkey のマクロ書きました。
スペースキーの左右にある [無変換] [変換] を [英数] [かな] にして
Emacs ライクなキーバインド (Macな感じ) に変更します。
is_disable() に追加されたアプリケーションは対象外になります。
わたしのばあい Blender はもともとのキーバインドで使いたいので無効にしています。
みなさん おたのしんでね!
AutoHotkey はこちらから
https://www.autohotkey.com/
[like_jpmac.ask]
#InstallKeybdHook
# UseHook
ime_set(SetSts, WinTitle="A")
{
ControlGet,hwnd,HWND,,,%WinTitle%
if(WinActive(WinTitle))
{
ptrSize := !A_PtrSize ? 4 : A_PtrSize
VarSetCapacity(stGTI, cbSize:=4+4+(PtrSize*6)+16, 0)
NumPut(cbSize, stGTI, 0, "UInt") ; DWORD cbSize;
hwnd := DllCall("GetGUIThreadInfo", Uint,0, Uint,&stGTI)
? NumGet(stGTI,8+PtrSize,"UInt") : hwnd
}
return DllCall("SendMessage"
, UInt, DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hwnd)
, UInt, 0x0283 ;Message : WM_IME_CONTROL
, Int, 0x006 ;wParam : IMC_SETOPENSTATUS
, Int, SetSts) ;lParam : 0 or 1
}
is_disable()
{
;vim
if WInActive("ahk_class Vim")
{
return 1
}
;tera term
if WInActive("ahk_class VTWin32")
{
return 1
}
;blender
if WInActive("ahk_exe blender.exe")
{
return 1
}
return 0
}
send_key(original_key,replace_key)
{
if(is_disable() == 1)
{
Send,%original_key%
return
}
else if(is_disable() == 2)
{
Send,%replace_key%
return
}
Send,%replace_key%
return
}
;<^a::send_key("^a","{Home}")
;<^+a::send_key("^+a","+{Home}")
;<^e::send_key("^e","{End}")
;<^+e::send_key("^+e","+{End}")
;<^d::send_key("^d","{Del}")
;<^+d::send_key("^+d","+{Del}")
;<^k::send_key("^k","+{End}{Del}")
<MButton::send_key("MButton","+{Alt}{Ctrl}")
vk1Dsc07B::ime_set(0)
vk1Csc079::ime_set(1)