diff --git a/src/main/java/com/maddyhome/idea/vim/KeyHandler.kt b/src/main/java/com/maddyhome/idea/vim/KeyHandler.kt
index 51bd2c628..6d7020d36 100644
--- a/src/main/java/com/maddyhome/idea/vim/KeyHandler.kt
+++ b/src/main/java/com/maddyhome/idea/vim/KeyHandler.kt
@@ -607,7 +607,7 @@ class KeyHandler {
         return true
       }
     }
-    val res = editorState.processDigraphKey(key, editor.ij)
+    val res = editorState.processDigraphKey(key, editor)
     if (ExEntryPanel.getInstance().isActive) {
       when (res.result) {
         DigraphResult.RES_HANDLED -> setPromptCharacterEx(if (commandBuilder.isPuttingLiteral()) '^' else key.keyChar)
diff --git a/src/main/java/com/maddyhome/idea/vim/action/change/OperatorAction.kt b/src/main/java/com/maddyhome/idea/vim/action/change/OperatorAction.kt
index dbc4c99da..b9cb44686 100644
--- a/src/main/java/com/maddyhome/idea/vim/action/change/OperatorAction.kt
+++ b/src/main/java/com/maddyhome/idea/vim/action/change/OperatorAction.kt
@@ -44,7 +44,7 @@ class OperatorAction : VimActionHandler.SingleExecution() {
     if (operatorFunction != null) {
       val argument = cmd.argument
       if (argument != null) {
-        if (!editor.commandState.isDotRepeatInProgress) {
+        if (!editor.vim.commandState.isDotRepeatInProgress) {
           VimRepeater.Extension.argumentCaptured = argument
         }
         val saveRepeatHandler = VimRepeater.repeatHandler
diff --git a/src/main/java/com/maddyhome/idea/vim/action/change/RepeatChangeAction.kt b/src/main/java/com/maddyhome/idea/vim/action/change/RepeatChangeAction.kt
index dc8b4420b..8c435d020 100644
--- a/src/main/java/com/maddyhome/idea/vim/action/change/RepeatChangeAction.kt
+++ b/src/main/java/com/maddyhome/idea/vim/action/change/RepeatChangeAction.kt
@@ -35,7 +35,7 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
   override val type: Command.Type = Command.Type.OTHER_WRITABLE
 
   override fun execute(editor: Editor, context: DataContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
-    val state = editor.commandState
+    val state = editor.vim.commandState
     val lastCommand = VimRepeater.lastChangeCommand
 
     if (lastCommand == null && VimRepeater.Extension.lastExtensionHandler == null) return false
diff --git a/src/main/java/com/maddyhome/idea/vim/action/macro/ToggleRecordingAction.kt b/src/main/java/com/maddyhome/idea/vim/action/macro/ToggleRecordingAction.kt
index 0c0220fb4..defb04345 100644
--- a/src/main/java/com/maddyhome/idea/vim/action/macro/ToggleRecordingAction.kt
+++ b/src/main/java/com/maddyhome/idea/vim/action/macro/ToggleRecordingAction.kt
@@ -25,6 +25,7 @@ import com.maddyhome.idea.vim.command.Command
 import com.maddyhome.idea.vim.command.OperatorArguments
 import com.maddyhome.idea.vim.handler.VimActionHandler
 import com.maddyhome.idea.vim.helper.commandState
+import com.maddyhome.idea.vim.newapi.vim
 
 class ToggleRecordingAction : VimActionHandler.SingleExecution() {
   override val type: Command.Type = Command.Type.OTHER_READONLY
@@ -32,7 +33,7 @@ class ToggleRecordingAction : VimActionHandler.SingleExecution() {
   override val argumentType: Argument.Type = Argument.Type.CHARACTER
 
   override fun execute(editor: Editor, context: DataContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
-    return if (!editor.commandState.isRecording) {
+    return if (!editor.vim.commandState.isRecording) {
       val argument = cmd.argument ?: return false
       val reg = argument.character
       VimPlugin.getRegister().startRecording(editor, reg)
diff --git a/src/main/java/com/maddyhome/idea/vim/action/motion/select/SelectToggleVisualMode.kt b/src/main/java/com/maddyhome/idea/vim/action/motion/select/SelectToggleVisualMode.kt
index a8f5090eb..4954d5cdc 100644
--- a/src/main/java/com/maddyhome/idea/vim/action/motion/select/SelectToggleVisualMode.kt
+++ b/src/main/java/com/maddyhome/idea/vim/action/motion/select/SelectToggleVisualMode.kt
@@ -30,6 +30,7 @@ import com.maddyhome.idea.vim.helper.inVisualMode
 import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
 import com.maddyhome.idea.vim.helper.pushSelectMode
 import com.maddyhome.idea.vim.helper.pushVisualMode
+import com.maddyhome.idea.vim.newapi.vim
 
 /**
  * @author Alex Plate
@@ -46,7 +47,7 @@ class SelectToggleVisualMode : VimActionHandler.SingleExecution() {
 
   companion object {
     fun toggleMode(editor: Editor) {
-      val commandState = editor.commandState
+      val commandState = editor.vim.commandState
       val subMode = commandState.subMode
       val mode = commandState.mode
       commandState.popModes()
diff --git a/src/main/java/com/maddyhome/idea/vim/command/CommandState.kt b/src/main/java/com/maddyhome/idea/vim/command/CommandState.kt
index b8fa1464b..9ba9afe51 100644
--- a/src/main/java/com/maddyhome/idea/vim/command/CommandState.kt
+++ b/src/main/java/com/maddyhome/idea/vim/command/CommandState.kt
@@ -17,9 +17,6 @@
  */
 package com.maddyhome.idea.vim.command
 
-import com.intellij.openapi.diagnostic.Logger
-import com.intellij.openapi.diagnostic.debug
-import com.intellij.openapi.editor.Editor
 import com.maddyhome.idea.vim.VimPlugin
 import com.maddyhome.idea.vim.handler.ActionBeanClass
 import com.maddyhome.idea.vim.helper.DigraphResult
@@ -32,8 +29,10 @@ import com.maddyhome.idea.vim.helper.updateCaretsVisualAttributes
 import com.maddyhome.idea.vim.helper.updateCaretsVisualPosition
 import com.maddyhome.idea.vim.helper.vimCommandState
 import com.maddyhome.idea.vim.key.CommandPartNode
-import com.maddyhome.idea.vim.newapi.IjVimEditor
 import com.maddyhome.idea.vim.newapi.VimEditor
+import com.maddyhome.idea.vim.newapi.debug
+import com.maddyhome.idea.vim.newapi.ij
+import com.maddyhome.idea.vim.vimLogger
 import com.maddyhome.idea.vim.vimscript.services.OptionConstants
 import com.maddyhome.idea.vim.vimscript.services.OptionService
 import org.jetbrains.annotations.Contract
@@ -43,7 +42,7 @@ import javax.swing.KeyStroke
 /**
  * Used to maintain state before and while entering a Vim command (operator, motion, text object, etc.)
  */
-class CommandState private constructor(private val editor: Editor?) {
+class CommandState private constructor(private val editor: VimEditor?) {
   val commandBuilder = CommandBuilder(getKeyRootNode(MappingMode.NORMAL))
   private val modeStates = Stack<ModeState>()
   val mappingState = MappingState()
@@ -140,8 +139,8 @@ class CommandState private constructor(private val editor: Editor?) {
 
   private fun onModeChanged() {
     if (editor != null) {
-      editor.updateCaretsVisualAttributes()
-      editor.updateCaretsVisualPosition()
+      editor.ij.updateCaretsVisualAttributes()
+      editor.ij.updateCaretsVisualPosition()
     } else {
       localEditors().forEach { editor ->
         editor.updateCaretsVisualAttributes()
@@ -189,7 +188,7 @@ class CommandState private constructor(private val editor: Editor?) {
     digraphSequence.startLiteralSequence()
   }
 
-  fun processDigraphKey(key: KeyStroke, editor: Editor): DigraphResult {
+  fun processDigraphKey(key: KeyStroke, editor: VimEditor): DigraphResult {
     return digraphSequence.processKey(key, editor)
   }
 
@@ -386,33 +385,24 @@ class CommandState private constructor(private val editor: Editor?) {
   }
 
   companion object {
-    private val logger = Logger.getInstance(CommandState::class.java.name)
+    private val logger = vimLogger<CommandState>()
     private val defaultModeState = ModeState(Mode.COMMAND, SubMode.NONE)
     private val globalState = CommandState(null)
 
     @JvmStatic
-    fun getInstance(editor: Editor?): CommandState {
+    fun getInstance(editor: VimEditor?): CommandState {
       return if (editor == null || VimPlugin.getOptionService().isSet(OptionService.Scope.GLOBAL, OptionConstants.ideaglobalmodeName)) {
         globalState
       } else {
-        var res = editor.vimCommandState
+        var res = editor.ij.vimCommandState
         if (res == null) {
           res = CommandState(editor)
-          editor.vimCommandState = res
+          editor.ij.vimCommandState = res
         }
         res
       }
     }
 
-    @JvmStatic
-    fun getInstance(editor: VimEditor): CommandState {
-      return if (editor is IjVimEditor) {
-        getInstance(editor.editor)
-      } else {
-        getInstance(null)
-      }
-    }
-
     private fun getKeyRootNode(mappingMode: MappingMode): CommandPartNode<ActionBeanClass> {
       return VimPlugin.getKey().getKeyRoot(mappingMode)
     }
diff --git a/src/main/java/com/maddyhome/idea/vim/extension/VimExtensionFacade.kt b/src/main/java/com/maddyhome/idea/vim/extension/VimExtensionFacade.kt
index cbf08a361..ec97c89fe 100644
--- a/src/main/java/com/maddyhome/idea/vim/extension/VimExtensionFacade.kt
+++ b/src/main/java/com/maddyhome/idea/vim/extension/VimExtensionFacade.kt
@@ -103,7 +103,7 @@ object VimExtensionFacade {
   /** Returns a single key stroke from the user input similar to 'getchar()'. */
   @JvmStatic
   fun inputKeyStroke(editor: Editor): KeyStroke {
-    if (editor.commandState.isDotRepeatInProgress) {
+    if (editor.vim.commandState.isDotRepeatInProgress) {
       val input = VimRepeater.Extension.consumeKeystroke()
       return input ?: error("Not enough keystrokes saved: ${VimRepeater.Extension.lastExtensionHandler}")
     }
diff --git a/src/main/java/com/maddyhome/idea/vim/extension/argtextobj/VimArgTextObjExtension.java b/src/main/java/com/maddyhome/idea/vim/extension/argtextobj/VimArgTextObjExtension.java
index 9ac77ef29..c752d0071 100644
--- a/src/main/java/com/maddyhome/idea/vim/extension/argtextobj/VimArgTextObjExtension.java
+++ b/src/main/java/com/maddyhome/idea/vim/extension/argtextobj/VimArgTextObjExtension.java
@@ -33,6 +33,7 @@ import com.maddyhome.idea.vim.helper.MessageHelper;
 import com.maddyhome.idea.vim.helper.VimNlsSafe;
 import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor;
 import com.maddyhome.idea.vim.listener.VimListenerSuppressor;
+import com.maddyhome.idea.vim.newapi.IjVimEditor;
 import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString;
 import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NotNull;
@@ -252,7 +253,7 @@ public class VimArgTextObjExtension implements VimExtension {
     @Override
     public void execute(@NotNull Editor editor, @NotNull DataContext context) {
 
-      @NotNull CommandState commandState = CommandState.getInstance(editor);
+      @NotNull CommandState commandState = CommandState.getInstance(new IjVimEditor(editor));
       int count = Math.max(1, commandState.getCommandBuilder().getCount());
 
       final ArgumentTextObjectHandler textObjectHandler = new ArgumentTextObjectHandler(isInner);
diff --git a/src/main/java/com/maddyhome/idea/vim/extension/commentary/CommentaryExtension.java b/src/main/java/com/maddyhome/idea/vim/extension/commentary/CommentaryExtension.java
index 15fd112db..dbd097172 100644
--- a/src/main/java/com/maddyhome/idea/vim/extension/commentary/CommentaryExtension.java
+++ b/src/main/java/com/maddyhome/idea/vim/extension/commentary/CommentaryExtension.java
@@ -36,6 +36,7 @@ import com.maddyhome.idea.vim.common.TextRange;
 import com.maddyhome.idea.vim.extension.VimExtension;
 import com.maddyhome.idea.vim.extension.VimExtensionHandler;
 import com.maddyhome.idea.vim.key.OperatorFunction;
+import com.maddyhome.idea.vim.newapi.IjVimEditor;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -105,7 +106,7 @@ public class CommentaryExtension implements VimExtension {
       final TextRange range = getCommentRange(editor);
       if (range == null) return false;
 
-      if (CommandState.getInstance(editor).getMode() != CommandState.Mode.VISUAL) {
+      if (CommandState.getInstance(new IjVimEditor(editor)).getMode() != CommandState.Mode.VISUAL) {
         editor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset());
       }
 
@@ -138,7 +139,7 @@ public class CommentaryExtension implements VimExtension {
     }
 
     private @Nullable TextRange getCommentRange(@NotNull Editor editor) {
-      final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
+      final CommandState.Mode mode = CommandState.getInstance(new IjVimEditor(editor)).getMode();
       switch (mode) {
         case COMMAND:
           return VimPlugin.getMark().getChangeMarks(editor);
diff --git a/src/main/java/com/maddyhome/idea/vim/extension/matchit/Matchit.kt b/src/main/java/com/maddyhome/idea/vim/extension/matchit/Matchit.kt
index 1ab9291b6..c9813bd27 100644
--- a/src/main/java/com/maddyhome/idea/vim/extension/matchit/Matchit.kt
+++ b/src/main/java/com/maddyhome/idea/vim/extension/matchit/Matchit.kt
@@ -30,7 +30,6 @@ import com.maddyhome.idea.vim.VimPlugin
 import com.maddyhome.idea.vim.command.Argument
 import com.maddyhome.idea.vim.command.Command
 import com.maddyhome.idea.vim.command.CommandFlags
-import com.maddyhome.idea.vim.command.CommandState.Companion.getInstance
 import com.maddyhome.idea.vim.command.MappingMode
 import com.maddyhome.idea.vim.command.MotionType
 import com.maddyhome.idea.vim.command.OperatorArguments
@@ -49,6 +48,7 @@ import com.maddyhome.idea.vim.helper.commandState
 import com.maddyhome.idea.vim.helper.enumSetOf
 import com.maddyhome.idea.vim.helper.getTopLevelEditor
 import com.maddyhome.idea.vim.helper.vimForEachCaret
+import com.maddyhome.idea.vim.newapi.vim
 import java.util.*
 import java.util.regex.Pattern
 
@@ -99,11 +99,11 @@ class Matchit : VimExtension {
   private class MatchitHandler(private val reverse: Boolean) : VimExtensionHandler {
 
     override fun execute(editor: Editor, context: DataContext) {
-      val commandState = getInstance(editor)
+      val commandState = editor.vim.commandState
       val count = commandState.commandBuilder.count
 
       // Reset the command count so it doesn't transfer onto subsequent commands.
-      editor.getTopLevelEditor().commandState.commandBuilder.resetCount()
+      editor.getTopLevelEditor().vim.commandState.commandBuilder.resetCount()
 
       // Normally we want to jump to the start of the matching pair. But when moving forward in operator
       // pending mode, we want to include the entire match. isInOpPending makes that distinction.
diff --git a/src/main/java/com/maddyhome/idea/vim/extension/replacewithregister/ReplaceWithRegister.kt b/src/main/java/com/maddyhome/idea/vim/extension/replacewithregister/ReplaceWithRegister.kt
index 0808bd3b3..a796c797a 100644
--- a/src/main/java/com/maddyhome/idea/vim/extension/replacewithregister/ReplaceWithRegister.kt
+++ b/src/main/java/com/maddyhome/idea/vim/extension/replacewithregister/ReplaceWithRegister.kt
@@ -39,9 +39,11 @@ import com.maddyhome.idea.vim.group.visual.VimSelection
 import com.maddyhome.idea.vim.helper.EditorDataContext
 import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
 import com.maddyhome.idea.vim.helper.exitVisualMode
+import com.maddyhome.idea.vim.helper.mode
 import com.maddyhome.idea.vim.helper.subMode
 import com.maddyhome.idea.vim.helper.vimForEachCaret
 import com.maddyhome.idea.vim.key.OperatorFunction
+import com.maddyhome.idea.vim.newapi.vim
 import org.jetbrains.annotations.NonNls
 
 class ReplaceWithRegister : VimExtension {
@@ -125,7 +127,7 @@ class ReplaceWithRegister : VimExtension {
       return true
     }
 
-    private fun getRange(editor: Editor): TextRange? = when (CommandState.getInstance(editor).mode) {
+    private fun getRange(editor: Editor): TextRange? = when (editor.vim.mode) {
       CommandState.Mode.COMMAND -> VimPlugin.getMark().getChangeMarks(editor)
       CommandState.Mode.VISUAL -> editor.caretModel.primaryCaret.run { TextRange(selectionStart, selectionEnd) }
       else -> null
diff --git a/src/main/java/com/maddyhome/idea/vim/extension/textobjentire/VimTextObjEntireExtension.java b/src/main/java/com/maddyhome/idea/vim/extension/textobjentire/VimTextObjEntireExtension.java
index 9b0c7e172..a01eae784 100644
--- a/src/main/java/com/maddyhome/idea/vim/extension/textobjentire/VimTextObjEntireExtension.java
+++ b/src/main/java/com/maddyhome/idea/vim/extension/textobjentire/VimTextObjEntireExtension.java
@@ -29,6 +29,7 @@ import com.maddyhome.idea.vim.handler.TextObjectActionHandler;
 import com.maddyhome.idea.vim.helper.InlayHelperKt;
 import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor;
 import com.maddyhome.idea.vim.listener.VimListenerSuppressor;
+import com.maddyhome.idea.vim.newapi.IjVimEditor;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -135,7 +136,7 @@ public class VimTextObjEntireExtension implements VimExtension {
 
     @Override
     public void execute(@NotNull Editor editor, @NotNull DataContext context) {
-      @NotNull CommandState commandState = CommandState.getInstance(editor);
+      @NotNull CommandState commandState = CommandState.getInstance(new IjVimEditor(editor));
       int count = Math.max(1, commandState.getCommandBuilder().getCount());
 
       final EntireTextObjectHandler textObjectHandler = new EntireTextObjectHandler(ignoreLeadingAndTrailing);
diff --git a/src/main/java/com/maddyhome/idea/vim/extension/textobjindent/VimIndentObject.java b/src/main/java/com/maddyhome/idea/vim/extension/textobjindent/VimIndentObject.java
index 8e420ffc0..aa47ecb9e 100644
--- a/src/main/java/com/maddyhome/idea/vim/extension/textobjindent/VimIndentObject.java
+++ b/src/main/java/com/maddyhome/idea/vim/extension/textobjindent/VimIndentObject.java
@@ -29,6 +29,7 @@ import com.maddyhome.idea.vim.handler.TextObjectActionHandler;
 import com.maddyhome.idea.vim.helper.InlayHelperKt;
 import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor;
 import com.maddyhome.idea.vim.listener.VimListenerSuppressor;
+import com.maddyhome.idea.vim.newapi.IjVimEditor;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -262,7 +263,7 @@ public class VimIndentObject implements VimExtension {
 
     @Override
     public void execute(@NotNull Editor editor, @NotNull DataContext context) {
-      @NotNull CommandState commandState = CommandState.getInstance(editor);
+      @NotNull CommandState commandState = CommandState.getInstance(new IjVimEditor(editor));
       int count = Math.max(1, commandState.getCommandBuilder().getCount());
 
       final IndentObjectHandler textObjectHandler = new IndentObjectHandler(includeAbove, includeBelow);
diff --git a/src/main/java/com/maddyhome/idea/vim/group/ChangeGroup.java b/src/main/java/com/maddyhome/idea/vim/group/ChangeGroup.java
index fa29b9da9..6e23419dd 100644
--- a/src/main/java/com/maddyhome/idea/vim/group/ChangeGroup.java
+++ b/src/main/java/com/maddyhome/idea/vim/group/ChangeGroup.java
@@ -275,7 +275,7 @@ public class ChangeGroup {
   }
 
   private void runEnterAction(Editor editor, @NotNull DataContext context) {
-    CommandState state = CommandState.getInstance(editor);
+    CommandState state = CommandState.getInstance(new IjVimEditor(editor));
     if (!state.isDotRepeatInProgress()) {
       // While repeating the enter action has been already executed because `initInsert` repeats the input
       final NativeAction action = VimInjectorKt.getInjector().getNativeActionManager().getEnterAction();
@@ -287,7 +287,7 @@ public class ChangeGroup {
   }
 
   private void runEnterAboveAction(Editor editor, @NotNull DataContext context) {
-    CommandState state = CommandState.getInstance(editor);
+    CommandState state = CommandState.getInstance(new IjVimEditor(editor));
     if (!state.isDotRepeatInProgress()) {
       // While repeating the enter action has been already executed because `initInsert` repeats the input
       final NativeAction action = VimInjectorKt.getInjector().getNativeActionManager().getCreateLineAboveCaret();
@@ -423,7 +423,7 @@ public class ChangeGroup {
    * @param mode    The mode - indicate insert or replace
    */
   public void initInsert(@NotNull Editor editor, @NotNull DataContext context, @NotNull CommandState.Mode mode) {
-    final CommandState state = CommandState.getInstance(editor);
+    final CommandState state = CommandState.getInstance(new IjVimEditor(editor));
 
     final CaretModel caretModel = editor.getCaretModel();
     for (Caret caret : caretModel.getAllCarets()) {
@@ -441,12 +441,12 @@ public class ChangeGroup {
         setInsertEditorState(editor, false);
       }
       if (cmd.getFlags().contains(CommandFlags.FLAG_NO_REPEAT_INSERT)) {
-        CommandState commandState = CommandState.getInstance(editor);
+        CommandState commandState = CommandState.getInstance(new IjVimEditor(editor));
         repeatInsert(editor, context, 1, false,
                      new OperatorArguments(false, 1, commandState.getMode(), commandState.getSubMode()));
       }
       else {
-        CommandState commandState = CommandState.getInstance(editor);
+        CommandState commandState = CommandState.getInstance(new IjVimEditor(editor));
         repeatInsert(editor, context, cmd.getCount(), false,
                      new OperatorArguments(false, cmd.getCount(), commandState.getMode(), commandState.getSubMode()));
       }
@@ -549,7 +549,7 @@ public class ChangeGroup {
     markGroup.setMark(editor, '^', offset);
     markGroup.setMark(editor, MarkGroup.MARK_CHANGE_END, offset);
 
-    if (CommandState.getInstance(editor).getMode() == CommandState.Mode.REPLACE) {
+    if (CommandState.getInstance(new IjVimEditor(editor)).getMode() == CommandState.Mode.REPLACE) {
       setInsertEditorState(editor, true);
     }
 
@@ -569,7 +569,7 @@ public class ChangeGroup {
       repeatInsert(editor, context, cnt == 0 ? 0 : cnt - 1, true, operatorArguments);
     }
 
-    if (CommandState.getInstance(editor).getMode() == CommandState.Mode.INSERT) {
+    if (CommandState.getInstance(new IjVimEditor(editor)).getMode() == CommandState.Mode.INSERT) {
       updateLastInsertedTextRegister();
     }
 
@@ -577,7 +577,7 @@ public class ChangeGroup {
     offset = editor.getCaretModel().getPrimaryCaret().getOffset();
     markGroup.setMark(editor, MarkGroup.MARK_CHANGE_POS, offset);
 
-    CommandState.getInstance(editor).popModes();
+    CommandState.getInstance(new IjVimEditor(editor)).popModes();
     exitAllSingleCommandInsertModes(editor);
   }
 
@@ -591,7 +591,7 @@ public class ChangeGroup {
    * @param context The data context
    */
   public void processEnter(@NotNull Editor editor, @NotNull DataContext context) {
-    if (CommandState.getInstance(editor).getMode() == CommandState.Mode.REPLACE) {
+    if (CommandState.getInstance(new IjVimEditor(editor)).getMode() == CommandState.Mode.REPLACE) {
       setInsertEditorState(editor, true);
     }
     final KeyStroke enterKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
@@ -601,7 +601,7 @@ public class ChangeGroup {
         break;
       }
     }
-    if (CommandState.getInstance(editor).getMode() == CommandState.Mode.REPLACE) {
+    if (CommandState.getInstance(new IjVimEditor(editor)).getMode() == CommandState.Mode.REPLACE) {
       setInsertEditorState(editor, false);
     }
   }
@@ -723,7 +723,7 @@ public class ChangeGroup {
     final EditorEx editorEx = ObjectUtils.tryCast(editor, EditorEx.class);
     if (editorEx == null) return;
     editorEx.setInsertMode(!editorEx.isInsertMode());
-    CommandState.getInstance(editor).toggleInsertOverwrite();
+    CommandState.getInstance(new IjVimEditor(editor)).toggleInsertOverwrite();
   }
 
   /**
@@ -796,7 +796,7 @@ public class ChangeGroup {
    * @param editor The editor to put into NORMAL mode for one command
    */
   public void processSingleCommand(@NotNull Editor editor) {
-    CommandState.getInstance(editor).pushModes(CommandState.Mode.INSERT_NORMAL, CommandState.SubMode.NONE);
+    CommandState.getInstance(new IjVimEditor(editor)).pushModes(CommandState.Mode.INSERT_NORMAL, CommandState.SubMode.NONE);
     clearStrokes(editor);
   }
 
@@ -1980,9 +1980,9 @@ public class ChangeGroup {
 
   private void exitAllSingleCommandInsertModes(@NotNull Editor editor) {
     while (CommandStateHelper.inSingleCommandMode(editor)) {
-      CommandState.getInstance(editor).popModes();
+      CommandState.getInstance(new IjVimEditor(editor)).popModes();
       if (CommandStateHelper.inInsertMode(editor)) {
-        CommandState.getInstance(editor).popModes();
+        CommandState.getInstance(new IjVimEditor(editor)).popModes();
       }
     }
   }
diff --git a/src/main/java/com/maddyhome/idea/vim/group/FileGroup.java b/src/main/java/com/maddyhome/idea/vim/group/FileGroup.java
index 6d7509920..a64fa1f19 100644
--- a/src/main/java/com/maddyhome/idea/vim/group/FileGroup.java
+++ b/src/main/java/com/maddyhome/idea/vim/group/FileGroup.java
@@ -40,8 +40,12 @@ import com.maddyhome.idea.vim.VimInjectorKt;
 import com.maddyhome.idea.vim.VimPlugin;
 import com.maddyhome.idea.vim.command.CommandState;
 import com.maddyhome.idea.vim.common.TextRange;
-import com.maddyhome.idea.vim.helper.*;
+import com.maddyhome.idea.vim.helper.EditorHelper;
+import com.maddyhome.idea.vim.helper.EditorHelperRt;
+import com.maddyhome.idea.vim.helper.MessageHelper;
+import com.maddyhome.idea.vim.helper.SearchHelper;
 import com.maddyhome.idea.vim.newapi.IjExecutionContext;
+import com.maddyhome.idea.vim.newapi.IjVimEditor;
 import com.maddyhome.idea.vim.newapi.NativeAction;
 import com.maddyhome.idea.vim.newapi.NativeActionKt;
 import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString;
@@ -286,7 +290,7 @@ public class FileGroup {
     StringBuilder msg = new StringBuilder();
     Document doc = editor.getDocument();
 
-    if (CommandState.getInstance(editor).getMode() != CommandState.Mode.VISUAL) {
+    if (CommandState.getInstance(new IjVimEditor(editor)).getMode() != CommandState.Mode.VISUAL) {
       LogicalPosition lp = editor.getCaretModel().getLogicalPosition();
       int col = editor.getCaretModel().getOffset() - doc.getLineStartOffset(lp.line);
       int endoff = doc.getLineEndOffset(lp.line);
diff --git a/src/main/java/com/maddyhome/idea/vim/group/MarkGroup.java b/src/main/java/com/maddyhome/idea/vim/group/MarkGroup.java
index 166cda720..a6474c310 100755
--- a/src/main/java/com/maddyhome/idea/vim/group/MarkGroup.java
+++ b/src/main/java/com/maddyhome/idea/vim/group/MarkGroup.java
@@ -46,6 +46,7 @@ import com.maddyhome.idea.vim.common.*;
 import com.maddyhome.idea.vim.helper.EditorHelper;
 import com.maddyhome.idea.vim.helper.HelperKt;
 import com.maddyhome.idea.vim.helper.SearchHelper;
+import com.maddyhome.idea.vim.newapi.IjVimEditor;
 import com.maddyhome.idea.vim.vimscript.services.OptionConstants;
 import com.maddyhome.idea.vim.vimscript.services.OptionService;
 import org.jdom.Element;
@@ -592,7 +593,7 @@ public class MarkGroup implements PersistentStateComponent<Element> {
           int markLineStartOff = EditorHelper.getLineStartOffset(editor, mark.getLogicalLine());
           int markLineEndOff = EditorHelper.getLineEndOffset(editor, mark.getLogicalLine(), true);
 
-          Command command = CommandState.getInstance(editor).getExecutingCommand();
+          Command command = CommandState.getInstance(new IjVimEditor(editor)).getExecutingCommand();
           // If text is being changed from the start of the mark line (a special case for mark deletion)
           boolean changeFromMarkLineStart = command != null && command.getType() == Command.Type.CHANGE
                                             && delStartOff == markLineStartOff;
diff --git a/src/main/java/com/maddyhome/idea/vim/group/MotionGroup.java b/src/main/java/com/maddyhome/idea/vim/group/MotionGroup.java
index 2286d05d5..e4db1996b 100755
--- a/src/main/java/com/maddyhome/idea/vim/group/MotionGroup.java
+++ b/src/main/java/com/maddyhome/idea/vim/group/MotionGroup.java
@@ -878,7 +878,7 @@ public class MotionGroup {
   }
 
   private static int getScrollJump(@NotNull Editor editor, int height) {
-    final EnumSet<CommandFlags> flags = CommandState.getInstance(editor).getExecutingCommandFlags();
+    final EnumSet<CommandFlags> flags = CommandState.getInstance(new IjVimEditor(editor)).getExecutingCommandFlags();
     final boolean scrollJump = !flags.contains(CommandFlags.FLAG_IGNORE_SCROLL_JUMP);
 
     // Default value is 1. Zero is a valid value, but we normalise to 1 - we always want to scroll at least one line
@@ -903,7 +903,7 @@ public class MotionGroup {
     final int halfWidth = getApproximateScreenWidth(editor) / 2;
     final int scrollOffset = getNormalizedSideScrollOffset(editor);
 
-    final EnumSet<CommandFlags> flags = CommandState.getInstance(editor).getExecutingCommandFlags();
+    final EnumSet<CommandFlags> flags = CommandState.getInstance(new IjVimEditor(editor)).getExecutingCommandFlags();
     final boolean allowSidescroll = !flags.contains(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP);
     int sidescroll = ((VimInt) VimPlugin.getOptionService().getOptionValue(new OptionService.Scope.LOCAL(new IjVimEditor(editor)), OptionConstants.sidescrollName, OptionConstants.sidescrollName)).getValue();
 
@@ -974,7 +974,7 @@ public class MotionGroup {
                                          boolean isBig) {
     int dir = 1;
     boolean selection = false;
-    if (CommandState.getInstance(editor).getMode() == CommandState.Mode.VISUAL) {
+    if (CommandState.getInstance(new IjVimEditor(editor)).getMode() == CommandState.Mode.VISUAL) {
       if (UserDataManager.getVimSelectionStart(caret) > caret.getOffset()) {
         dir = -1;
       }
@@ -1484,7 +1484,7 @@ public class MotionGroup {
     if (fileEditor instanceof TextEditor) {
       final Editor editor = ((TextEditor)fileEditor).getEditor();
       ExOutputModel.getInstance(editor).clear();
-      if (CommandState.getInstance(editor).getMode() == CommandState.Mode.VISUAL) {
+      if (CommandState.getInstance(new IjVimEditor(editor)).getMode() == CommandState.Mode.VISUAL) {
         ModeHelper.exitVisualMode(editor);
         KeyHandler.getInstance().reset(new IjVimEditor(editor));
       }
diff --git a/src/main/java/com/maddyhome/idea/vim/group/ProcessGroup.java b/src/main/java/com/maddyhome/idea/vim/group/ProcessGroup.java
index 80ceab49e..a530549e2 100644
--- a/src/main/java/com/maddyhome/idea/vim/group/ProcessGroup.java
+++ b/src/main/java/com/maddyhome/idea/vim/group/ProcessGroup.java
@@ -86,7 +86,7 @@ public class ProcessGroup {
     if (editor.isOneLineMode()) return;
 
     String initText = getRange(editor, cmd);
-    CommandState.getInstance(editor).pushModes(CommandState.Mode.CMD_LINE, CommandState.SubMode.NONE);
+    CommandState.getInstance(new IjVimEditor(editor)).pushModes(CommandState.Mode.CMD_LINE, CommandState.SubMode.NONE);
     ExEntryPanel panel = ExEntryPanel.getInstance();
     panel.activate(editor, context, ":", initText, 1);
   }
@@ -114,7 +114,7 @@ public class ProcessGroup {
     panel.deactivate(true);
     boolean res = true;
     try {
-      CommandState.getInstance(editor).popModes();
+      CommandState.getInstance(new IjVimEditor(editor)).popModes();
 
       logger.debug("processing command");
 
@@ -146,7 +146,7 @@ public class ProcessGroup {
   }
 
   public void cancelExEntry(final @NotNull Editor editor, boolean resetCaret) {
-    CommandState.getInstance(editor).popModes();
+    CommandState.getInstance(new IjVimEditor(editor)).popModes();
     KeyHandler.getInstance().reset(new IjVimEditor(editor));
     ExEntryPanel panel = ExEntryPanel.getInstance();
     panel.deactivate(true, resetCaret);
@@ -154,14 +154,14 @@ public class ProcessGroup {
 
   public void startFilterCommand(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
     String initText = getRange(editor, cmd) + "!";
-    CommandState.getInstance(editor).pushModes(CommandState.Mode.CMD_LINE, CommandState.SubMode.NONE);
+    CommandState.getInstance(new IjVimEditor(editor)).pushModes(CommandState.Mode.CMD_LINE, CommandState.SubMode.NONE);
     ExEntryPanel panel = ExEntryPanel.getInstance();
     panel.activate(editor, context, ":", initText, 1);
   }
 
   private @NotNull String getRange(Editor editor, @NotNull Command cmd) {
     String initText = "";
-    if (CommandState.getInstance(editor).getMode() == CommandState.Mode.VISUAL) {
+    if (CommandState.getInstance(new IjVimEditor(editor)).getMode() == CommandState.Mode.VISUAL) {
       initText = "'<,'>";
     }
     else if (cmd.getRawCount() > 0) {
diff --git a/src/main/java/com/maddyhome/idea/vim/group/RegisterGroup.java b/src/main/java/com/maddyhome/idea/vim/group/RegisterGroup.java
index aca7aef4f..10a041be4 100644
--- a/src/main/java/com/maddyhome/idea/vim/group/RegisterGroup.java
+++ b/src/main/java/com/maddyhome/idea/vim/group/RegisterGroup.java
@@ -56,6 +56,7 @@ import com.maddyhome.idea.vim.common.TextRange;
 import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
 import com.maddyhome.idea.vim.helper.EditorHelper;
 import com.maddyhome.idea.vim.helper.StringHelper;
+import com.maddyhome.idea.vim.newapi.IjVimEditor;
 import com.maddyhome.idea.vim.ui.ClipboardHandler;
 import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType;
 import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString;
@@ -375,7 +376,7 @@ public class RegisterGroup implements PersistentStateComponent<Element> {
   }
 
   private boolean isSmallDeletionSpecialCase(Editor editor) {
-    Command currentCommand = CommandState.getInstance(editor).getExecutingCommand();
+    Command currentCommand = CommandState.getInstance(new IjVimEditor(editor)).getExecutingCommand();
     if (currentCommand != null) {
       Argument argument = currentCommand.getArgument();
       if (argument != null) {
@@ -460,7 +461,7 @@ public class RegisterGroup implements PersistentStateComponent<Element> {
 
   public boolean startRecording(Editor editor, char register) {
     if (RECORDABLE_REGISTERS.indexOf(register) != -1) {
-      CommandState.getInstance(editor).setRecording(true);
+      CommandState.getInstance(new IjVimEditor(editor)).setRecording(true);
       recordRegister = register;
       recordList = new ArrayList<>();
       return true;
@@ -506,7 +507,7 @@ public class RegisterGroup implements PersistentStateComponent<Element> {
           reg.addKeys(recordList);
         }
       }
-      CommandState.getInstance(editor).setRecording(false);
+      CommandState.getInstance(new IjVimEditor(editor)).setRecording(false);
     }
 
     recordRegister = 0;
diff --git a/src/main/java/com/maddyhome/idea/vim/group/visual/IdeaSelectionControl.kt b/src/main/java/com/maddyhome/idea/vim/group/visual/IdeaSelectionControl.kt
index f05817ee8..08e501c6b 100644
--- a/src/main/java/com/maddyhome/idea/vim/group/visual/IdeaSelectionControl.kt
+++ b/src/main/java/com/maddyhome/idea/vim/group/visual/IdeaSelectionControl.kt
@@ -80,13 +80,13 @@ object IdeaSelectionControl {
           return@singleTask
         }
 
-        logger.debug("Some carets have selection. State before adjustment: ${editor.commandState.toSimpleString()}")
+        logger.debug("Some carets have selection. State before adjustment: ${editor.vim.commandState.toSimpleString()}")
 
         editor.popAllModes()
 
         activateMode(editor, chooseSelectionMode(editor, selectionSource, true))
       } else {
-        logger.debug("None of carets have selection. State before adjustment: ${editor.commandState.toSimpleString()}")
+        logger.debug("None of carets have selection. State before adjustment: ${editor.vim.commandState.toSimpleString()}")
         if (editor.inVisualMode) editor.exitVisualMode()
         if (editor.inSelectMode) editor.exitSelectMode(false)
 
diff --git a/src/main/java/com/maddyhome/idea/vim/group/visual/VisualMotionGroup.kt b/src/main/java/com/maddyhome/idea/vim/group/visual/VisualMotionGroup.kt
index 92459a8a6..7460d7732 100644
--- a/src/main/java/com/maddyhome/idea/vim/group/visual/VisualMotionGroup.kt
+++ b/src/main/java/com/maddyhome/idea/vim/group/visual/VisualMotionGroup.kt
@@ -56,7 +56,7 @@ class VisualMotionGroup {
 
     editor.caretModel.removeSecondaryCarets()
 
-    editor.commandState.pushModes(CommandState.Mode.VISUAL, lastSelectionType.toSubMode())
+    editor.vim.commandState.pushModes(CommandState.Mode.VISUAL, lastSelectionType.toSubMode())
 
     val primaryCaret = editor.caretModel.primaryCaret
     primaryCaret.vimSetSelection(visualMarks.startOffset, visualMarks.endOffset - 1, true)
@@ -125,7 +125,7 @@ class VisualMotionGroup {
       if (rawCount > 0) {
         val primarySubMode = editor.caretModel.primaryCaret.vimLastVisualOperatorRange?.type?.toSubMode()
           ?: subMode
-        editor.commandState.pushVisualMode(primarySubMode)
+        editor.vim.commandState.pushVisualMode(primarySubMode)
 
         editor.vimForEachCaret {
           val range = it.vimLastVisualOperatorRange ?: VisualChange.default(subMode)
@@ -138,7 +138,7 @@ class VisualMotionGroup {
           it.vimSetSelection(it.offset, end, true)
         }
       } else {
-        editor.commandState.pushVisualMode(subMode)
+        editor.vim.commandState.pushVisualMode(subMode)
         editor.vimForEachCaret { it.vimSetSelection(it.offset) }
       }
       return true
@@ -164,9 +164,9 @@ class VisualMotionGroup {
     val autodetectedMode = autodetectVisualSubmode(editor)
 
     if (editor.inVisualMode) {
-      editor.commandState.popModes()
+      editor.vim.commandState.popModes()
     }
-    editor.commandState.pushModes(CommandState.Mode.VISUAL, autodetectedMode)
+    editor.vim.commandState.pushModes(CommandState.Mode.VISUAL, autodetectedMode)
     if (autodetectedMode == CommandState.SubMode.VISUAL_BLOCK) {
       val (start, end) = blockModeStartAndEnd(editor)
       editor.caretModel.removeSecondaryCarets()
@@ -207,7 +207,7 @@ class VisualMotionGroup {
    */
   fun enterVisualMode(editor: Editor, subMode: CommandState.SubMode? = null): Boolean {
     val autodetectedSubMode = subMode ?: autodetectVisualSubmode(editor)
-    editor.commandState.pushModes(CommandState.Mode.VISUAL, autodetectedSubMode)
+    editor.vim.commandState.pushModes(CommandState.Mode.VISUAL, autodetectedSubMode)
     if (autodetectedSubMode == CommandState.SubMode.VISUAL_BLOCK) {
       editor.caretModel.primaryCaret.run { vimSelectionStart = vimLeadSelectionOffset }
     } else {
@@ -217,7 +217,7 @@ class VisualMotionGroup {
   }
 
   fun enterSelectMode(editor: Editor, subMode: CommandState.SubMode): Boolean {
-    editor.commandState.pushSelectMode(subMode)
+    editor.vim.commandState.pushSelectMode(subMode)
     editor.vimForEachCaret { it.vimSelectionStart = it.vimLeadSelectionOffset }
     return true
   }
diff --git a/src/main/java/com/maddyhome/idea/vim/handler/EditorActionHandlerBase.kt b/src/main/java/com/maddyhome/idea/vim/handler/EditorActionHandlerBase.kt
index 0b62fd3b2..6e1f3e171 100644
--- a/src/main/java/com/maddyhome/idea/vim/handler/EditorActionHandlerBase.kt
+++ b/src/main/java/com/maddyhome/idea/vim/handler/EditorActionHandlerBase.kt
@@ -33,6 +33,7 @@ import com.maddyhome.idea.vim.helper.StringHelper
 import com.maddyhome.idea.vim.helper.commandState
 import com.maddyhome.idea.vim.helper.getTopLevelEditor
 import com.maddyhome.idea.vim.helper.noneOfEnum
+import com.maddyhome.idea.vim.newapi.vim
 import org.jetbrains.annotations.NonNls
 import java.util.*
 import javax.swing.KeyStroke
@@ -94,7 +95,7 @@ abstract class EditorActionHandlerBase(private val myRunForEachCaret: Boolean) {
     val topLevelEditor = editor.getTopLevelEditor()
     logger.debug("Execute command with handler: " + this.javaClass.name)
 
-    val cmd = topLevelEditor.commandState.executingCommand ?: run {
+    val cmd = topLevelEditor.vim.commandState.executingCommand ?: run {
       VimPlugin.indicateError()
       return
     }
diff --git a/src/main/java/com/maddyhome/idea/vim/handler/VisualOperatorActionHandler.kt b/src/main/java/com/maddyhome/idea/vim/handler/VisualOperatorActionHandler.kt
index 286d70f1a..54f21ee0f 100644
--- a/src/main/java/com/maddyhome/idea/vim/handler/VisualOperatorActionHandler.kt
+++ b/src/main/java/com/maddyhome/idea/vim/handler/VisualOperatorActionHandler.kt
@@ -48,6 +48,7 @@ import com.maddyhome.idea.vim.helper.vimLastColumn
 import com.maddyhome.idea.vim.helper.vimLastSelectionType
 import com.maddyhome.idea.vim.helper.vimLastVisualOperatorRange
 import com.maddyhome.idea.vim.helper.vimSelectionStart
+import com.maddyhome.idea.vim.newapi.vim
 
 /**
  * @author Alex Plate
@@ -228,7 +229,7 @@ sealed class VisualOperatorActionHandler : EditorActionHandlerBase(false) {
       }
       else -> this.caretModel.allCarets.associateWith { caret ->
 
-        val subMode = this.commandState.subMode
+        val subMode = this.vim.commandState.subMode
         VimSimpleSelection.createWithNative(
           caret.vimSelectionStart,
           caret.offset,
diff --git a/src/main/java/com/maddyhome/idea/vim/helper/CaretVisualAttributesHelper.kt b/src/main/java/com/maddyhome/idea/vim/helper/CaretVisualAttributesHelper.kt
index 7b3f06bd0..e45655cc9 100644
--- a/src/main/java/com/maddyhome/idea/vim/helper/CaretVisualAttributesHelper.kt
+++ b/src/main/java/com/maddyhome/idea/vim/helper/CaretVisualAttributesHelper.kt
@@ -27,6 +27,7 @@ import com.intellij.openapi.editor.ex.EditorSettingsExternalizable
 import com.maddyhome.idea.vim.VimPlugin
 import com.maddyhome.idea.vim.command.CommandState
 import com.maddyhome.idea.vim.newapi.IjVimEditor
+import com.maddyhome.idea.vim.newapi.vim
 import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
 import com.maddyhome.idea.vim.vimscript.model.options.OptionChangeListener
 import com.maddyhome.idea.vim.vimscript.model.options.helpers.GuiCursorMode
@@ -68,7 +69,7 @@ fun removeCaretsVisualAttributes(editor: Editor) {
 }
 
 fun Editor.guicursorMode(): GuiCursorMode {
-  if (this.commandState.isReplaceCharacter) {
+  if (this.vim.commandState.isReplaceCharacter) {
     // Can be true for NORMAL and VISUAL
     return GuiCursorMode.REPLACE
   }
diff --git a/src/main/java/com/maddyhome/idea/vim/helper/CommandLineHelper.kt b/src/main/java/com/maddyhome/idea/vim/helper/CommandLineHelper.kt
index ee47b7463..285af33fa 100644
--- a/src/main/java/com/maddyhome/idea/vim/helper/CommandLineHelper.kt
+++ b/src/main/java/com/maddyhome/idea/vim/helper/CommandLineHelper.kt
@@ -22,6 +22,7 @@ import com.intellij.openapi.application.ApplicationManager
 import com.intellij.openapi.components.Service
 import com.intellij.openapi.editor.Editor
 import com.maddyhome.idea.vim.action.change.VimRepeater
+import com.maddyhome.idea.vim.newapi.vim
 import com.maddyhome.idea.vim.ui.ModalEntry
 import com.maddyhome.idea.vim.ui.ex.ExEntryPanel
 import java.awt.event.KeyEvent
@@ -31,7 +32,7 @@ import javax.swing.KeyStroke
 class CommandLineHelper {
 
   fun inputString(editor: Editor, prompt: String, finishOn: Char?): String? {
-    if (editor.commandState.isDotRepeatInProgress) {
+    if (editor.vim.commandState.isDotRepeatInProgress) {
       val input = VimRepeater.Extension.consumeString()
       return input ?: error("Not enough strings saved: ${VimRepeater.Extension.lastExtensionHandler}")
     }
diff --git a/src/main/java/com/maddyhome/idea/vim/helper/CommandStateExtensions.kt b/src/main/java/com/maddyhome/idea/vim/helper/CommandStateExtensions.kt
index 1b7440533..02235ef8c 100644
--- a/src/main/java/com/maddyhome/idea/vim/helper/CommandStateExtensions.kt
+++ b/src/main/java/com/maddyhome/idea/vim/helper/CommandStateExtensions.kt
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
 import com.maddyhome.idea.vim.VimPlugin
 import com.maddyhome.idea.vim.command.CommandState
 import com.maddyhome.idea.vim.newapi.VimEditor
+import com.maddyhome.idea.vim.newapi.vim
 import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
 import com.maddyhome.idea.vim.vimscript.services.OptionConstants
 import com.maddyhome.idea.vim.vimscript.services.OptionService
@@ -73,15 +74,15 @@ val CommandState.Mode.hasVisualSelection
   }
 
 val Editor.mode
-  get() = this.commandState.mode
+  get() = this.vim.commandState.mode
 
 val VimEditor.mode
   get() = this.commandState.mode
 
 var Editor.subMode
-  get() = this.commandState.subMode
+  get() = this.vim.commandState.subMode
   set(value) {
-    this.commandState.subMode = value
+    this.vim.commandState.subMode = value
   }
 
 var VimEditor.subMode
@@ -104,7 +105,7 @@ val Editor.inInsertMode
 
 @get:JvmName("inRepeatMode")
 val Editor.inRepeatMode
-  get() = this.commandState.isDotRepeatInProgress
+  get() = this.vim.commandState.isDotRepeatInProgress
 
 @get:JvmName("inVisualMode")
 val Editor.inVisualMode
@@ -143,10 +144,6 @@ val CommandState.Mode.inSingleNormalMode: Boolean
     else -> false
   }
 
-@get:JvmName("commandState")
-val Editor.commandState
-  get() = CommandState.getInstance(this)
-
 val VimEditor.commandState
   get() = CommandState.getInstance(this)
 
diff --git a/src/main/java/com/maddyhome/idea/vim/helper/DigraphSequence.java b/src/main/java/com/maddyhome/idea/vim/helper/DigraphSequence.java
index 6d52b94a0..b34b374f8 100644
--- a/src/main/java/com/maddyhome/idea/vim/helper/DigraphSequence.java
+++ b/src/main/java/com/maddyhome/idea/vim/helper/DigraphSequence.java
@@ -20,9 +20,9 @@ package com.maddyhome.idea.vim.helper;
 
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Editor;
 import com.maddyhome.idea.vim.VimPlugin;
 import com.maddyhome.idea.vim.newapi.IjVimEditor;
+import com.maddyhome.idea.vim.newapi.VimEditor;
 import com.maddyhome.idea.vim.vimscript.services.OptionConstants;
 import com.maddyhome.idea.vim.vimscript.services.OptionService;
 import org.jetbrains.annotations.NotNull;
@@ -78,12 +78,12 @@ public class DigraphSequence {
     return DigraphResult.HANDLED_LITERAL;
   }
 
-  public @NotNull DigraphResult processKey(@NotNull KeyStroke key, @NotNull Editor editor) {
+  public @NotNull DigraphResult processKey(@NotNull KeyStroke key, @NotNull VimEditor editor) {
     switch (digraphState) {
       case DIG_STATE_PENDING:
         logger.debug("DIG_STATE_PENDING");
         if (key.getKeyCode() == KeyEvent.VK_BACK_SPACE
-            && VimPlugin.getOptionService().isSet(new OptionService.Scope.LOCAL(new IjVimEditor(editor)), OptionConstants.digraphName, OptionConstants.digraphName)) {
+            && VimPlugin.getOptionService().isSet(new OptionService.Scope.LOCAL(editor), OptionConstants.digraphName, OptionConstants.digraphName)) {
           digraphState = DIG_STATE_BACK_SPACE;
         }
         else if (key.getKeyChar() != KeyEvent.CHAR_UNDEFINED) {
@@ -232,7 +232,7 @@ public class DigraphSequence {
           if (!ApplicationManager.getApplication().isUnitTestMode()) {
             // The key we received isn't part of the literal, so post it to be handled after we've handled the literal.
             // This requires swing, so we can't run it in tests.
-            VimPlugin.getMacro().postKey(key, editor);
+            VimPlugin.getMacro().postKey(key, ((IjVimEditor)editor).getEditor());
           }
 
           return DigraphResult.done(code);
diff --git a/src/main/java/com/maddyhome/idea/vim/helper/ModeExtensions.kt b/src/main/java/com/maddyhome/idea/vim/helper/ModeExtensions.kt
index c6d69f0fd..28e2e7034 100644
--- a/src/main/java/com/maddyhome/idea/vim/helper/ModeExtensions.kt
+++ b/src/main/java/com/maddyhome/idea/vim/helper/ModeExtensions.kt
@@ -32,12 +32,13 @@ import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor
 import com.maddyhome.idea.vim.newapi.IjVimCaret
 import com.maddyhome.idea.vim.newapi.IjVimEditor
 import com.maddyhome.idea.vim.newapi.VimEditor
+import com.maddyhome.idea.vim.newapi.vim
 
 /**
  * Pop all modes, but leave editor state. E.g. editor selection is not removed.
  */
 fun Editor.popAllModes() {
-  val commandState = this.commandState
+  val commandState = this.vim.commandState
   while (commandState.mode != CommandState.Mode.COMMAND) {
     commandState.popModes()
   }
@@ -63,7 +64,7 @@ fun Editor.exitVisualMode() {
 
     this.subMode = CommandState.SubMode.NONE
 
-    this.commandState.popModes()
+    this.vim.commandState.popModes()
   }
 }
 
@@ -71,7 +72,7 @@ fun Editor.exitVisualMode() {
 fun Editor.exitSelectMode(adjustCaretPosition: Boolean) {
   if (!this.inSelectMode) return
 
-  this.commandState.popModes()
+  this.vim.commandState.popModes()
   SelectionVimListenerSuppressor.lock().use {
     this.caretModel.allCarets.forEach {
       it.removeSelection()
diff --git a/src/main/java/com/maddyhome/idea/vim/helper/SearchHelper.java b/src/main/java/com/maddyhome/idea/vim/helper/SearchHelper.java
index e473ba7da..ab034a506 100644
--- a/src/main/java/com/maddyhome/idea/vim/helper/SearchHelper.java
+++ b/src/main/java/com/maddyhome/idea/vim/helper/SearchHelper.java
@@ -34,6 +34,7 @@ import com.maddyhome.idea.vim.VimPlugin;
 import com.maddyhome.idea.vim.command.CommandState;
 import com.maddyhome.idea.vim.common.CharacterPosition;
 import com.maddyhome.idea.vim.common.TextRange;
+import com.maddyhome.idea.vim.newapi.IjVimEditor;
 import com.maddyhome.idea.vim.regexp.CharPointer;
 import com.maddyhome.idea.vim.regexp.RegExp;
 import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType;
@@ -891,7 +892,7 @@ public class SearchHelper {
         selectionEndWithoutNewline++;
       }
 
-      final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
+      final CommandState.Mode mode = CommandState.getInstance(new IjVimEditor(editor)).getMode();
       if (mode == CommandState.Mode.VISUAL) {
         if (closingTagTextRange.getStartOffset() == selectionEndWithoutNewline &&
           openingTag.getEndOffset() == selectionStart) {
diff --git a/src/main/java/com/maddyhome/idea/vim/listener/IdeaSpecifics.kt b/src/main/java/com/maddyhome/idea/vim/listener/IdeaSpecifics.kt
index c5a325e18..f64006ad0 100644
--- a/src/main/java/com/maddyhome/idea/vim/listener/IdeaSpecifics.kt
+++ b/src/main/java/com/maddyhome/idea/vim/listener/IdeaSpecifics.kt
@@ -88,7 +88,7 @@ object IdeaSpecifics {
       }
       ) {
         editor?.let {
-          val commandState = it.commandState
+          val commandState = it.vim.commandState
           while (commandState.mode != CommandState.Mode.COMMAND) {
             commandState.popModes()
           }
diff --git a/src/main/java/com/maddyhome/idea/vim/ui/ShowCmd.kt b/src/main/java/com/maddyhome/idea/vim/ui/ShowCmd.kt
index 27997ede7..6793e2831 100644
--- a/src/main/java/com/maddyhome/idea/vim/ui/ShowCmd.kt
+++ b/src/main/java/com/maddyhome/idea/vim/ui/ShowCmd.kt
@@ -31,9 +31,10 @@ import com.intellij.openapi.wm.impl.status.EditorBasedWidget
 import com.intellij.openapi.wm.impl.status.widget.StatusBarWidgetsManager
 import com.intellij.util.Consumer
 import com.maddyhome.idea.vim.VimPlugin
-import com.maddyhome.idea.vim.command.CommandState
 import com.maddyhome.idea.vim.helper.StringHelper
 import com.maddyhome.idea.vim.helper.VimNlsSafe
+import com.maddyhome.idea.vim.helper.commandState
+import com.maddyhome.idea.vim.newapi.vim
 import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
 import com.maddyhome.idea.vim.vimscript.model.options.OptionChangeListener
 import com.maddyhome.idea.vim.vimscript.services.OptionConstants
@@ -69,7 +70,7 @@ object ShowCmd {
   fun getFullText(editor: Editor?): String {
     if (!VimPlugin.getOptionService().isSet(OptionService.Scope.GLOBAL, OptionConstants.showcmdName) || editor == null || editor.isDisposed) return ""
 
-    val editorState = CommandState.getInstance(editor)
+    val editorState = editor.vim.commandState
     return StringHelper.toPrintableCharacters(editorState.commandBuilder.keys + editorState.mappingState.keys)
   }
 }
diff --git a/src/main/java/com/maddyhome/idea/vim/vimscript/model/commands/NormalCommand.kt b/src/main/java/com/maddyhome/idea/vim/vimscript/model/commands/NormalCommand.kt
index 9442fe8ef..39944669b 100644
--- a/src/main/java/com/maddyhome/idea/vim/vimscript/model/commands/NormalCommand.kt
+++ b/src/main/java/com/maddyhome/idea/vim/vimscript/model/commands/NormalCommand.kt
@@ -28,6 +28,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
 import com.maddyhome.idea.vim.ex.ranges.Ranges
 import com.maddyhome.idea.vim.helper.EditorHelper
 import com.maddyhome.idea.vim.helper.StringHelper.stringToKeys
+import com.maddyhome.idea.vim.helper.commandState
 import com.maddyhome.idea.vim.helper.exitInsertMode
 import com.maddyhome.idea.vim.helper.exitSelectMode
 import com.maddyhome.idea.vim.helper.exitVisualMode
@@ -53,7 +54,7 @@ data class NormalCommand(val ranges: Ranges, val argument: String) : Command.Sin
       argument = argument.substring(1)
     }
 
-    val commandState = CommandState.getInstance(editor)
+    val commandState = editor.vim.commandState
     val rangeUsed = ranges.size() != 0
     when (editor.mode) {
       CommandState.Mode.VISUAL -> {
diff --git a/src/test/java/org/jetbrains/plugins/ideavim/JavaVimTestCase.java b/src/test/java/org/jetbrains/plugins/ideavim/JavaVimTestCase.java
index dc790840d..769a0be0b 100644
--- a/src/test/java/org/jetbrains/plugins/ideavim/JavaVimTestCase.java
+++ b/src/test/java/org/jetbrains/plugins/ideavim/JavaVimTestCase.java
@@ -108,7 +108,7 @@ public abstract class JavaVimTestCase extends JavaCodeInsightFixtureTestCase {
   }
 
   public void assertMode(@NotNull CommandState.Mode expectedMode) {
-    final CommandState.Mode mode = CommandState.getInstance(myFixture.getEditor()).getMode();
+    final CommandState.Mode mode = CommandState.getInstance(new IjVimEditor(myFixture.getEditor())).getMode();
     assertEquals(expectedMode, mode);
   }
 
diff --git a/src/test/java/org/jetbrains/plugins/ideavim/NeovimTesting.kt b/src/test/java/org/jetbrains/plugins/ideavim/NeovimTesting.kt
index 0694e6da4..8bf618c96 100644
--- a/src/test/java/org/jetbrains/plugins/ideavim/NeovimTesting.kt
+++ b/src/test/java/org/jetbrains/plugins/ideavim/NeovimTesting.kt
@@ -30,6 +30,7 @@ import com.maddyhome.idea.vim.common.CharacterPosition
 import com.maddyhome.idea.vim.group.RegisterGroup
 import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
 import com.maddyhome.idea.vim.helper.commandState
+import com.maddyhome.idea.vim.newapi.vim
 import org.junit.Assert.assertEquals
 
 internal object NeovimTesting {
@@ -145,7 +146,7 @@ internal object NeovimTesting {
   }
 
   private fun assertMode(editor: Editor) {
-    val ideavimState = editor.commandState.toVimNotation()
+    val ideavimState = editor.vim.commandState.toVimNotation()
     val neovimState = neovimApi.mode.get().mode
     assertEquals(neovimState, ideavimState)
   }
diff --git a/src/test/java/org/jetbrains/plugins/ideavim/VimTestCase.kt b/src/test/java/org/jetbrains/plugins/ideavim/VimTestCase.kt
index cfa28339e..71e4af9c2 100644
--- a/src/test/java/org/jetbrains/plugins/ideavim/VimTestCase.kt
+++ b/src/test/java/org/jetbrains/plugins/ideavim/VimTestCase.kt
@@ -65,7 +65,9 @@ import com.maddyhome.idea.vim.helper.buildGreater212
 import com.maddyhome.idea.vim.helper.getShape
 import com.maddyhome.idea.vim.helper.guicursorMode
 import com.maddyhome.idea.vim.helper.inBlockSubMode
+import com.maddyhome.idea.vim.helper.mode
 import com.maddyhome.idea.vim.helper.shape
+import com.maddyhome.idea.vim.helper.subMode
 import com.maddyhome.idea.vim.helper.thickness
 import com.maddyhome.idea.vim.key.MappingOwner
 import com.maddyhome.idea.vim.key.ToKeysMappingInfo
@@ -444,12 +446,12 @@ abstract class VimTestCase : UsefulTestCase() {
   }
 
   fun assertMode(expectedMode: CommandState.Mode) {
-    val mode = CommandState.getInstance(myFixture.editor).mode
+    val mode = myFixture.editor.mode
     Assert.assertEquals(expectedMode, mode)
   }
 
   fun assertSubMode(expectedSubMode: SubMode) {
-    val subMode = CommandState.getInstance(myFixture.editor).subMode
+    val subMode = myFixture.editor.subMode
     Assert.assertEquals(expectedSubMode, subMode)
   }
 
diff --git a/src/test/java/org/jetbrains/plugins/ideavim/action/MacroActionTest.kt b/src/test/java/org/jetbrains/plugins/ideavim/action/MacroActionTest.kt
index 7ef50632e..a6300de26 100644
--- a/src/test/java/org/jetbrains/plugins/ideavim/action/MacroActionTest.kt
+++ b/src/test/java/org/jetbrains/plugins/ideavim/action/MacroActionTest.kt
@@ -19,9 +19,10 @@ package org.jetbrains.plugins.ideavim.action
 
 import com.intellij.testFramework.PlatformTestUtil
 import com.maddyhome.idea.vim.VimPlugin
-import com.maddyhome.idea.vim.command.CommandState.Companion.getInstance
 import com.maddyhome.idea.vim.helper.StringHelper
 import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
+import com.maddyhome.idea.vim.helper.commandState
+import com.maddyhome.idea.vim.newapi.vim
 import com.maddyhome.idea.vim.vimscript.services.OptionConstants
 import com.maddyhome.idea.vim.vimscript.services.OptionService
 import junit.framework.TestCase
@@ -36,7 +37,7 @@ class MacroActionTest : VimTestCase() {
   // |q|
   fun testRecordMacro() {
     val editor = typeTextInFile(parseKeys("qa", "3l", "q"), "on<caret>e two three\n")
-    val commandState = getInstance(editor)
+    val commandState = editor.vim.commandState
     assertFalse(commandState.isRecording)
     val registerGroup = VimPlugin.getRegister()
     val register = registerGroup.getRegister('a')
diff --git a/src/test/java/org/jetbrains/plugins/ideavim/command/CommandStateTest.kt b/src/test/java/org/jetbrains/plugins/ideavim/command/CommandStateTest.kt
index 87e0efd81..5f3691cbd 100644
--- a/src/test/java/org/jetbrains/plugins/ideavim/command/CommandStateTest.kt
+++ b/src/test/java/org/jetbrains/plugins/ideavim/command/CommandStateTest.kt
@@ -20,6 +20,7 @@ package org.jetbrains.plugins.ideavim.command
 
 import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
 import com.maddyhome.idea.vim.helper.commandState
+import com.maddyhome.idea.vim.newapi.vim
 import org.jetbrains.plugins.ideavim.SkipNeovimReason
 import org.jetbrains.plugins.ideavim.TestWithoutNeovim
 import org.jetbrains.plugins.ideavim.VimTestCase
@@ -28,7 +29,7 @@ class CommandStateTest : VimTestCase() {
   @TestWithoutNeovim(reason = SkipNeovimReason.NOT_VIM_TESTING)
   fun `test status string in normal`() {
     configureByText("123")
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("", statusString)
   }
 
@@ -36,7 +37,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in insert`() {
     configureByText("123")
     typeText(parseKeys("i"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("INSERT", statusString)
   }
 
@@ -44,7 +45,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in replace`() {
     configureByText("123")
     typeText(parseKeys("R"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("REPLACE", statusString)
   }
 
@@ -52,7 +53,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in visual`() {
     configureByText("123")
     typeText(parseKeys("v"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- VISUAL --", statusString)
   }
 
@@ -60,7 +61,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in visual line`() {
     configureByText("123")
     typeText(parseKeys("V"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- VISUAL LINE --", statusString)
   }
 
@@ -68,7 +69,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in visual block`() {
     configureByText("123")
     typeText(parseKeys("<C-V>"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- VISUAL BLOCK --", statusString)
   }
 
@@ -76,7 +77,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in select`() {
     configureByText("123")
     typeText(parseKeys("gh"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- SELECT --", statusString)
   }
 
@@ -84,7 +85,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in select line`() {
     configureByText("123")
     typeText(parseKeys("gH"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- SELECT LINE --", statusString)
   }
 
@@ -92,7 +93,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in select block`() {
     configureByText("123")
     typeText(parseKeys("g<C-H>"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- SELECT BLOCK --", statusString)
   }
 
@@ -100,7 +101,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in one command`() {
     configureByText("123")
     typeText(parseKeys("i<C-O>"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- (insert) --", statusString)
   }
 
@@ -108,7 +109,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in one command visual`() {
     configureByText("123")
     typeText(parseKeys("i<C-O>v"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- (insert) VISUAL --", statusString)
   }
 
@@ -116,7 +117,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in one command visual block`() {
     configureByText("123")
     typeText(parseKeys("i<C-O><C-V>"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- (insert) VISUAL BLOCK --", statusString)
   }
 
@@ -124,7 +125,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in one command visual line`() {
     configureByText("123")
     typeText(parseKeys("i<C-O>V"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- (insert) VISUAL LINE --", statusString)
   }
 
@@ -132,7 +133,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in one command select`() {
     configureByText("123")
     typeText(parseKeys("i<C-O>gh"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- (insert) SELECT --", statusString)
   }
 
@@ -140,7 +141,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in one command select block`() {
     configureByText("123")
     typeText(parseKeys("i<C-O>g<C-H>"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- (insert) SELECT BLOCK --", statusString)
   }
 
@@ -148,7 +149,7 @@ class CommandStateTest : VimTestCase() {
   fun `test status string in one command select line`() {
     configureByText("123")
     typeText(parseKeys("i<C-O>gH"))
-    val statusString = myFixture.editor.commandState.getStatusString()
+    val statusString = myFixture.editor.vim.commandState.getStatusString()
     assertEquals("-- (insert) SELECT LINE --", statusString)
   }
 }
diff --git a/src/test/java/org/jetbrains/plugins/ideavim/extension/multiplecursors/VimMultipleCursorsExtensionTest.kt b/src/test/java/org/jetbrains/plugins/ideavim/extension/multiplecursors/VimMultipleCursorsExtensionTest.kt
index 621997493..e895576b0 100644
--- a/src/test/java/org/jetbrains/plugins/ideavim/extension/multiplecursors/VimMultipleCursorsExtensionTest.kt
+++ b/src/test/java/org/jetbrains/plugins/ideavim/extension/multiplecursors/VimMultipleCursorsExtensionTest.kt
@@ -22,6 +22,7 @@ import com.maddyhome.idea.vim.command.CommandState
 import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
 import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
 import com.maddyhome.idea.vim.helper.commandState
+import com.maddyhome.idea.vim.newapi.vim
 import org.jetbrains.plugins.ideavim.SkipNeovimReason
 import org.jetbrains.plugins.ideavim.TestWithoutNeovim
 import org.jetbrains.plugins.ideavim.VimTestCase
@@ -274,7 +275,7 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
       |dfkjsg
     """.trimMargin()
     val editor = configureByText(before)
-    editor.commandState.pushModes(CommandState.Mode.VISUAL, CommandState.SubMode.VISUAL_CHARACTER)
+    editor.vim.commandState.pushModes(CommandState.Mode.VISUAL, CommandState.SubMode.VISUAL_CHARACTER)
 
     typeText(parseKeys("<A-p>"))
 
@@ -483,7 +484,7 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
       |dfkjsg
     """.trimMargin()
     val editor = configureByText(before)
-    editor.commandState.pushModes(CommandState.Mode.VISUAL, CommandState.SubMode.VISUAL_CHARACTER)
+    editor.vim.commandState.pushModes(CommandState.Mode.VISUAL, CommandState.SubMode.VISUAL_CHARACTER)
 
     typeText(parseKeys("<A-x>"))
     assertMode(CommandState.Mode.VISUAL)
@@ -571,7 +572,7 @@ fun getCellType(${s}pos$se: VisualPosition): CellType {
   fun `test ignores regex in search pattern`() {
     val before = "test ${s}t.*st${c}$se toast tallest t.*st"
     val editor = configureByText(before)
-    editor.commandState.pushModes(CommandState.Mode.VISUAL, CommandState.SubMode.VISUAL_CHARACTER)
+    editor.vim.commandState.pushModes(CommandState.Mode.VISUAL, CommandState.SubMode.VISUAL_CHARACTER)
 
     typeText(parseKeys("<A-n><A-n>"))
     val after = "test ${s}t.*st$se toast tallest ${s}t.*st$se"
diff --git a/src/test/java/org/jetbrains/plugins/ideavim/propertybased/RandomActionsPropertyTest.kt b/src/test/java/org/jetbrains/plugins/ideavim/propertybased/RandomActionsPropertyTest.kt
index 0d6c7c8f4..b62eaa547 100644
--- a/src/test/java/org/jetbrains/plugins/ideavim/propertybased/RandomActionsPropertyTest.kt
+++ b/src/test/java/org/jetbrains/plugins/ideavim/propertybased/RandomActionsPropertyTest.kt
@@ -21,9 +21,10 @@ package org.jetbrains.plugins.ideavim.propertybased
 import com.intellij.ide.IdeEventQueue
 import com.intellij.openapi.editor.Editor
 import com.intellij.testFramework.PlatformTestUtil
-import com.maddyhome.idea.vim.command.CommandState
 import com.maddyhome.idea.vim.helper.StringHelper
+import com.maddyhome.idea.vim.helper.commandState
 import com.maddyhome.idea.vim.key.CommandNode
+import com.maddyhome.idea.vim.newapi.vim
 import org.jetbrains.jetCheck.Generator
 import org.jetbrains.jetCheck.ImperativeCommand
 import org.jetbrains.jetCheck.PropertyChecker
@@ -93,7 +94,7 @@ class RandomActionsPropertyTest : VimPropertyTest() {
 
 private class AvailableActions(private val editor: Editor) : ImperativeCommand {
   override fun performCommand(env: ImperativeCommand.Environment) {
-    val currentNode = CommandState.getInstance(editor).commandBuilder.getCurrentTrie()
+    val currentNode = editor.vim.commandState.commandBuilder.getCurrentTrie()
 
     val possibleKeys = currentNode.keys.toList().sortedBy { StringHelper.toKeyNotation(it) }
     val keyGenerator = Generator.integers(0, possibleKeys.lastIndex)
diff --git a/src/test/java/org/jetbrains/plugins/ideavim/propertybased/VimPropertyTest.kt b/src/test/java/org/jetbrains/plugins/ideavim/propertybased/VimPropertyTest.kt
index a12de7b09..c22a99139 100644
--- a/src/test/java/org/jetbrains/plugins/ideavim/propertybased/VimPropertyTest.kt
+++ b/src/test/java/org/jetbrains/plugins/ideavim/propertybased/VimPropertyTest.kt
@@ -21,7 +21,6 @@ package org.jetbrains.plugins.ideavim.propertybased
 import com.intellij.openapi.editor.Editor
 import com.maddyhome.idea.vim.KeyHandler
 import com.maddyhome.idea.vim.VimPlugin
-import com.maddyhome.idea.vim.command.CommandState
 import com.maddyhome.idea.vim.group.MotionGroup
 import com.maddyhome.idea.vim.helper.commandState
 import com.maddyhome.idea.vim.newapi.vim
@@ -36,14 +35,14 @@ abstract class VimPropertyTest : VimTestCase() {
   }
 
   protected fun reset(editor: Editor) {
-    editor.commandState.mappingState.resetMappingSequence()
+    editor.vim.commandState.mappingState.resetMappingSequence()
     VimPlugin.getKey().resetKeyMappings()
 
     KeyHandler.getInstance().fullReset(editor.vim)
     VimPlugin.getRegister().resetRegisters()
     editor.caretModel.runForEachCaret { it.moveToOffset(0) }
 
-    CommandState.getInstance(editor).resetDigraph()
+    editor.vim.commandState.resetDigraph()
     VimPlugin.getSearch().resetState()
     VimPlugin.getChange().reset()
   }