Skip to content

Commit 972abc5

Browse files
committed
fix a (enter insert mode), to keep the line at the end of the line
1 parent 7677a5e commit 972abc5

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

lib/bind/vim_enter_insert.ahk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ i::Vim.State.SetMode("Insert")
77
Return
88

99
a::
10-
Send, {Right}
10+
if(Vim.CheckChr("`n")){
11+
Send, {Left}
12+
}else{
13+
Send, {Right}
14+
}
1115
Vim.State.SetMode("Insert")
1216
Return
1317

lib/vim_ahk.ahk

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
class VimAhk{
2222
__About(){
23-
this.About.Version := "v0.11.0"
24-
this.About.Date := "24/Jan/2022"
23+
this.About.Version := "v0.11.1"
24+
this.About.Date := "11/Feb/2022"
2525
this.About.Author := "rcmdnk"
2626
this.About.Description := "Vim emulation with AutoHotkey, everywhere in Windows."
2727
this.About.Homepage := "https://github.com/rcmdnk/vim_ahk"
@@ -252,7 +252,7 @@ class VimAhk{
252252
, "ahk_exe Q-Dir.exe"] ; Q-dir
253253

254254
DefaultGroup := ""
255-
For i, v in DefaultList
255+
for i, v in DefaultList
256256
{
257257
if(DefaultGroup == ""){
258258
DefaultGroup := v
@@ -273,4 +273,21 @@ class VimAhk{
273273
}
274274
Return True
275275
}
276+
277+
; Ref: https://www.reddit.com/r/AutoHotkey/comments/4ma5b8/identifying_end_of_line_when_typing_with_ahk_and/
278+
CheckChr(key){
279+
BlockInput, Send
280+
tempClip := clipboard
281+
clipboard := ""
282+
SendInput {Shift Down}{Right}{Shift up}{Ctrl down}c{Ctrl Up}{Left}
283+
Sleep 10
284+
ret := False
285+
If (clipboard ~= key){
286+
ret := True
287+
}
288+
sleep 10
289+
clipboard := tempClip
290+
BlockInput, off
291+
Return ret
292+
}
276293
}

0 commit comments

Comments
 (0)