From 7772c944a8c9597cedcced64a2e29beb3b66d49a Mon Sep 17 00:00:00 2001 From: rcmdnk Date: Mon, 14 Feb 2022 05:07:27 +0900 Subject: [PATCH] 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) --- README.md | 3 ++- lib/vim_ahk.ahk | 12 +++++++++--- lib/vim_setting.ahk | 8 ++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1758802a..8e11e3ad 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,8 @@ All of these can be changed from the setting menu, too. |VimCtrlBracketNormal|If 1, pushing Ctrl-[ sets the normal mode, while long press Ctrl-[ sends Ctrl-[.|1| |VimSendCtrlBracketNormal|If 1, short press Ctrl-[ send Ctrl-[ in the normal mode.|0| |VimLongCtrlBracketNormal|If 1, short press and long press of Ctrl-[ behaviors are swapped.|0| -|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| +|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| +|VimCheckChr|If 1, |0| |VimRestoreIME|If 1, IME status is restored at entering the insert mode.|1| |VimJJ|If 1, `jj` changes the mode to the normal mode from the insert mode.|0| |VimTwoLetterEsc|A list of character pairs to press together during the insert mode to get to the Normal mode.
For example, a value of `jf` means pressing `j` and `f` at the same time will enter the Normal mode.
Multiple combination can be set by separated by `,`. (e.g. `jf,jk,sd`)|| diff --git a/lib/vim_ahk.ahk b/lib/vim_ahk.ahk index f709c6a5..9a7a4cd8 100644 --- a/lib/vim_ahk.ahk +++ b/lib/vim_ahk.ahk @@ -20,8 +20,8 @@ class VimAhk{ __About(){ - this.About.Version := "v0.11.2" - this.About.Date := "11/Feb/2022" + this.About.Version := "v0.11.3" + this.About.Date := "14/Feb/2022" this.About.Author := "rcmdnk" this.About.Description := "Vim emulation with AutoHotkey, everywhere in Windows." this.About.Homepage := "https://github.com/rcmdnk/vim_ahk" @@ -107,6 +107,9 @@ class VimAhk{ this.AddToConf("VimChangeCaretWidth", 0, 0 , "Change to thick text caret when in normal mode" , "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.") + this.AddToConf("VimCheckChr", 0, 0 + , "Check the character before an action" + , "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).") this.AddToConf("VimRestoreIME", 1, 1 , "Restore IME status at entering the insert mode" , "Save the IME status in the insert mode, and restore it at entering the insert mode.") @@ -138,7 +141,7 @@ class VimAhk{ , "Application" , "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).") - this.CheckBoxes := ["VimEscNormal", "VimSendEscNormal", "VimLongEscNormal", "VimCtrlBracketToEsc", "VimCtrlBracketNormal", "VimSendCtrlBracketNormal", "VimLongCtrlBracketNormal", "VimRestoreIME", "VimJJ", "VimChangeCaretWidth"] + this.CheckBoxes := ["VimEscNormal", "VimSendEscNormal", "VimLongEscNormal", "VimCtrlBracketToEsc", "VimCtrlBracketNormal", "VimSendCtrlBracketNormal", "VimLongCtrlBracketNormal", "VimRestoreIME", "VimJJ", "VimChangeCaretWidth", "VimCheckChr"] ; ToolTip Information this.Info := {} @@ -276,6 +279,9 @@ class VimAhk{ ; Ref: https://www.reddit.com/r/AutoHotkey/comments/4ma5b8/identifying_end_of_line_when_typing_with_ahk_and/ CheckChr(key){ + if(this.Conf["VimCheckChr"]["val"] == 0){ + Return False + } BlockInput, Send tempClip := clipboard clipboard := "" diff --git a/lib/vim_setting.ahk b/lib/vim_setting.ahk index ee167de2..6f178ffb 100644 --- a/lib/vim_setting.ahk +++ b/lib/vim_setting.ahk @@ -5,7 +5,7 @@ class VimSetting Extends VimGui{ } MakeGui(){ - global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth + global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth, VimCheckChr global VimDisableUnused, VimSetTitleMatchMode, VimSetTitleMatchModeFS, VimIconCheckInterval, VimVerbose, VimAppList, VimGroup, VimGroupList, VimTwoLetterList global VimDisableUnusedText, VimSetTitleMatchModeText, VimIconCheckIntervalText, VimIconCheckIntervalEdit, VimVerboseText, VimAppListText, VimGroupText, VimHomepage, VimSettingOK, VimSettingReset, VimSettingCancel, VimTwoLetterText this.VimVal2V() @@ -92,7 +92,7 @@ class VimSetting Extends VimGui{ } UpdateGuiValue(){ - global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth + global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth, VimCheckChr global VimDisableUnused, VimSetTitleMatchMode, VimSetTitleMatchModeFS, VimIconCheckInterval, VimVerbose, VimAppList, VimGroup, VimGroupList, VimTwoLetter, VimTwoLetterList for i, k in this.Vim.Checkboxes { GuiControl, % this.Hwnd ":", % k, % %k% @@ -140,7 +140,7 @@ class VimSetting Extends VimGui{ } VimV2Conf(){ - global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth + global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth, VimCheckChr global VimDisableUnused, VimSetTitleMatchMode, VimSetTitleMatchModeFS, VimIconCheckInterval, VimVerbose, VimAppList, VimGroup, VimGroupList, VimTwoLetter, VimTwoLetterList VimGroup := this.VimParseList(VimGroupList) VimTwoLetter := this.VimParseList(VimTwoLetterList) @@ -167,7 +167,7 @@ class VimSetting Extends VimGui{ } VimConf2V(vd){ - global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth + global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth, VimCheckChr global VimDisableUnused, VimSetTitleMatchMode, VimSetTitleMatchModeFS, VimIconCheckInterval, VimVerbose, VimAppList, VimGroup, VimGroupList, VimTwoLetterList StringReplace, VimGroupList, % this.Vim.Conf["VimGroup"][vd], % this.Vim.GroupDel, `n, All StringReplace, VimTwoLetterList, % this.Vim.Conf["VimTwoLetter"][vd], % this.Vim.GroupDel, `n, All