Skip to content

Commit

Permalink
feat: Remove VimCheckChr from the configuration (always enable CheckChr)
Browse files Browse the repository at this point in the history
feat: move end of the word correctly even if the cursor is in the word by `e` in normal mode
  • Loading branch information
rcmdnk committed Jul 30, 2023
1 parent c00d300 commit 4473800
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<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`)||
Expand Down
8 changes: 1 addition & 7 deletions lib/vim_ahk.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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 := {}
Expand Down Expand Up @@ -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 := ""
Expand Down
10 changes: 8 additions & 2 deletions lib/vim_move.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
8 changes: 4 additions & 4 deletions lib/vim_setting.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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%
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 4473800

Please sign in to comment.