From 10de79427e991c4fdfdd4982adac4cc7d1062a0e Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 6 Oct 2022 22:20:08 +0900 Subject: [PATCH] add: ahk & install script --- bin/windows/install_key_remaps.ps1 | 31 +++++++++++++++ dotfiles/ahk/.gitignore | 1 + dotfiles/ahk/key_remaps.ahk | 64 ++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 bin/windows/install_key_remaps.ps1 create mode 100644 dotfiles/ahk/.gitignore create mode 100644 dotfiles/ahk/key_remaps.ahk diff --git a/bin/windows/install_key_remaps.ps1 b/bin/windows/install_key_remaps.ps1 new file mode 100644 index 0000000..fd53087 --- /dev/null +++ b/bin/windows/install_key_remaps.ps1 @@ -0,0 +1,31 @@ +# Install script for AHK key remapping +# Be sure to install AutoHotKey first + + +# check working directory +if (!( + (Test-Path bin) -and (Test-Path dotfiles) + )) { + Write-Warning -Message "wrong current path + please execute at repo root" + exit 1 +} + +# set Ahk2Exe.exe path +# example "C:\Program Files\AutoHotKey\Compiler\Ahk2Exe.exe" +$ahk2exe_path = "C:\Program Files\AutoHotKey\Compiler\Ahk2Exe.exe" + +## end config + +if ($null -eq $ahk2exe_path) { + exit +} + +# compile +& $ahk2exe_path /in .\dotfiles\ahk\key_remaps.ahk /out dotfiles\ahk\key_remaps.exe + +# add to startup folder +$startup = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\" +Copy-Item .\dotfiles\ahk\key_remaps.exe $startup + +Write-Output "Finished!" diff --git a/dotfiles/ahk/.gitignore b/dotfiles/ahk/.gitignore new file mode 100644 index 0000000..b883f1f --- /dev/null +++ b/dotfiles/ahk/.gitignore @@ -0,0 +1 @@ +*.exe diff --git a/dotfiles/ahk/key_remaps.ahk b/dotfiles/ahk/key_remaps.ahk new file mode 100644 index 0000000..4ef1436 --- /dev/null +++ b/dotfiles/ahk/key_remaps.ahk @@ -0,0 +1,64 @@ +; basic key remapping for windows(JIS keyboard) +; using AutoHotKey +#SingleInstance, Force +SendMode Input +SetWorkingDir, %A_ScriptDir%1 + +; KeyHistory + +#UseHook + +; ========================================== +; 変換/無変換 + ASDF/HJKLのショートカット +vk1D:: +Send, {vk1D} +Return + +vk1C:: +Send, {vk1C} +Return + +; 十字キーの設定 +; hjkl like vim +vk1D & h:: +vk1C & h:: +Send,{Blind}{Left} +return +vk1D & j:: +vk1C & j:: +Send,{Blind}{Down} +return +vk1D & k:: +vk1C & k:: +Send,{Blind}{Up} +return +vk1D & l:: +vk1C & l:: +Send,{Blind}{Right} +return + +; Home,End,PgUp,PgDnの設定 +; a s d f +; Home PgUp PgDn End +vk1D & a:: +vk1C & a:: +Send,{Blind}{Home} +return +vk1D & f:: +vk1C & f:: +Send,{Blind}{End} +return +vk1D & s:: +vk1C & s:: +Send,{Blind}{PgUp} +return +vk1D & d:: +vk1C & d:: +Send,{Blind}{PgDn} +return + + +; ========================================== +; HankakuZenkaku to esc +sc029:: + Send, {Escape}