forked from qt-creator/qt-creator
FakeVim: Use a FilePathAspect for .vimrc
Even if it's not used as such, it would be the right thing to use. Change-Id: I7f8931b581af6a97231c49c20e7adc56ad2efff6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -134,7 +134,6 @@ FakeVimSettings::FakeVimSettings()
|
|||||||
vimRcPath.setToolTip(Tr::tr("Keep empty to use the default path, i.e. "
|
vimRcPath.setToolTip(Tr::tr("Keep empty to use the default path, i.e. "
|
||||||
"%USERPROFILE%\\_vimrc on Windows, ~/.vimrc otherwise."));
|
"%USERPROFILE%\\_vimrc on Windows, ~/.vimrc otherwise."));
|
||||||
vimRcPath.setPlaceHolderText(Tr::tr("Default: %1").arg(vimrcDefault));
|
vimRcPath.setPlaceHolderText(Tr::tr("Default: %1").arg(vimrcDefault));
|
||||||
vimRcPath.setDisplayStyle(FvStringAspect::PathChooserDisplay);
|
|
||||||
|
|
||||||
setLayouter([this] {
|
setLayouter([this] {
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
|
@@ -4,7 +4,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FAKEVIM_STANDALONE
|
#ifndef FAKEVIM_STANDALONE
|
||||||
# include <coreplugin/dialogs/ioptionspage.h>
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
namespace Utils { class FilePath {}; }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -69,6 +75,7 @@ public:
|
|||||||
using FvBoolAspect = FvTypedAspect<bool>;
|
using FvBoolAspect = FvTypedAspect<bool>;
|
||||||
using FvIntegerAspect = FvTypedAspect<qint64>;
|
using FvIntegerAspect = FvTypedAspect<qint64>;
|
||||||
using FvStringAspect = FvTypedAspect<QString>;
|
using FvStringAspect = FvTypedAspect<QString>;
|
||||||
|
using FvFilePathAspect = FvTypedAspect<Utils::FilePath>;
|
||||||
|
|
||||||
class FvAspectContainer : public FvBaseAspect
|
class FvAspectContainer : public FvBaseAspect
|
||||||
{
|
{
|
||||||
@@ -82,6 +89,7 @@ using FvBaseAspect = Utils::BaseAspect;
|
|||||||
using FvBoolAspect = Utils::BoolAspect;
|
using FvBoolAspect = Utils::BoolAspect;
|
||||||
using FvIntegerAspect = Utils::IntegerAspect;
|
using FvIntegerAspect = Utils::IntegerAspect;
|
||||||
using FvStringAspect = Utils::StringAspect;
|
using FvStringAspect = Utils::StringAspect;
|
||||||
|
using FvFilePathAspect = Utils::FilePathAspect;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -96,7 +104,7 @@ public:
|
|||||||
|
|
||||||
FvBoolAspect useFakeVim;
|
FvBoolAspect useFakeVim;
|
||||||
FvBoolAspect readVimRc;
|
FvBoolAspect readVimRc;
|
||||||
FvStringAspect vimRcPath;
|
FvFilePathAspect vimRcPath;
|
||||||
|
|
||||||
FvBoolAspect startOfLine;
|
FvBoolAspect startOfLine;
|
||||||
FvIntegerAspect tabStop;
|
FvIntegerAspect tabStop;
|
||||||
|
@@ -1183,7 +1183,7 @@ void FakeVimPluginPrivate::maybeReadVimRc()
|
|||||||
//qDebug() << theFakeVimSetting(ConfigShiftWidth)->value();
|
//qDebug() << theFakeVimSetting(ConfigShiftWidth)->value();
|
||||||
if (!settings().readVimRc())
|
if (!settings().readVimRc())
|
||||||
return;
|
return;
|
||||||
QString fileName = settings().vimRcPath();
|
QString fileName = settings().vimRcPath().path();
|
||||||
if (fileName.isEmpty()) {
|
if (fileName.isEmpty()) {
|
||||||
fileName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
|
fileName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
|
||||||
+ QLatin1String(HostOsInfo::isWindowsHost() ? "/_vimrc" : "/.vimrc");
|
+ QLatin1String(HostOsInfo::isWindowsHost() ? "/_vimrc" : "/.vimrc");
|
||||||
|
Reference in New Issue
Block a user