forked from qt-creator/qt-creator
FakeVim: User-settable path to .vimrc with saner default for Windows
Path to .vimrc configuration file can be set in options if "Read .vimrc" option is enabled. Default path for .vimrc is %USERPROFILE%/_vimrc on Windows, ~/.vimrc otherwise. Task-number: QTCREATORBUG-8748 Change-Id: I61ff8484e7635ce7a9361e2ad5cd3943e15613c1 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -142,6 +142,13 @@ FakeVimSettings *theFakeVimSettings()
|
|||||||
item->setValue(false);
|
item->setValue(false);
|
||||||
instance->insertItem(ConfigReadVimRc, item);
|
instance->insertItem(ConfigReadVimRc, item);
|
||||||
|
|
||||||
|
item = new SavedAction(instance);
|
||||||
|
item->setText(QCoreApplication::translate("FakeVim::Internal",
|
||||||
|
"Path to .vimrc"));
|
||||||
|
item->setDefaultValue(QString());
|
||||||
|
item->setSettingsKey(group, _("VimRcPath"));
|
||||||
|
instance->insertItem(ConfigVimRcPath, item);
|
||||||
|
|
||||||
item = new SavedAction(instance);
|
item = new SavedAction(instance);
|
||||||
item->setValue(true);
|
item->setValue(true);
|
||||||
item->setDefaultValue(true);
|
item->setDefaultValue(true);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ enum FakeVimSettingsCode
|
|||||||
{
|
{
|
||||||
ConfigUseFakeVim,
|
ConfigUseFakeVim,
|
||||||
ConfigReadVimRc,
|
ConfigReadVimRc,
|
||||||
|
ConfigVimRcPath,
|
||||||
|
|
||||||
ConfigStartOfLine,
|
ConfigStartOfLine,
|
||||||
ConfigHlSearch,
|
ConfigHlSearch,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>513</width>
|
<width>513</width>
|
||||||
<height>464</height>
|
<height>468</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@@ -24,164 +24,6 @@
|
|||||||
<string>Vim Behavior</string>
|
<string>Vim Behavior</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxPassControlKey">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Pass key sequences like Ctrl-S to Qt Creator core instead of interpreting them in FakeVim. This gives easier access to Qt Creator core functionality at the price of losing some features of FakeVim.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Pass control key</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxHlSearch">
|
|
||||||
<property name="text">
|
|
||||||
<string>Highlight search results</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxIncSearch">
|
|
||||||
<property name="text">
|
|
||||||
<string>Incremental search</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxStartOfLine">
|
|
||||||
<property name="text">
|
|
||||||
<string>Start of line</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxSmartIndent">
|
|
||||||
<property name="text">
|
|
||||||
<string>Smart indentation</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxAutoIndent">
|
|
||||||
<property name="text">
|
|
||||||
<string>Automatic indentation</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1" colspan="2">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBoxTabStop">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>80</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="0">
|
|
||||||
<widget class="QLabel" name="labelBackspace">
|
|
||||||
<property name="text">
|
|
||||||
<string>Backspace:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1" colspan="2">
|
|
||||||
<widget class="QLineEdit" name="lineEditBackspace"/>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="0">
|
|
||||||
<widget class="QLabel" name="labelIsKeyword">
|
|
||||||
<property name="text">
|
|
||||||
<string>Keyword characters:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="labelTabulator">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Vim tabstop option</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Tabulator size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="12" column="0" colspan="3">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButtonCopyTextEditorSettings">
|
|
||||||
<property name="text">
|
|
||||||
<string>Copy Text Editor Settings</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButtonSetQtStyle">
|
|
||||||
<property name="text">
|
|
||||||
<string>Set Qt Style</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButtonSetPlainStyle">
|
|
||||||
<property name="text">
|
|
||||||
<string>Set Plain Style</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="labelShiftWidth">
|
|
||||||
<property name="text">
|
|
||||||
<string>Shift width:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxExpandTab">
|
|
||||||
<property name="text">
|
|
||||||
<string>Expand tabulators</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxShowMarks">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show position of text marks</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="checkBoxSmartTab">
|
<widget class="QCheckBox" name="checkBoxSmartTab">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -192,7 +34,7 @@
|
|||||||
<item row="10" column="1" colspan="2">
|
<item row="10" column="1" colspan="2">
|
||||||
<widget class="QLineEdit" name="lineEditIsKeyword"/>
|
<widget class="QLineEdit" name="lineEditIsKeyword"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="0">
|
<item row="12" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -215,17 +57,48 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QCheckBox" name="checkBoxSmartCase">
|
<widget class="QCheckBox" name="checkBoxStartOfLine">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use smartcase</string>
|
<string>Start of line</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="checkBoxWrapScan">
|
<widget class="QCheckBox" name="checkBoxSmartIndent">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use wrapscan</string>
|
<string>Smart indentation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxExpandTab">
|
||||||
|
<property name="text">
|
||||||
|
<string>Expand tabulators</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxAutoIndent">
|
||||||
|
<property name="text">
|
||||||
|
<string>Automatic indentation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxPassControlKey">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Pass key sequences like Ctrl-S to Qt Creator core instead of interpreting them in FakeVim. This gives easier access to Qt Creator core functionality at the price of losing some features of FakeVim.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Pass control key</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxHlSearch">
|
||||||
|
<property name="text">
|
||||||
|
<string>Highlight search results</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -263,6 +136,140 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<widget class="QLabel" name="labelBackspace">
|
||||||
|
<property name="text">
|
||||||
|
<string>Backspace:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="labelTabulator">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Vim tabstop option</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Tabulator size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="lineEditBackspace"/>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="labelShiftWidth">
|
||||||
|
<property name="text">
|
||||||
|
<string>Shift width:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxIncSearch">
|
||||||
|
<property name="text">
|
||||||
|
<string>Incremental search</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="0" colspan="3">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonCopyTextEditorSettings">
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy Text Editor Settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonSetQtStyle">
|
||||||
|
<property name="text">
|
||||||
|
<string>Set Qt Style</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonSetPlainStyle">
|
||||||
|
<property name="text">
|
||||||
|
<string>Set Plain Style</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxShowMarks">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show position of text marks</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxSmartCase">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use smartcase</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxWrapScan">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use wrapscan</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBoxTabStop">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>80</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="0">
|
||||||
|
<widget class="QLabel" name="labelIsKeyword">
|
||||||
|
<property name="text">
|
||||||
|
<string>Keyword characters:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="0">
|
||||||
|
<widget class="QLabel" name="labelVimRcPath">
|
||||||
|
<property name="text">
|
||||||
|
<string>Location of .vimrc:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="6" column="2">
|
||||||
<widget class="QCheckBox" name="checkBoxReadVimRc">
|
<widget class="QCheckBox" name="checkBoxReadVimRc">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -270,6 +277,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="11" column="1" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayoutVimRcPath">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditVimRcPath">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Keep empty to use the default path, i.e. %USERPROFILE%\_vimrc on Windows, ~/.vimrc otherwise.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonVimRcPath">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -303,10 +328,13 @@
|
|||||||
<tabstop>checkBoxWrapScan</tabstop>
|
<tabstop>checkBoxWrapScan</tabstop>
|
||||||
<tabstop>checkBoxShowMarks</tabstop>
|
<tabstop>checkBoxShowMarks</tabstop>
|
||||||
<tabstop>checkBoxPassControlKey</tabstop>
|
<tabstop>checkBoxPassControlKey</tabstop>
|
||||||
|
<tabstop>checkBoxReadVimRc</tabstop>
|
||||||
<tabstop>spinBoxShiftWidth</tabstop>
|
<tabstop>spinBoxShiftWidth</tabstop>
|
||||||
<tabstop>spinBoxTabStop</tabstop>
|
<tabstop>spinBoxTabStop</tabstop>
|
||||||
<tabstop>lineEditBackspace</tabstop>
|
<tabstop>lineEditBackspace</tabstop>
|
||||||
<tabstop>lineEditIsKeyword</tabstop>
|
<tabstop>lineEditIsKeyword</tabstop>
|
||||||
|
<tabstop>lineEditVimRcPath</tabstop>
|
||||||
|
<tabstop>pushButtonVimRcPath</tabstop>
|
||||||
<tabstop>pushButtonCopyTextEditorSettings</tabstop>
|
<tabstop>pushButtonCopyTextEditorSettings</tabstop>
|
||||||
<tabstop>pushButtonSetQtStyle</tabstop>
|
<tabstop>pushButtonSetQtStyle</tabstop>
|
||||||
<tabstop>pushButtonSetPlainStyle</tabstop>
|
<tabstop>pushButtonSetPlainStyle</tabstop>
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
#include <find/textfindconstants.h>
|
#include <find/textfindconstants.h>
|
||||||
#include <find/ifindsupport.h>
|
#include <find/ifindsupport.h>
|
||||||
|
|
||||||
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
#include <utils/treewidgetcolumnstretcher.h>
|
#include <utils/treewidgetcolumnstretcher.h>
|
||||||
@@ -83,6 +84,7 @@
|
|||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QFileDialog>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@@ -254,6 +256,8 @@ private slots:
|
|||||||
void copyTextEditorSettings();
|
void copyTextEditorSettings();
|
||||||
void setQtStyle();
|
void setQtStyle();
|
||||||
void setPlainStyle();
|
void setPlainStyle();
|
||||||
|
void openVimRc();
|
||||||
|
void updateVimRcWidgets();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class DebuggerPlugin;
|
friend class DebuggerPlugin;
|
||||||
@@ -272,6 +276,8 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
|
|||||||
m_ui.checkBoxUseFakeVim);
|
m_ui.checkBoxUseFakeVim);
|
||||||
m_group.insert(theFakeVimSetting(ConfigReadVimRc),
|
m_group.insert(theFakeVimSetting(ConfigReadVimRc),
|
||||||
m_ui.checkBoxReadVimRc);
|
m_ui.checkBoxReadVimRc);
|
||||||
|
m_group.insert(theFakeVimSetting(ConfigVimRcPath),
|
||||||
|
m_ui.lineEditVimRcPath);
|
||||||
|
|
||||||
m_group.insert(theFakeVimSetting(ConfigExpandTab),
|
m_group.insert(theFakeVimSetting(ConfigExpandTab),
|
||||||
m_ui.checkBoxExpandTab);
|
m_ui.checkBoxExpandTab);
|
||||||
@@ -318,6 +324,11 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
|
|||||||
SLOT(setQtStyle()));
|
SLOT(setQtStyle()));
|
||||||
connect(m_ui.pushButtonSetPlainStyle, SIGNAL(clicked()),
|
connect(m_ui.pushButtonSetPlainStyle, SIGNAL(clicked()),
|
||||||
SLOT(setPlainStyle()));
|
SLOT(setPlainStyle()));
|
||||||
|
connect(m_ui.pushButtonVimRcPath, SIGNAL(clicked()),
|
||||||
|
SLOT(openVimRc()));
|
||||||
|
connect(m_ui.checkBoxReadVimRc, SIGNAL(stateChanged(int)),
|
||||||
|
SLOT(updateVimRcWidgets()));
|
||||||
|
updateVimRcWidgets();
|
||||||
|
|
||||||
if (m_searchKeywords.isEmpty()) {
|
if (m_searchKeywords.isEmpty()) {
|
||||||
QLatin1Char sep(' ');
|
QLatin1Char sep(' ');
|
||||||
@@ -382,6 +393,21 @@ void FakeVimOptionPage::setPlainStyle()
|
|||||||
m_ui.lineEditBackspace->setText(QString());
|
m_ui.lineEditBackspace->setText(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FakeVimOptionPage::openVimRc()
|
||||||
|
{
|
||||||
|
const QString fileName = QFileDialog::getOpenFileName();
|
||||||
|
if (!fileName.isNull())
|
||||||
|
m_ui.lineEditVimRcPath->setText(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FakeVimOptionPage::updateVimRcWidgets()
|
||||||
|
{
|
||||||
|
bool enabled = m_ui.checkBoxReadVimRc->isChecked();
|
||||||
|
m_ui.labelVimRcPath->setEnabled(enabled);
|
||||||
|
m_ui.lineEditVimRcPath->setEnabled(enabled);
|
||||||
|
m_ui.pushButtonVimRcPath->setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
bool FakeVimOptionPage::matches(const QString &s) const
|
bool FakeVimOptionPage::matches(const QString &s) const
|
||||||
{
|
{
|
||||||
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
||||||
@@ -1066,6 +1092,8 @@ bool FakeVimPluginPrivate::initialize()
|
|||||||
this, SLOT(setUseFakeVim(QVariant)));
|
this, SLOT(setUseFakeVim(QVariant)));
|
||||||
connect(theFakeVimSetting(ConfigReadVimRc), SIGNAL(valueChanged(QVariant)),
|
connect(theFakeVimSetting(ConfigReadVimRc), SIGNAL(valueChanged(QVariant)),
|
||||||
this, SLOT(maybeReadVimRc()));
|
this, SLOT(maybeReadVimRc()));
|
||||||
|
connect(theFakeVimSetting(ConfigVimRcPath), SIGNAL(valueChanged(QVariant)),
|
||||||
|
this, SLOT(maybeReadVimRc()));
|
||||||
|
|
||||||
// Delayed operations.
|
// Delayed operations.
|
||||||
connect(this, SIGNAL(delayedQuitRequested(bool,Core::IEditor*)),
|
connect(this, SIGNAL(delayedQuitRequested(bool,Core::IEditor*)),
|
||||||
@@ -1185,9 +1213,11 @@ void FakeVimPluginPrivate::maybeReadVimRc()
|
|||||||
//qDebug() << theFakeVimSetting(ConfigShiftWidth)->value();
|
//qDebug() << theFakeVimSetting(ConfigShiftWidth)->value();
|
||||||
if (!theFakeVimSetting(ConfigReadVimRc)->value().toBool())
|
if (!theFakeVimSetting(ConfigReadVimRc)->value().toBool())
|
||||||
return;
|
return;
|
||||||
QString fileName =
|
QString fileName = theFakeVimSetting(ConfigVimRcPath)->value().toString();
|
||||||
QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
|
if (fileName.isEmpty()) {
|
||||||
+ _("/.vimrc");
|
fileName = QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
|
||||||
|
+ (Utils::HostOsInfo::isWindowsHost() ? _("/_vimrc") : _("/.vimrc"));
|
||||||
|
}
|
||||||
//qDebug() << "READING VIMRC: " << fileName;
|
//qDebug() << "READING VIMRC: " << fileName;
|
||||||
// Read it into a temporary handler for effects modifying global state.
|
// Read it into a temporary handler for effects modifying global state.
|
||||||
QPlainTextEdit editor;
|
QPlainTextEdit editor;
|
||||||
|
|||||||
Reference in New Issue
Block a user