From 447380000f384dfe544a20d80e0df3286aac271b Mon Sep 17 00:00:00 2001 From: rcmdnk Date: Sun, 30 Jul 2023 03:51:07 +0000 Subject: [PATCH] feat: Remove VimCheckChr from the configuration (always enable CheckChr) feat: move end of the word correctly even if the cursor is in the word by `e` in normal mode --- README.md | 1 - lib/vim_ahk.ahk | 8 +------- lib/vim_move.ahk | 10 ++++++++-- lib/vim_setting.ahk | 8 ++++---- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b635a049..5480c9f4 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,6 @@ All of these can be changed from the setting menu, too. |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, 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 82189518..53deebf2 100644 --- a/lib/vim_ahk.ahk +++ b/lib/vim_ahk.ahk @@ -108,9 +108,6 @@ 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.") @@ -142,7 +139,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", "VimCheckChr"] + this.CheckBoxes := ["VimEscNormal", "VimSendEscNormal", "VimLongEscNormal", "VimCtrlBracketToEsc", "VimCtrlBracketNormal", "VimSendCtrlBracketNormal", "VimLongCtrlBracketNormal", "VimRestoreIME", "VimJJ", "VimChangeCaretWidth"] ; ToolTip Information this.Info := {} @@ -280,9 +277,6 @@ 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_move.ahk b/lib/vim_move.ahk index c1712a30..c0c5ba1d 100644 --- a/lib/vim_move.ahk +++ b/lib/vim_move.ahk @@ -158,9 +158,15 @@ } }else if(key == "e"){ if(this.shift == 1){ - Send, +^{Right}+^{Right}+{Left} + if(this.Vim.CheckChr(" ")){ + Send, +^{Right} + } + Send, +^{Right}+{Left} }else{ - Send, ^{Right}^{Right}{Left} + if(this.Vim.CheckChr(" ")){ + Send, ^{Right} + } + Send, ^{Right}{Left} } }else if(key == "b"){ if(this.shift == 1){ diff --git a/lib/vim_setting.ahk b/lib/vim_setting.ahk index 6f178ffb..ee167de2 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, VimCheckChr + global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth 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, VimCheckChr + global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth 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, VimCheckChr + global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth 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, VimCheckChr + global VimRestoreIME, VimJJ, VimEscNormal, VimSendEscNormal, VimLongEscNormal, VimCtrlBracketToEsc, VimCtrlBracketNormal, VimSendCtrlBracketNormal, VimLongCtrlBracketNormal, VimChangeCaretWidth 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