diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index af363781457c4878a3f6b4e4893ac7cb62a8ad5a..65f0efe8b07ee948be01658b263770f923c9d6df 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -2001,6 +2001,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(int key, int,
         moveUp(count() * (linesOnScreen() - 2));
         m_lastInsertion.clear();
     } else if (key == Key_Tab && hasConfig(ConfigExpandTab)) {
+        m_justAutoIndented = 0;
         int ts = config(ConfigTabStop).toInt();
         int col = cursorColumnInDocument();
         QString str = QString(ts - col % ts, ' ');
@@ -2016,7 +2017,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(int key, int,
         } else {
             joinPreviousEditBlock();
         }
-        m_justAutoIndented = false;
+        m_justAutoIndented = 0;
         m_lastInsertion.append(text);
         if (m_submode == ReplaceSubMode) {
             if (atEndOfLine())