Skip to content

Commit 9513461

Browse files
committed
Fix caret move (swap shift/non-shift)
rename Home()->Zero() (it is to move at the real first charecter of the line, instead of non-space first character) Remove NotePad from VimCaretMove, it does not work at Windows 11
1 parent 058e183 commit 9513461

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

lib/vim_ahk.ahk

Lines changed: 5 additions & 4 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.3"
24-
this.About.Date := "14/Feb/2022"
23+
this.About.Version := "v0.11.5"
24+
this.About.Date := "16/Sep/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"
@@ -66,8 +66,9 @@ class VimAhk{
6666
GroupAdd, VimDoubleHomeGroup, ahk_exe Code.exe ; Visual Studio Code
6767

6868
; Followings can emulate ^. For others, ^ works as same as 0
69-
GroupAdd, VimCaretMove, ahk_exe notepad.exe ; NotePad
70-
GroupAdd, VimCaretMove, ahk_exe Notepad.exe ; NotePad
69+
; It does not work for NotePad at Windows 11
70+
; GroupAdd, VimCaretMove, ahk_exe notepad.exe ; NotePad
71+
; GroupAdd, VimCaretMove, ahk_exe Notepad.exe ; NotePad
7172

7273
; Followings start cursor from the same place after selection.
7374
; Others start right/left (by cursor) point of the selection

lib/vim_move.ahk

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
if(this.Vim.State.IsCurrentVimMode("Vim_VisualLineFirst")) and (key == "k" or key == "^u" or key == "^b" or key == "g"){
1515
Send, {Shift Up}{End}
16-
this.Home()
16+
this.Zero()
1717
Send, {Shift Down}
1818
this.Up()
1919
this.vim.state.setmode("Vim_VisualLine")
@@ -26,15 +26,15 @@
2626
if(this.Vim.State.StrIsInCurrentVimMode("Vim_ydc")) and (key == "k" or key == "^u" or key == "^b" or key == "g"){
2727
this.Vim.State.LineCopy := 1
2828
Send,{Shift Up}
29-
this.Home()
29+
this.Zero()
3030
this.Down()
3131
Send, {Shift Down}
3232
this.Up()
3333
}
3434
if(this.Vim.State.StrIsInCurrentVimMode("Vim_ydc")) and (key == "j" or key == "^d" or key == "^f" or key == "+g"){
3535
this.Vim.State.LineCopy := 1
3636
Send,{Shift Up}
37-
this.Home()
37+
this.Zero()
3838
Send, {Shift Down}
3939
this.Down()
4040
}
@@ -69,7 +69,7 @@
6969
send {Ctrl Up}
7070
}
7171

72-
Home(){
72+
Zero(){
7373
if WinActive("ahk_group VimDoubleHomeGroup"){
7474
Send, {Home}
7575
}
@@ -124,7 +124,7 @@
124124
}
125125
; Home/End
126126
}else if(key == "0"){
127-
this.Home()
127+
this.Zero()
128128
}else if(key == "$"){
129129
if(this.shift == 1){
130130
Send, +{End}
@@ -133,21 +133,21 @@
133133
}
134134
}else if(key == "^"){
135135
if(this.shift == 1){
136-
if WinActive("ahk_group VimCaretMove"){
137-
this.Home()
138-
Send, ^{Right}
139-
Send, ^{Left}
140-
}else{
141-
this.Home()
142-
}
143-
}else{
144136
if WinActive("ahk_group VimCaretMove"){
145137
Send, +{Home}
146138
Send, +^{Right}
147139
Send, +^{Left}
148140
}else{
149141
Send, +{Home}
150142
}
143+
}else{
144+
if WinActive("ahk_group VimCaretMove"){
145+
Send, {Home}
146+
Send, ^{Right}
147+
Send, ^{Left}
148+
}else{
149+
Send, {Home}
150+
}
151151
}
152152
; Words
153153
}else if(key == "w"){
@@ -209,7 +209,7 @@
209209

210210
YDCMove(){
211211
this.Vim.State.LineCopy := 1
212-
this.Home()
212+
this.Zero()
213213
Send, {Shift Down}
214214
if(this.Vim.State.n == 0){
215215
this.Vim.State.n := 1

0 commit comments

Comments
 (0)