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. "
|
||||
"%USERPROFILE%\\_vimrc on Windows, ~/.vimrc otherwise."));
|
||||
vimRcPath.setPlaceHolderText(Tr::tr("Default: %1").arg(vimrcDefault));
|
||||
vimRcPath.setDisplayStyle(FvStringAspect::PathChooserDisplay);
|
||||
|
||||
setLayouter([this] {
|
||||
using namespace Layouting;
|
||||
|
@@ -4,7 +4,13 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef FAKEVIM_STANDALONE
|
||||
# include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#else
|
||||
|
||||
namespace Utils { class FilePath {}; }
|
||||
|
||||
#endif
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -69,6 +75,7 @@ public:
|
||||
using FvBoolAspect = FvTypedAspect<bool>;
|
||||
using FvIntegerAspect = FvTypedAspect<qint64>;
|
||||
using FvStringAspect = FvTypedAspect<QString>;
|
||||
using FvFilePathAspect = FvTypedAspect<Utils::FilePath>;
|
||||
|
||||
class FvAspectContainer : public FvBaseAspect
|
||||
{
|
||||
@@ -82,6 +89,7 @@ using FvBaseAspect = Utils::BaseAspect;
|
||||
using FvBoolAspect = Utils::BoolAspect;
|
||||
using FvIntegerAspect = Utils::IntegerAspect;
|
||||
using FvStringAspect = Utils::StringAspect;
|
||||
using FvFilePathAspect = Utils::FilePathAspect;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -96,7 +104,7 @@ public:
|
||||
|
||||
FvBoolAspect useFakeVim;
|
||||
FvBoolAspect readVimRc;
|
||||
FvStringAspect vimRcPath;
|
||||
FvFilePathAspect vimRcPath;
|
||||
|
||||
FvBoolAspect startOfLine;
|
||||
FvIntegerAspect tabStop;
|
||||
|
@@ -1183,7 +1183,7 @@ void FakeVimPluginPrivate::maybeReadVimRc()
|
||||
//qDebug() << theFakeVimSetting(ConfigShiftWidth)->value();
|
||||
if (!settings().readVimRc())
|
||||
return;
|
||||
QString fileName = settings().vimRcPath();
|
||||
QString fileName = settings().vimRcPath().path();
|
||||
if (fileName.isEmpty()) {
|
||||
fileName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
|
||||
+ QLatin1String(HostOsInfo::isWindowsHost() ? "/_vimrc" : "/.vimrc");
|
||||
|
Reference in New Issue
Block a user