diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index 0b35c4fb8151ef5ff842072fc58bf93bf77c7cef..26a7d7fbbc0478cf03e566dc769ac41a318af59d 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -53,6 +53,7 @@
 #include <texteditor/basetextmark.h>
 #include <texteditor/itexteditor.h>
 #include <texteditor/texteditorconstants.h>
+#include <texteditor/interactionsettings.h>
 #include <texteditor/tabsettings.h>
 #include <texteditor/texteditorsettings.h>
 
@@ -229,14 +230,12 @@ void FakeVimPluginPrivate::installHandler(Core::IEditor *editor)
 void FakeVimPluginPrivate::writeFile(bool *handled,
     const QString &fileName, const QString &contents)
 {
-    //qDebug() << "HANDLING WRITE FILE" << fileName << sender();
     FakeVimHandler *handler = qobject_cast<FakeVimHandler *>(sender());
     if (!handler)
         return;
 
     Core::IEditor *editor = qobject_cast<Core::IEditor *>(handler->extraData());
     if (editor && editor->file()->fileName() == fileName) {
-        //qDebug() << "HANDLING CORE SAVE";
         // Handle that as a special case for nicer interaction with core
         Core::IFile *file = editor->file();
         m_core->fileManager()->blockFileChange(file);
@@ -261,6 +260,13 @@ void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
     Q_UNUSED(editor);
     //qDebug() << "OPENING: " << editor << editor->widget();
     //installHandler(editor);
+    QWidget *widget = editor->widget();
+    if (BaseTextEditor *bt = qobject_cast<BaseTextEditor *>(widget)) {
+        InteractionSettings settings = bt->interactionSettings();
+        qDebug() << "USE VIM: " << settings.m_useVim;
+        if (settings.m_useVim)
+            installHandler(editor);
+    }
 }
 
 void FakeVimPluginPrivate::editorAboutToClose(Core::IEditor *editor)
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 0e058ff752e1635b472cae29a82070d4abeaa7e9..718c1f736ab4cf43097755c9dbbaf92a5551d5b7 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -2709,6 +2709,10 @@ const DisplaySettings &BaseTextEditor::displaySettings() const
     return d->m_displaySettings;
 }
 
+const InteractionSettings &BaseTextEditor::interactionSettings() const
+{
+    return d->m_interactionSettings;
+}
 
 
 void BaseTextEditor::indentOrUnindent(bool doIndent)
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index e5e79d4a4a2efc24cc794b5ca7debacc77ea889d..7724f277356bdb58dbf952cbd9714432f59ef079 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -37,6 +37,7 @@
 
 #include "displaysettings.h"
 #include "tabsettings.h"
+#include "interactionsettings.h"
 #include "itexteditable.h"
 
 #include <QtGui/QPlainTextEdit>
@@ -88,7 +89,8 @@ struct TEXTEDITOR_EXPORT Parenthesis
 
 
 
-class TEXTEDITOR_EXPORT TextBlockUserData : public QTextBlockUserData {
+class TEXTEDITOR_EXPORT TextBlockUserData : public QTextBlockUserData
+{
 public:
 
     enum CollapseMode { NoCollapse , CollapseThis, CollapseAfter };
@@ -382,9 +384,9 @@ public:
     virtual void extraAreaMouseEvent(QMouseEvent *);
     virtual void extraAreaLeaveEvent(QEvent *);
 
-
     const TabSettings &tabSettings() const;
     const DisplaySettings &displaySettings() const;
+    const InteractionSettings &interactionSettings() const;
 
     void markBlocksAsChanged(QList<int> blockNumbers);
 
@@ -402,9 +404,12 @@ public:
     void setExtraSelections(ExtraSelectionKind kind, const QList<QTextEdit::ExtraSelection> &selections);
     QList<QTextEdit::ExtraSelection> extraSelections(ExtraSelectionKind kind) const;
 
-    struct BlockRange {
-        BlockRange():first(0), last(-1){}
-        BlockRange(int first_position, int last_position):first(first_position), last(last_position){}
+    struct BlockRange
+    {
+        BlockRange() : first(0), last(-1) {}
+        BlockRange(int first_position, int last_position)
+          : first(first_position), last(last_position)
+        {}
         int first;
         int last;
         inline bool isNull() const { return last < first; }
@@ -413,7 +418,6 @@ public:
     // the blocks list must be sorted
     void setIfdefedOutBlocks(const QList<BaseTextEditor::BlockRange> &blocks);
 
-
 public slots:
     virtual void setTabSettings(const TextEditor::TabSettings &);
     virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
@@ -442,8 +446,6 @@ protected slots:
     virtual void slotCursorPositionChanged();
     virtual void slotUpdateBlockNotify(const QTextBlock &);
 
-
-
 signals:
     void requestBlockUpdate(const QTextBlock &);
     void requestAutoCompletion(ITextEditable *editor, bool forced);
diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h
index 3310b0665d2d8e538a42e54293d7d491fb8a81da..270b7444f42953a712557d52e9081d131b84fbb8 100644
--- a/src/plugins/texteditor/basetexteditor_p.h
+++ b/src/plugins/texteditor/basetexteditor_p.h
@@ -165,6 +165,7 @@ public:
 
     QWidget *m_extraArea;
     DisplaySettings m_displaySettings;
+    InteractionSettings m_interactionSettings;
 
     int extraAreaSelectionAnchorBlockNumber;
     int extraAreaToggleMarkBlockNumber;
diff --git a/src/plugins/texteditor/generalsettingspage.cpp b/src/plugins/texteditor/generalsettingspage.cpp
index 7be7bca1f4b3fc5e3c272a3509f419dbb55aeeea..ec3c6178d16de23982653a4462b26ef12d8165b8 100644
--- a/src/plugins/texteditor/generalsettingspage.cpp
+++ b/src/plugins/texteditor/generalsettingspage.cpp
@@ -33,6 +33,7 @@
 
 #include "displaysettings.h"
 #include "generalsettingspage.h"
+#include "interactionsettings.h"
 #include "storagesettings.h"
 #include "tabsettings.h"
 #include "ui_generalsettingspage.h"
@@ -53,6 +54,7 @@ struct GeneralSettingsPage::GeneralSettingsPagePrivate
     TabSettings m_tabSettings;
     StorageSettings m_storageSettings;
     DisplaySettings m_displaySettings;
+    InteractionSettings m_interactionSettings;
 };
 
 GeneralSettingsPage::GeneralSettingsPagePrivate::GeneralSettingsPagePrivate
@@ -63,6 +65,7 @@ GeneralSettingsPage::GeneralSettingsPagePrivate::GeneralSettingsPagePrivate
         m_tabSettings.fromSettings(m_parameters.settingsPrefix, s);
         m_storageSettings.fromSettings(m_parameters.settingsPrefix, s);
         m_displaySettings.fromSettings(m_parameters.settingsPrefix, s);
+        m_interactionSettings.fromSettings(m_parameters.settingsPrefix, s);
     }
 }
 
@@ -106,8 +109,11 @@ void GeneralSettingsPage::apply()
     TabSettings newTabSettings;
     StorageSettings newStorageSettings;
     DisplaySettings newDisplaySettings;
+    InteractionSettings newInteractionSettings;
+
+    settingsFromUI(newTabSettings, newStorageSettings, newDisplaySettings,
+        newInteractionSettings);
 
-    settingsFromUI(newTabSettings, newStorageSettings, newDisplaySettings);
     Core::ICore *core = Core::ICore::instance();
 
     if (newTabSettings != m_d->m_tabSettings) {
@@ -133,11 +139,20 @@ void GeneralSettingsPage::apply()
 
         emit displaySettingsChanged(newDisplaySettings);
     }
+
+    if (newInteractionSettings != m_d->m_interactionSettings) {
+        m_d->m_interactionSettings = newInteractionSettings;
+        if (QSettings *s = core->settings())
+            m_d->m_interactionSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
+
+        emit interactionSettingsChanged(newInteractionSettings);
+    }
 }
 
 void GeneralSettingsPage::settingsFromUI(TabSettings &rc,
                                          StorageSettings &storageSettings,
-                                         DisplaySettings &displaySettings) const
+                                         DisplaySettings &displaySettings,
+                                         InteractionSettings &interactionSettings) const
 {
     rc.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked();
     rc.m_autoIndent = m_d->m_page.autoIndent->isChecked();
@@ -156,6 +171,8 @@ void GeneralSettingsPage::settingsFromUI(TabSettings &rc,
     displaySettings.m_visualizeWhitespace = m_d->m_page.visualizeWhitespace->isChecked();
     displaySettings.m_displayFoldingMarkers = m_d->m_page.displayFoldingMarkers->isChecked();
     displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked();
+
+    interactionSettings.m_useVim = m_d->m_page.useVim->isChecked();
 }
 
 void GeneralSettingsPage::settingsToUI()
@@ -180,6 +197,9 @@ void GeneralSettingsPage::settingsToUI()
     m_d->m_page.visualizeWhitespace->setChecked(displaySettings.m_visualizeWhitespace);
     m_d->m_page.displayFoldingMarkers->setChecked(displaySettings.m_displayFoldingMarkers);
     m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine);
+
+    InteractionSettings interactionSettings = m_d->m_interactionSettings;
+    m_d->m_page.useVim->setChecked(interactionSettings.m_useVim);
 }
 
 TabSettings GeneralSettingsPage::tabSettings() const
@@ -197,6 +217,11 @@ DisplaySettings GeneralSettingsPage::displaySettings() const
     return m_d->m_displaySettings;
 }
 
+InteractionSettings GeneralSettingsPage::interactionSettings() const
+{
+    return m_d->m_interactionSettings;
+}
+
 void GeneralSettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySettings)
 {
     if (newDisplaySettings != m_d->m_displaySettings) {
diff --git a/src/plugins/texteditor/generalsettingspage.h b/src/plugins/texteditor/generalsettingspage.h
index 5eb9c0811c23b9f761e2b3a8e1f37c11486646e1..7679d7b16db5f0f3c14935ae3a8a099dd6b98fb4 100644
--- a/src/plugins/texteditor/generalsettingspage.h
+++ b/src/plugins/texteditor/generalsettingspage.h
@@ -45,6 +45,7 @@ namespace TextEditor {
 struct TabSettings;
 struct StorageSettings;
 struct DisplaySettings;
+struct InteractionSettings;
 
 struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters
 {
@@ -74,6 +75,7 @@ public:
     TabSettings tabSettings() const;
     StorageSettings storageSettings() const;
     DisplaySettings displaySettings() const;
+    InteractionSettings interactionSettings() const;
 
     void setDisplaySettings(const DisplaySettings &);
 
@@ -81,11 +83,14 @@ signals:
     void tabSettingsChanged(const TextEditor::TabSettings &);
     void storageSettingsChanged(const TextEditor::StorageSettings &);
     void displaySettingsChanged(const TextEditor::DisplaySettings &);
+    void interactionSettingsChanged(const TextEditor::InteractionSettings &);
 
 private:
     void settingsFromUI(TabSettings &rc,
                         StorageSettings &storageSettings,
-                        DisplaySettings &displaySettings) const;
+                        DisplaySettings &displaySettings,
+                        InteractionSettings &interactionSettings
+        ) const;
     void settingsToUI();
     struct GeneralSettingsPagePrivate;
     GeneralSettingsPagePrivate *m_d;
diff --git a/src/plugins/texteditor/generalsettingspage.ui b/src/plugins/texteditor/generalsettingspage.ui
index 5f2be53a13fb539599852f4216dbe5f302cee14b..58b6bdbc0aa8e0bdfdaf9627c4537e5c02c9fa59 100644
--- a/src/plugins/texteditor/generalsettingspage.ui
+++ b/src/plugins/texteditor/generalsettingspage.ui
@@ -296,7 +296,7 @@
      </property>
      <layout class="QGridLayout" name="gridLayout_2">
       <item row="0" column="0">
-       <widget class="QCheckBox" name="checkBoxVim">
+       <widget class="QCheckBox" name="useVim">
         <property name="text">
          <string>Use &quot;vi&quot; style editing</string>
         </property>
diff --git a/src/plugins/texteditor/interactionsettings.cpp b/src/plugins/texteditor/interactionsettings.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ae3be5203f6f0f189a43feac41a2d6b82808655a
--- /dev/null
+++ b/src/plugins/texteditor/interactionsettings.cpp
@@ -0,0 +1,73 @@
+/***************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact:  Qt Software Information (qt-info@nokia.com)
+**
+**
+** Non-Open Source Usage
+**
+** Licensees may use this file in accordance with the Qt Beta Version
+** License Agreement, Agreement version 2.2 provided with the Software or,
+** alternatively, in accordance with the terms contained in a written
+** agreement between you and Nokia.
+**
+** GNU General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the packaging
+** of this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+**
+** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt GPL Exception
+** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
+**
+***************************************************************************/
+
+#include "interactionsettings.h"
+
+#include <QSettings>
+#include <QString>
+
+namespace TextEditor {
+
+static const char *useVimKey = "useVim";
+static const char *groupPostfix = "InteractionSettings";
+
+InteractionSettings::InteractionSettings()
+    : m_useVim(false)
+{
+}
+
+void InteractionSettings::toSettings(const QString &category, QSettings *s) const
+{
+    QString group = QLatin1String(groupPostfix);
+    if (!category.isEmpty())
+        group.insert(0, category);
+    s->beginGroup(group);
+    s->setValue(QLatin1String(useVimKey), m_useVim);
+    s->endGroup();
+}
+
+void InteractionSettings::fromSettings(const QString &category, const QSettings *s)
+{
+    QString group = QLatin1String(groupPostfix);
+    if (!category.isEmpty())
+        group.insert(0, category);
+    group += QLatin1Char('/');
+    m_useVim = s->value(group + QLatin1String(useVimKey), m_useVim).toBool();
+}
+
+bool InteractionSettings::equals(const InteractionSettings &ts) const
+{
+    return m_useVim == ts.m_useVim;
+}
+
+} // namespace TextEditor
diff --git a/src/plugins/texteditor/interactionsettings.h b/src/plugins/texteditor/interactionsettings.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc1ad0fe836cbdf76ab76d00093bf52d89aff4e2
--- /dev/null
+++ b/src/plugins/texteditor/interactionsettings.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact:  Qt Software Information (qt-info@nokia.com)
+**
+**
+** Non-Open Source Usage
+**
+** Licensees may use this file in accordance with the Qt Beta Version
+** License Agreement, Agreement version 2.2 provided with the Software or,
+** alternatively, in accordance with the terms contained in a written
+** agreement between you and Nokia.
+**
+** GNU General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the packaging
+** of this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+**
+** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt GPL Exception
+** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
+**
+***************************************************************************/
+
+#ifndef INTERACTIONSETTINGS_H
+#define INTERACTIONSETTINGS_H
+
+#include "texteditor_global.h"
+
+QT_BEGIN_NAMESPACE
+class QSettings;
+QT_END_NAMESPACE
+
+namespace TextEditor {
+
+struct TEXTEDITOR_EXPORT InteractionSettings
+{
+    InteractionSettings();
+
+    void toSettings(const QString &category, QSettings *s) const;
+    void fromSettings(const QString &category, const QSettings *s);
+
+    bool equals(const InteractionSettings &ts) const;
+
+    bool m_useVim;
+};
+
+inline bool operator==(const InteractionSettings &t1, const InteractionSettings &t2) { return t1.equals(t2); }
+inline bool operator!=(const InteractionSettings &t1, const InteractionSettings &t2) { return !t1.equals(t2); }
+
+} // namespace TextEditor
+
+#endif // INTERACTIONSETTINGS_H
diff --git a/src/plugins/texteditor/tabsettings.cpp b/src/plugins/texteditor/tabsettings.cpp
index 46d4100112f57f0a528944073fd5421cfa6fcbc2..5e61d0b4b8a991e0b3d626cf6de131db930cac59 100644
--- a/src/plugins/texteditor/tabsettings.cpp
+++ b/src/plugins/texteditor/tabsettings.cpp
@@ -33,18 +33,18 @@
 
 #include "tabsettings.h"
 
+#include <QtCore/QDebug>
 #include <QtCore/QSettings>
 #include <QtCore/QString>
 #include <QtGui/QTextCursor>
 #include <QtGui/QTextDocument>
-#include <QDebug>
-
-static const char* spacesForTabsKey = "SpacesForTabs";
-static const char* smartBackspaceKey = "SmartBackspace";
-static const char* autoIndentKey = "AutoIndent";
-static const char* tabSizeKey = "TabSize";
-static const char* indentSizeKey = "IndentSize";
-static const char* groupPostfix = "TabSettings";
+
+static const char *spacesForTabsKey = "SpacesForTabs";
+static const char *smartBackspaceKey = "SmartBackspace";
+static const char *autoIndentKey = "AutoIndent";
+static const char *tabSizeKey = "TabSize";
+static const char *indentSizeKey = "IndentSize";
+static const char *groupPostfix = "TabSettings";
 
 namespace TextEditor {
 
diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro
index 59c9cc4bb4130604e4e4c01a3b927d4d236bf23d..56c39604fb4a944c190683a1b9fae7f8f3c824f2 100644
--- a/src/plugins/texteditor/texteditor.pro
+++ b/src/plugins/texteditor/texteditor.pro
@@ -13,6 +13,7 @@ SOURCES += texteditorplugin.cpp \
     completionsupport.cpp \
     completionwidget.cpp \
     fontsettingspage.cpp \
+    interactionsettings.cpp \
     tabsettings.cpp \
     storagesettings.cpp \
     displaysettings.cpp \
@@ -37,6 +38,7 @@ HEADERS += texteditorplugin.h \
     texteditoractionhandler.h \
     fontsettingspage.h \
     icompletioncollector.h \
+    interactionsettings.h \
     texteditorconstants.h \
     tabsettings.h \
     storagesettings.h \
diff --git a/src/plugins/texteditor/texteditorsettings.h b/src/plugins/texteditor/texteditorsettings.h
index fda32d20faed52b8783e466d33eb17c8a7b8417d..032a8a139af445fab434145f01a5b2d55c94dc85 100644
--- a/src/plugins/texteditor/texteditorsettings.h
+++ b/src/plugins/texteditor/texteditorsettings.h
@@ -46,6 +46,7 @@ class FontSettings;
 struct TabSettings;
 struct StorageSettings;
 struct DisplaySettings;
+struct InteractionSettings;
 
 namespace Internal {
 class TextEditorPlugin;
@@ -70,12 +71,14 @@ public:
     TabSettings tabSettings() const;
     StorageSettings storageSettings() const;
     DisplaySettings displaySettings() const;
+    InteractionSettings interactionSettings() const;
 
 signals:
     void fontSettingsChanged(const TextEditor::FontSettings &);
     void tabSettingsChanged(const TextEditor::TabSettings &);
     void storageSettingsChanged(const TextEditor::StorageSettings &);
     void displaySettingsChanged(const TextEditor::DisplaySettings &);
+    void interactionSettingsChanged(const TextEditor::InteractionSettings &);
 
 private:
     TextEditor::FontSettingsPage *m_fontSettingsPage;