diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/BreakUndoSequenceAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/BreakUndoSequenceAction.kt
index 66c17edb9..4226c20c3 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/BreakUndoSequenceAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/BreakUndoSequenceAction.kt
@@ -14,14 +14,18 @@ import com.maddyhome.idea.vim.api.ExecutionContext
 import com.maddyhome.idea.vim.api.VimEditor
 import com.maddyhome.idea.vim.api.injector
 import com.maddyhome.idea.vim.command.Command
+import com.maddyhome.idea.vim.command.CommandFlags
 import com.maddyhome.idea.vim.command.OperatorArguments
 import com.maddyhome.idea.vim.handler.VimActionHandler
+import com.maddyhome.idea.vim.helper.enumSetOf
 import com.maddyhome.idea.vim.undo.VimKeyBasedUndoService
 import com.maddyhome.idea.vim.undo.VimTimestampBasedUndoService
+import java.util.EnumSet
 
 @CommandOrMotion(keys = ["<C-G>u"], modes = [Mode.INSERT])
 class BreakUndoSequenceAction : VimActionHandler.SingleExecution() {
   override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
+  override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_UNDO_AWARE)
 
   override fun execute(
     editor: VimEditor,
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertAfterCursorAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertAfterCursorAction.kt
index 6fbcd7efc..c4f3ece75 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertAfterCursorAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertAfterCursorAction.kt
@@ -19,7 +19,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
 
 @CommandOrMotion(keys = ["a"], modes = [Mode.NORMAL])
 class InsertAfterCursorAction : ChangeEditorActionHandler.SingleExecution() {
-  override val type: Command.Type = Command.Type.INSERT
+  override val type: Command.Type = Command.Type.MODE_CHANGE
 
   override fun execute(
     editor: VimEditor,
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertAfterLineEndAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertAfterLineEndAction.kt
index 390735cf6..1fc6eafa4 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertAfterLineEndAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertAfterLineEndAction.kt
@@ -19,7 +19,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
 
 @CommandOrMotion(keys = ["A"], modes = [Mode.NORMAL])
 class InsertAfterLineEndAction : ChangeEditorActionHandler.SingleExecution() {
-  override val type: Command.Type = Command.Type.INSERT
+  override val type: Command.Type = Command.Type.MODE_CHANGE
 
   override fun execute(
     editor: VimEditor,
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertBeforeCursorAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertBeforeCursorAction.kt
index c03531056..312a26a46 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertBeforeCursorAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertBeforeCursorAction.kt
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Contract
 @CommandOrMotion(keys = ["i", "<Insert>"], modes = [Mode.NORMAL])
 class InsertBeforeCursorAction : ChangeEditorActionHandler.SingleExecution() {
   @get:Contract(pure = true)
-  override val type: Command.Type = Command.Type.INSERT
+  override val type: Command.Type = Command.Type.MODE_CHANGE
 
   override fun execute(
     editor: VimEditor,
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertBeforeFirstNonBlankAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertBeforeFirstNonBlankAction.kt
index 4edad387f..63bc2d5af 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertBeforeFirstNonBlankAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/insert/InsertBeforeFirstNonBlankAction.kt
@@ -19,7 +19,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
 
 @CommandOrMotion(keys = ["I"], modes = [Mode.NORMAL])
 class InsertBeforeFirstNonBlankAction : ChangeEditorActionHandler.SingleExecution() {
-  override val type: Command.Type = Command.Type.INSERT
+  override val type: Command.Type = Command.Type.MODE_CHANGE
 
   override fun execute(
     editor: VimEditor,
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/ExEntryAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/ExEntryAction.kt
index 5a7ef42c9..c02738a2f 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/ExEntryAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/ExEntryAction.kt
@@ -22,7 +22,7 @@ import java.util.*
 @CommandOrMotion(keys = [":"], modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING])
 class ExEntryAction : VimActionHandler.SingleExecution() {
   override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_START_EX)
-  override val type: Command.Type = Command.Type.OTHER_READONLY
+  override val type: Command.Type = Command.Type.MODE_CHANGE
 
   override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
     if (editor.isOneLineMode()) return false
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/LeaveCommandLineAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/LeaveCommandLineAction.kt
index a734410a5..2493fd5ed 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/LeaveCommandLineAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/LeaveCommandLineAction.kt
@@ -25,7 +25,7 @@ import java.util.*
 @CommandOrMotion(keys = ["<Esc>", "<C-[>", "<C-C>"], modes = [Mode.CMD_LINE])
 class LeaveCommandLineAction : VimActionHandler.SingleExecution() {
   override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_END_EX)
-  override val type: Command.Type = Command.Type.OTHER_READONLY
+  override val type: Command.Type = Command.Type.MODE_CHANGE
 
   override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
     val argument = cmd.argument as? Argument.ExString ?: return true
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/ToggleInsertModeAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/ToggleInsertModeAction.kt
index f9f535476..e31b31ee0 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/ToggleInsertModeAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/ToggleInsertModeAction.kt
@@ -14,12 +14,16 @@ import com.maddyhome.idea.vim.api.ExecutionContext
 import com.maddyhome.idea.vim.api.VimEditor
 import com.maddyhome.idea.vim.api.injector
 import com.maddyhome.idea.vim.command.Command
+import com.maddyhome.idea.vim.command.CommandFlags
 import com.maddyhome.idea.vim.command.OperatorArguments
 import com.maddyhome.idea.vim.handler.VimActionHandler
+import com.maddyhome.idea.vim.helper.enumSetOf
+import java.util.EnumSet
 
 @CommandOrMotion(keys = ["<Insert>"], modes = [Mode.CMD_LINE])
 class ToggleInsertModeAction : VimActionHandler.SingleExecution() {
   override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
+  override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_UNDO_AWARE)
 
   override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
     val commandLine = injector.commandLine.getActiveCommandLine() ?: return false
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/search/SearchEntryActions.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/search/SearchEntryActions.kt
index ddc1962f5..a8d82e6a8 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/search/SearchEntryActions.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/search/SearchEntryActions.kt
@@ -21,7 +21,7 @@ import java.util.*
 
 @CommandOrMotion(keys = ["/"], modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING])
 class SearchEntryFwdAction : VimActionHandler.SingleExecution() {
-  override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
+  override val type: Command.Type = Command.Type.MODE_CHANGE
   override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_START_EX, CommandFlags.FLAG_SAVE_JUMP)
 
   override fun execute( editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
@@ -32,7 +32,7 @@ class SearchEntryFwdAction : VimActionHandler.SingleExecution() {
 
 @CommandOrMotion(keys = ["?"], modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING])
 class SearchEntryRevAction : VimActionHandler.SingleExecution() {
-  override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
+  override val type: Command.Type = Command.Type.MODE_CHANGE
   override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_START_EX, CommandFlags.FLAG_SAVE_JUMP)
 
   override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/visual/VisualExitModeAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/visual/VisualExitModeAction.kt
index 31c79a6b3..131aa9d43 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/visual/VisualExitModeAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/visual/VisualExitModeAction.kt
@@ -25,7 +25,7 @@ import com.maddyhome.idea.vim.helper.exitVisualMode
  */
 @CommandOrMotion(keys = ["<Esc>", "<C-[>", "<C-C>"], modes = [Mode.VISUAL])
 class VisualExitModeAction : VimActionHandler.ConditionalMulticaret() {
-  override val type: Command.Type = Command.Type.OTHER_READONLY
+  override val type: Command.Type = Command.Type.MODE_CHANGE
   override fun runAsMulticaret(
     editor: VimEditor,
     context: ExecutionContext,
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/visual/VisualToggleBlockModeAction.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/visual/VisualToggleBlockModeAction.kt
index 3e618f470..f468acf27 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/visual/VisualToggleBlockModeAction.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/visual/VisualToggleBlockModeAction.kt
@@ -21,7 +21,7 @@ import com.maddyhome.idea.vim.options.OptionConstants
 
 @CommandOrMotion(keys = ["<C-q>", "<C-v>"], modes = [Mode.NORMAL, Mode.VISUAL])
 class VisualToggleBlockModeAction : VimActionHandler.SingleExecution() {
-  override val type: Command.Type = Command.Type.OTHER_READONLY
+  override val type: Command.Type = Command.Type.MODE_CHANGE
 
   override fun execute(
     editor: VimEditor,
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command/Command.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command/Command.kt
index 652fca7af..ca13d2539 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command/Command.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command/Command.kt
@@ -93,11 +93,12 @@ data class Command(
      */
     OTHER_SELF_SYNCHRONIZED,
 
+    MODE_CHANGE,
     ;
 
     val isRead: Boolean
       get() = when (this) {
-        MOTION, COPY, OTHER_READONLY -> true
+        MOTION, COPY, OTHER_READONLY, MODE_CHANGE -> true
         else -> false
       }
 
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/handler/EditorActionHandlerBase.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/handler/EditorActionHandlerBase.kt
index 651f905fb..40bda6a73 100644
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/handler/EditorActionHandlerBase.kt
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/handler/EditorActionHandlerBase.kt
@@ -146,7 +146,7 @@ abstract class EditorActionHandlerBase(private val myRunForEachCaret: Boolean) {
     if (editor.mode == Mode.INSERT) return // typing handles undo on its own
     if (command.flags.contains(CommandFlags.FLAG_UNDO_AWARE)) return
     
-    if (command.type == Command.Type.MOTION) {
+    if (command.type == Command.Type.MOTION || command.type == Command.Type.MODE_CHANGE) {
       undo.setMergeUndoKey()
     } else {
       undo.updateNonMergeUndoKey()