環境
- Windows11 Home
やりたいこと
AutoHotKeyを使って、
Chromeのtextareaやtextbox、およびPowerShellやコマンドプロンプトをemacs(bash)ライクに操作できるようにする。
やり方。
1.AutoHotKeyをインストールする
2.以下の.ahkファイルを作成し、実行する
#Requires AutoHotkey v2.0
; ===== Chrome 判定 =====
IsChromeEditable() {
if !WinActive("ahk_class Chrome_WidgetWin_1")
return false
return true
}
#HotIf IsChromeEditable()
^h::Send "{Backspace}"
^b::Send "{Left}"
^f::Send "{Right}"
^n::Send "{Down}"
^p::Send "{Up}"
^a::Send "{Home}"
^+a::Send "^a"
^e::Send "{End}"
^j::Send "{Down}"
^k::{
Send "+{End}"
Send "{Delete}"
}
#HotIf
; ===== ターミナル系(PowerShell / CMD / Windows Terminal)=====
IsTerminalEditable() {
if (WinActive("ahk_exe WindowsTerminal.exe"))
return true
if (WinActive("ahk_exe pwsh.exe"))
return true
if (WinActive("ahk_exe powershell.exe"))
return true
if (WinActive("ahk_exe cmd.exe"))
return true
return false
}
#HotIf IsTerminalEditable()
^h::Send "{Backspace}"
^b::Send "{Left}"
^f::Send "{Right}"
^n::Send "{Down}"
^p::Send "{Up}"
^a::Send "{Home}"
^+a::Send "^a"
^e::Send "{End}"
^j::Send "{Down}"
^k::{
Send "+{End}"
Send "{Delete}"
}
#HotIf
まとめ
AutoHotKeyは、ネ申である。
コメント