Skip to content

Commit 7772c94

Browse files
committed
add VimCheckChr option: default 0, 1 to enable CheckChr function (for a to check it the cursor is located at the end of the line)
1 parent 98759b8 commit 7772c94

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ All of these can be changed from the setting menu, too.
134134
|VimCtrlBracketNormal|If 1, pushing Ctrl-[ sets the normal mode, while long press Ctrl-[ sends Ctrl-[.|1|
135135
|VimSendCtrlBracketNormal|If 1, short press Ctrl-[ send Ctrl-[ in the normal mode.|0|
136136
|VimLongCtrlBracketNormal|If 1, short press and long press of Ctrl-[ behaviors are swapped.|0|
137-
|VimChangeCaretWidth|If 1, when entering normal mode, sets the text cursor/caret to a thick bar, then sets back to thin when exiting normal mode.|0|
137+
|VimChangeCaretWidth|If 1, check the character under the cursor before an action. Currently this is used for: `a` in the normal mode (check if the cursor is located at the end of the line).|0|
138+
|VimCheckChr|If 1, |0|
138139
|VimRestoreIME|If 1, IME status is restored at entering the insert mode.|1|
139140
|VimJJ|If 1, `jj` changes the mode to the normal mode from the insert mode.|0|
140141
|VimTwoLetterEsc|A list of character pairs to press together during the insert mode to get to the Normal mode.<br>For example, a value of `jf` means pressing `j` and `f` at the same time will enter the Normal mode.<br>Multiple combination can be set by separated by `,`. (e.g. `jf,jk,sd`)||

lib/vim_ahk.ahk

Lines changed: 9 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.2"
24-
this.About.Date := "11/Feb/2022"
23+
this.About.Version := "v0.11.3"
24+
this.About.Date := "14/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"
@@ -107,6 +107,9 @@ class VimAhk{
107107
this.AddToConf("VimChangeCaretWidth", 0, 0
108108
, "Change to thick text caret when in normal mode"
109109
, "When entering normal mode, sets the text cursor/caret to a thick bar, then sets back to thin when exiting normal mode.`nDoesn't work with all windows, and causes the current window to briefly lose focus when changing mode.")
110+
this.AddToConf("VimCheckChr", 0, 0
111+
, "Check the character before an action"
112+
, "Check the character under the cursor before an action.`nCurrently, this is used for: 'a' in the normal mode (check if the cursor is located the end of the line).")
110113
this.AddToConf("VimRestoreIME", 1, 1
111114
, "Restore IME status at entering the insert mode"
112115
, "Save the IME status in the insert mode, and restore it at entering the insert mode.")
@@ -138,7 +141,7 @@ class VimAhk{
138141
, "Application"
139142
, "Set one application per line.`n`nIt can be any of Window Title, Class or Process.`nYou can check these values by Window Spy (in the right click menu of tray icon).")
140143

141-
this.CheckBoxes := ["VimEscNormal", "VimSendEscNormal", "VimLongEscNormal", "VimCtrlBracketToEsc", "VimCtrlBracketNormal", "VimSendCtrlBracketNormal", "VimLongCtrlBracketNormal", "VimRestoreIME", "VimJJ", "VimChangeCaretWidth"]
144+
this.CheckBoxes := ["VimEscNormal", "VimSendEscNormal", "VimLongEscNormal", "VimCtrlBracketToEsc", "VimCtrlBracketNormal", "VimSendCtrlBracketNormal", "VimLongCtrlBracketNormal", "VimRestoreIME", "VimJJ", "VimChangeCaretWidth", "VimCheckChr"]
142145

143146
; ToolTip Information
144147
this.Info := {}
@@ -276,6 +279,9 @@ class VimAhk{
276279

277280
; Ref: https://www.reddit.com/r/AutoHotkey/comments/4ma5b8/identifying_end_of_line_when_typing_with_ahk_and/
278281
CheckChr(key){
282+
if(this.Conf["VimCheckChr"]["val"] == 0){
283+
Return False
284+
}
279285
BlockInput, Send
280286
tempClip := clipboard
281287
clipboard := ""

lib/vim_setting.ahk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class VimSetting Extends VimGui{
55
}
66

77
MakeGui(){
8-
global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth
8+
global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth, VimCheckChr
99
global VimDisableUnused, VimSetTitleMatchMode, VimSetTitleMatchModeFS, VimIconCheckInterval, VimVerbose, VimAppList, VimGroup, VimGroupList, VimTwoLetterList
1010
global VimDisableUnusedText, VimSetTitleMatchModeText, VimIconCheckIntervalText, VimIconCheckIntervalEdit, VimVerboseText, VimAppListText, VimGroupText, VimHomepage, VimSettingOK, VimSettingReset, VimSettingCancel, VimTwoLetterText
1111
this.VimVal2V()
@@ -92,7 +92,7 @@ class VimSetting Extends VimGui{
9292
}
9393

9494
UpdateGuiValue(){
95-
global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth
95+
global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth, VimCheckChr
9696
global VimDisableUnused, VimSetTitleMatchMode, VimSetTitleMatchModeFS, VimIconCheckInterval, VimVerbose, VimAppList, VimGroup, VimGroupList, VimTwoLetter, VimTwoLetterList
9797
for i, k in this.Vim.Checkboxes {
9898
GuiControl, % this.Hwnd ":", % k, % %k%
@@ -140,7 +140,7 @@ class VimSetting Extends VimGui{
140140
}
141141

142142
VimV2Conf(){
143-
global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth
143+
global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth, VimCheckChr
144144
global VimDisableUnused, VimSetTitleMatchMode, VimSetTitleMatchModeFS, VimIconCheckInterval, VimVerbose, VimAppList, VimGroup, VimGroupList, VimTwoLetter, VimTwoLetterList
145145
VimGroup := this.VimParseList(VimGroupList)
146146
VimTwoLetter := this.VimParseList(VimTwoLetterList)
@@ -167,7 +167,7 @@ class VimSetting Extends VimGui{
167167
}
168168

169169
VimConf2V(vd){
170-
global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth
170+
global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth, VimCheckChr
171171
global VimDisableUnused, VimSetTitleMatchMode, VimSetTitleMatchModeFS, VimIconCheckInterval, VimVerbose, VimAppList, VimGroup, VimGroupList, VimTwoLetterList
172172
StringReplace, VimGroupList, % this.Vim.Conf["VimGroup"][vd], % this.Vim.GroupDel, `n, All
173173
StringReplace, VimTwoLetterList, % this.Vim.Conf["VimTwoLetter"][vd], % this.Vim.GroupDel, `n, All

0 commit comments

Comments
 (0)