LoginSignup
1
2

More than 3 years have passed since last update.

Windows 10でemacs風キーバーインド。AutoHotKeyの設定をちょい足し編。

Last updated at Posted at 2020-08-25

元々はKeyhacを数年使っていたのだけれど、勝手にキーが入力されて永遠に止まらない不具合で
マシンが頻繁にハングするようになってしまったので、重い腰を上げてAutoHotKeyへの引っ越しをすることにしました。

xkeymacs → keyhac → autokeyhacの順に引っ越しているので、これでWindowsのキーバインドの設定は3種類目。
久々の変更です。

以下の記事を参考にEmacsキーバインドをセットアップ。

Windows 10でも「Emacs風キーバインド」を使おう【AutoHotKey】
https://linuxfan.info/windows-emacs-keybindings

を参考にインストール。

こちらから設定ファイルをダウンロードしました。
https://github.com/usi3/emacs.ahk

ほぼ設定ファイルは網羅されていたのですが、個人的に若干足りない設定があったので追加。

  • IMEの切り替えをCtrl+Oで
  • 画面の一番上までカーソル移動を Alt+Shift+<  
  • 画面の一番下までカーソル移動を Alt+Shift+>

下の2つのカーソルの移動のキーバインドがemacs風なのか個人でemacsに追記したのか自信がないけども、
とても不便に使っていたので、追記することに。

; IMEをon/offで切り替え
ime_switch()
{ 
  global
  If is_pre_spc 
     Send +{vkF3sc029}
  Else
     Send {vkF3sc029}
  Return
}

; 画面の一番上までカーソルを移動
pageup_top()
{
  global
  If is_pre_spc
     Send +^{Home}
  Else
     Send ^{Home}
  Return 
}

; 画面の一番下までカーソルを移動
pagedown_bottom()
{
  global
  If is_pre_spc
     Send +^{End}
  Else
     Send ^{End}
  Return 
}

; Ctrl+OでIMEをON/OFF 
^o::
  If is_target()
    Send %A_ThisHotkey%
  Else
    ime_switch()
  Return

;Alt+Shift+<でカーソルを一番上に移動
!+<::
  If is_target()
    Send %A_ThisHotkey%
  Else
    pageup_top()
  Return 

;Alt+Shift+>でカーソルを一番下に移動
!+>::
  If is_target()
    Send %A_ThisHotkey%
  Else
    pagedown_bottom()
  Return 

IMEのON/OFFはCtrl+O派の方に参考になれば。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2