diff --git a/README.md b/README.md index 0912942f..5c1da83e 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,10 @@ This script is written in AutoHotkey (AHK) and has been maintained since Sep 21, kill-emacs +C-x h +select-all + + C-d delete-char @@ -110,6 +114,14 @@ This script is written in AutoHotkey (AHK) and has been maintained since Sep 21, backward-char +M-f +forward-word + + +M-b +backward-word + + C-v scroll-down @@ -117,6 +129,32 @@ This script is written in AutoHotkey (AHK) and has been maintained since Sep 21, M-v scroll-up + +M-< +goto home + + +M-> +goto end + + + + +W-c +copy + + +W-x +cut + + +W-v +paste + + +W-a +select-all + diff --git a/emacs.ahk b/emacs.ahk index 3de821c4..caed5dcc 100644 --- a/emacs.ahk +++ b/emacs.ahk @@ -22,23 +22,26 @@ is_target() Return 1 IfWinActive,ahk_class cygwin/x X rl-xterm-XTerm-0 Return 1 - IfWinActive,ahk_class MozillaUIWindowClass ; keysnail on Firefox + IfWinActive,ahk_class MozillaWindowClass ;Firefox Return 1 - ; Avoid VMwareUnity with AutoHotkey IfWinActive,ahk_class VMwareUnityHostWndClass Return 1 IfWinActive,ahk_class Vim ; GVIM Return 1 -; IfWinActive,ahk_class SWT_Window0 ; Eclipse -; Return 1 -; IfWinActive,ahk_class Xming X -; Return 1 -; IfWinActive,ahk_class SunAwtFrame -; Return 1 -; IfWinActive,ahk_class Emacs ; NTEmacs -; Return 1 -; IfWinActive,ahk_class XEmacs ; XEmacs on Cygwin -; Return 1 + IfWinActive,ahk_class Emacs + Return 1 + IfWinActive,ahk_class TTOTAL_CMD + Return 1 + IfWinActive,ahk_exe idea64.exe + Return 1 + ; IfWinActive,ahk_exe EXCEL.EXE + ; Return 1 + IfWinActive,ahk_exe ConEmu64.exe + Return 1 + IfWinActive,ahk_exe PUTTY.EXE + Return 1 + IfWinActive,ahk_exe Balsamiq Mockups 3.exe + Return 1 Return 0 } @@ -72,6 +75,7 @@ quit() { Send {ESC} global is_pre_spc = 0 + global is_pre_x = 0 Return } newline() @@ -147,6 +151,13 @@ kill_emacs() Return } +select_all() +{ + Send ^a + global is_pre_x = 0 + Return +} + move_beginning_of_line() { global @@ -165,6 +176,24 @@ move_end_of_line() Send {END} Return } +move_to_beginning() +{ + global + if is_pre_spc + Send +^{HOME} + Else + Send ^{HOME} + Return +} +move_to_end() +{ + global + if is_pre_spc + Send +^{END} + Else + Send ^{END} + Return +} previous_line() { global @@ -201,6 +230,25 @@ backward_char() Send {Left} Return } +forward_word() +{ + global + if is_pre_spc + Send +^{Right} + Else + Send ^{Right} + Return +} +backward_word() +{ + global + if is_pre_spc + Send +^{Left} + Else + Send ^{Left} + Return +} + scroll_up() { global @@ -338,17 +386,18 @@ scroll_down() Return ;$^{Space}:: -^vk20sc039:: - If is_target() - Send {CtrlDown}{Space}{CtrlUp} - Else - { - If is_pre_spc - is_pre_spc = 0 - Else - is_pre_spc = 1 - } - Return +; ^vk20sc039:: +; If is_target() +; Send {CtrlDown}{Space}{CtrlUp} +; Else +; { +; If is_pre_spc +; is_pre_spc = 0 +; Else +; is_pre_spc = 1 +; } +; Return + ^@:: If is_target() Send %A_ThisHotkey% @@ -402,4 +451,50 @@ scroll_down() Else scroll_up() Return - +!f:: + If is_target() + Send %A_ThisHotkey% + Else + forward_word() + Return +!b:: + If is_target() + Send %A_ThisHotkey% + Else + backward_word() + Return +!<:: + If is_target() + Send %A_ThisHotkey% + Else + move_to_beginning() + Return +!>:: + If is_target() + Send %A_ThisHotkey% + Else + move_to_end() + Return +h:: + If is_target() + Send %A_ThisHotkey% + Else + { + if is_pre_x + select_all() + Else + Send %A_ThisHotkey% + } + Return +<#c:: + kill_ring_save() + Return +<#x:: + kill_region() + Return +<#v:: + yank() + Return +<#a:: + select_all() + Return