Skip to content

Commit 0126253

Browse files
committed
feat: add new keybindings for Space and Enter in vim_move.ahk (#90)
feat: add VimNonEditor group to disable Enter mapping in the normal mode.
1 parent a7a70ab commit 0126253

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ If using a custom two-letter hotkey to enter the normal mode, the two letters mu
265265
|Ctrl-u/Ctrl-d| Go Up/Down 10 line.|
266266
|Ctrl-b/Ctrl-f| PageUp/PageDown.|
267267
|gg/G| Go to the top/bottom of the file|
268+
|Space| Right.|
269+
|Enter| Move to the beginning of the next line.|
270+
271+
Note: Enter works only for editor applications (for other than Explorer, Q-dir, it works as Enter even in the normal mode).
268272

269273
In addition, `Repeat` is also available for some commands.
270274

lib/bind/vim_move.ahk

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,12 @@ b::Vim.Move.Repeat("b")
4242
^f::Vim.Move.Repeat("^f")
4343
; G
4444
+g::Vim.Move.Move("+g")
45-
45+
; Space
46+
Space::Vim.Move.Repeat("l")
47+
#If Vim.IsVimGroup() and (Vim.State.StrIsInCurrentVimMode("Vim_")) and not WinActive("ahk_group VimNonEditor")
48+
; Enter
49+
Enter::
50+
Vim.Move.Repeat("j")
51+
Vim.Move.Move("^")
52+
Return
4653
#If

lib/bind/vim_normal.ahk

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ Return
3434
Vim.State.SetMode("Vim_Normal")
3535
Return
3636

37-
#If Vim.IsVimGroup() and (Vim.State.IsCurrentVimMode("Vim_Normal"))
38-
Space::Send, {Right}
39-
4037
; period
4138
.::Send, +^{Right}{BS}^v
4239

lib/vim_ahk.ahk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ class VimAhk{
5151

5252
DefaultGroup := this.SetDefaultActiveWindows()
5353

54+
; On following applications, Enter works as Enter at the normal mode.
55+
GroupAdd, VimNonEditor, ahk_exe explorer.exe ; Explorer
56+
GroupAdd, VimNonEditor, ahk_exe Explorer.exe ; Explorer, Explorer became also upper case, but lower case works for this
57+
GroupAdd, VimNonEditor, ahk_exe Q-Dir_x64.exe ; Q-dir
58+
GroupAdd, VimNonEditor, ahk_exe Q-Dir.exe ; Q-dir
59+
5460
; Following applications select the line break at Shift + End.
5561
GroupAdd, VimLBSelectGroup, ahk_exe POWERPNT.exe ; PowerPoint
5662
GroupAdd, VimLBSelectGroup, ahk_exe WINWORD.exe ; Word

0 commit comments

Comments
 (0)