Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keybindings: M-f M-b C-< C-> #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ This script is written in AutoHotkey (AHK) and has been maintained since Sep 21,
<td>kill-emacs</td>
</tr>
<tr>
<td>C-x h</td>
<td>select-all</td>
</tr>
<tr>
<td>C-d</td>
<td>delete-char</td>
</tr>
Expand Down Expand Up @@ -110,13 +114,47 @@ This script is written in AutoHotkey (AHK) and has been maintained since Sep 21,
<td>backward-char</td>
</tr>
<tr>
<td>M-f</td>
<td>forward-word</td>
</tr>
<tr>
<td>M-b</td>
<td>backward-word</td>
</tr>
<tr>
<td>C-v</td>
<td>scroll-down</td>
</tr>
<tr>
<td>M-v</td>
<td>scroll-up</td>
</tr>
<tr>
<td>M-<</td>
<td>goto home</td>
</tr>
<tr>
<td>M-></td>
<td>goto end</td>
</tr>


<tr>
<td>W-c</td>
<td>copy</td>
</tr>
<tr>
<td>W-x</td>
<td>cut</td>
</tr>
<tr>
<td>W-v</td>
<td>paste</td>
</tr>
<tr>
<td>W-a</td>
<td>select-all</td>
</tr>
</table>


Expand Down
143 changes: 119 additions & 24 deletions emacs.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -72,6 +75,7 @@ quit()
{
Send {ESC}
global is_pre_spc = 0
global is_pre_x = 0
Return
}
newline()
Expand Down Expand Up @@ -147,6 +151,13 @@ kill_emacs()
Return
}

select_all()
{
Send ^a
global is_pre_x = 0
Return
}

move_beginning_of_line()
{
global
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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%
Expand Down Expand Up @@ -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