将vim作为QT开发的IDE

转载请注明链接与作者huihui1988

用了一段时间的vim,喜欢上了这种简洁高效的编辑器。恰逢正在学习QT中,于是将vim变成了开发QT的工具。以下是具体配置。

一、语法高亮支持:

1、打开VIMDIR/vim72/syntax/cpp.vim,加入

syn keyword cppStatement SLOT,SIGNAL

syn keyword cppAccess slots,signals

2、增加QT的类型名:

syn keyword cType ActiveQt Q3Accel Q3Action Q3ActionGroup Q3AsciiBucket Q3AsciiCache Q3AsciiCacheIterator Q3AsciiDict Q3AsciiDictIterator Q3BaseBucket Q3BoxLayout Q3Button Q3ButtonGroup Q3CString Q3Cache Q3CacheIterator Q3Canvas Q3CanvasEllipse Q3CanvasItem Q3CanvasItemList Q3CanvasLine Q3CanvasPixmap Q3CanvasPixmapArray Q3CanvasPolygon Q3CanvasPolygonalItem Q3CanvasRectangle Q3CanvasSpline Q3CanvasSprite Q3CanvasText Q3CanvasView Q3CheckListItem Q3CheckTableItem Q3CleanupHandler Q3ColorDrag Q3ComboBox Q3ComboTableItem Q3DataBrowser Q3DataTable Q3DataView Q3DateEdit Q3DateTimeEdit Q3DateTimeEditBase Q3DeepCopy Q3Dict Q3DictIterator Q3Dns Q3DnsSocket Q3DockArea Q3DockAreaLayout Q3DockWindow Q3DragObject Q3DropSite Q3EditorFactory Q3FileDialog Q3FileIconProvider Q3FilePreview Q3Frame Q3Ftp Q3GArray Q3GCache Q3GCacheIterator Q3GDict Q3GDictIterator Q3GList Q3GListIterator Q3GListStdIterator Q3GVector Q3Grid Q3GridLayout Q3GridView Q3GroupBox Q3HBox Q3HBoxLayout Q3HButtonGroup Q3HGroupBox Q3Header Q3Http Q3HttpHeader Q3HttpRequestHeader Q3HttpResponseHeader Q3IconDrag Q3IconDragItem Q3IconView Q3IconViewItem Q3ImageDrag Q3IntBucket Q3IntCache Q3IntCacheIterator Q3IntDict Q3IntDictIterator Q3LNode Q3ListBox Q3ListBoxItem Q3ListBoxPixmap Q3ListBoxText Q3ListView Q3ListViewItem Q3ListViewItemIterator Q3LocalFs Q3MainWindow Q3MemArray Q3MimeSourceFactory Q3MultiLineEdit Q3NetworkOperation Q3NetworkProtocol Q3NetworkProtocolDict Q3NetworkProtocolFactory Q3NetworkProtocolFactoryBase Q3ObjectDictionary Q3PaintDeviceMetrics Q3Painter Q3Picture Q3PointArray Q3PolygonScanner Q3PopupMenu Q3Process Q3ProgressBar Q3ProgressDialog Q3PtrBucket Q3PtrCollection Q3PtrDict Q3PtrDictIterator Q3PtrList Q3PtrListIterator Q3PtrListStdIterator Q3PtrQueue Q3PtrStack Q3PtrVector Q3RangeControl Q3ScrollView Q3Semaphore Q3ServerSocket Q3Shared Q3Signal Q3SimpleRichText Q3SingleCleanupHandler Q3Socket Q3SocketDevice Q3SortedList Q3SpinWidget Q3SqlCursor Q3SqlEditorFactory Q3SqlFieldInfo Q3SqlFieldInfoList Q3SqlForm Q3SqlPropertyMap Q3SqlRecordInfo Q3SqlSelectCursor Q3StoredDrag Q3StrIList Q3StrIVec Q3StrList Q3StrListIterator Q3StrVec Q3StringBucket Q3StyleSheet Q3StyleSheetItem Q3SyntaxHighlighter Q3TSFUNC Q3TabDialog Q3Table Q3TableItem Q3TableSelection Q3TextBrowser Q3TextDrag Q3TextEdit Q3TextEditOptimPrivate Q3TextStream Q3TextView Q3TimeEdit Q3ToolBar Q3UriDrag Q3Url Q3UrlOperator Q3VBox Q3VBoxLayout Q3VButtonGroup Q3VGroupBox Q3ValueList Q3ValueListConstIterator Q3ValueListIterator Q3ValueStack Q3ValueVector Q3WhatsThis Q3WidgetStack Q3Wizard QAssistantClient QAbstractEventDispatcher QAbstractFileEngine QAbstractFileEngineHandler QAbstractItemModel QAbstractListModel QAbstractTableModel QArgument QAtomic QAtomicPointer QBasicAtomic QBasicAtomicPointer QBasicTimer QBitArray QBitRef QBool QBuffer QByteArray QByteArrayMatcher QByteRef QCOORD QCache QChar QCharRef QChildEvent QConstString QCoreApplication QCustomEvent QDataStream QDate QDateTime QDebug QDir QEvent QEventLoop QFSFileEngine QFactoryInterface QFile QFileInfo QFileInfoList QFileInfoListIterator QFileSystemWatcher QFlag QFlags QForeachContainer QForeachContainerBase QGenericArgument QGenericReturnArgument QGlobalStatic QHash QHashData QHashDummyNode QHashDummyValue QHashIterator QHashNode QIODevice QIntForSize QIntForType QInternal QLatin1Char QLatin1String QLibrary QLibraryInfo QLine QLineF QLinkedList QLinkedListData QLinkedListIterator QLinkedListNode QList QListData QListIterator QLocale QMap QMapData QMapIterator QMetaClassInfo QMetaEnum QMetaMethod QMetaObject QMetaProperty QMetaType QMetaTypeId QMimeData QModelIndex QModelIndexList QMultiHash QMultiMap QMutableHashIterator QMutableLinkedListIterator QMutableListIterator QMutableMapIterator QMutableSetIterator QMutableStringListIterator QMutableVectorIterator QMutex QMutexLocker QNoDebug QNoImplicitBoolCast QObject QObjectCleanupHandler QObjectData QObjectList QObjectUserData QPair QPersistentModelIndex QPluginLoader QPoint QPointF QPointer QProcess QQueue QReadLocker QReadWriteLock QRect QRectF QRegExp QResource QReturnArgument QSemaphore QSet QSetIterator QSettings QSharedData QSharedDataPointer QSignalMapper QSize QSizeF QSocketNotifier QStack QStdWString QString QStringList QStringListIterator QStringMatcher QSysInfo QSystemLocale QTS QTemporaryFile QTextCodec QTextCodecFactoryInterface QTextCodecPlugin QTextDecoder QTextEncoder QTextIStream QTextOStream QTextStream QTextStreamFunction QTextStreamManipulator QThread QThreadStorage QThreadStorageData QTime QTimeLine QTimer QTimerEvent QTranslator QTypeInfo QUintForSize QUintForType QUrl QUuid QVarLengthArray QVariant QVariantComparisonHelper QVariantList QVariantMap QVector QVectorData QVectorIterator QVectorTypedData QWaitCondition QWriteLocker Q_INT16 Q_INT32 Q_INT64 Q_INT8 Q_LLONG Q_LONG Q_PID Q_UINT16 Q_UINT32 Q_UINT64 Q_UINT8 Q_ULLONG Q_ULONG QDBusAbstractAdaptor QDBusAbstractInterface QDBusArgument QDBusConnection QDBusConnectionInterface QDBusError QDBusInterface QDBusMessage QDBusMetaType QDBusObjectPath QDBusReply QDBusServer QDBusSignature QDBusVariant QAbstractExtensionFactory QAbstractExtensionManager QAbstractFormBuilder QDesignerActionEditorInterface QDesignerBrushManagerInterface QDesignerComponents QDesignerContainerExtension QDesignerCustomWidgetCollectionInterface QDesignerCustomWidgetInterface QDesignerDnDItemInterface QDesignerExportWidget QDesignerExtraInfoExtension QDesignerFormEditorInterface QDesignerFormEditorPluginInterface QDesignerFormWindowCursorInterface QDesignerFormWindowInterface QDesignerFormWindowManagerInterface QDesignerFormWindowToolInterface QDesignerIconCacheInterface QDesignerLayoutDecorationExtension QDesignerMemberSheetExtension QDesignerMetaDataBaseInterface QDesignerMetaDataBaseItemInterface QDesignerObjectInspectorInterface QDesignerPropertyEditorInterface QDesignerPropertySheetExtension QDesignerTaskMenuExtension QDesignerWidgetBoxInterface QDesignerWidgetDataBaseInterface QDesignerWidgetDataBaseItemInterface QDesignerWidgetFactoryInterface QExtensionFactory QExtensionManager QFormBuilder QAbstractButton QAbstractGraphicsShapeItem QAbstractItemDelegate QAbstractItemView QAbstractPageSetupDialog QAbstractPrintDialog QAbstractProxyModel QAbstractScrollArea QAbstractSlider QAbstractSpinBox QAbstractTextDocumentLayout QAbstractUndoItem QAccessible QAccessibleApplication QAccessibleBridge QAccessibleBridgeFactoryInterface QAccessibleBridgePlugin QAccessibleEvent QAccessibleFactoryInterface QAccessibleInterface QAccessibleObject QAccessiblePlugin QAccessibleWidget QAction QActionEvent QActionGroup QApplication QBitmap QBoxLayout QBrush QBrushData QButtonGroup QCDEStyle QCalendarWidget QCheckBox QCleanlooksStyle QClipboard QClipboardEvent QCloseEvent QColor QColorDialog QColorGroup QColormap QComboBox QCommonStyle QCompleter QConicalGradient QContextMenuEvent QCursor QCursorShape QDataWidgetMapper QDateEdit QDateTimeEdit QDesktopServices QDesktopWidget QDial QDialog QDialogButtonBox QDirModel QDockWidget QDoubleSpinBox QDoubleValidator QDrag QDragEnterEvent QDragLeaveEvent QDragMoveEvent QDragResponseEvent QDropEvent QErrorMessage QFileDialog QFileIconProvider QFileOpenEvent QFocusEvent QFocusFrame QFont QFontComboBox QFontDatabase QFontDialog QFontInfo QFontMetrics QFontMetricsF QFrame QGradient QGradientStop QGradientStops QGraphicsEllipseItem QGraphicsItem QGraphicsItemAnimation QGraphicsItemGroup QGraphicsLineItem QGraphicsPathItem QGraphicsPixmapItem QGraphicsPolygonItem QGraphicsRectItem QGraphicsScene QGraphicsSceneContextMenuEvent QGraphicsSceneDragDropEvent QGraphicsSceneEvent QGraphicsSceneHelpEvent QGraphicsSceneHoverEvent QGraphicsSceneMouseEvent QGraphicsSceneWheelEvent QGraphicsSimpleTextItem QGraphicsTextItem QGraphicsView QGridLayout QGroupBox QHBoxLayout QHeaderView QHelpEvent QHideEvent QHoverEvent QIcon QIconDragEvent QIconEngine QIconEngineFactoryInterface QIconEnginePlugin QIconSet QImage QImageIOHandler QImageIOHandlerFactoryInterface QImageIOPlugin QImageReader QImageTextKeyLang QImageWriter QInputContext QInputContextFactory QInputContextFactoryInterface QInputContextPlugin QInputDialog QInputEvent QInputMethodEvent QIntValidator QItemDelegate QItemEditorCreator QItemEditorCreatorBase QItemEditorFactory QItemSelection QItemSelectionModel QItemSelectionRange QKeyEvent QKeySequence QLCDNumber QLabel QLayout QLayoutItem QLayoutIterator QLineEdit QLinearGradient QListView QListWidget QListWidgetItem QMacMime QMacPasteBoardMime QMainWindow QMatrix QMenu QMenuBar QMenuItem QMenubarUpdatedEvent QMessageBox QMessageBoxEx QMimeSource QMotifStyle QMouseEvent QMoveEvent QMovie QPageSetupDialog QPaintDevice QPaintEngine QPaintEngineState QPaintEvent QPainter QPainterPath QPainterPathPrivate QPainterPathStroker QPalette QPen QPicture QPictureFormatInterface QPictureFormatPlugin QPictureIO QPixmap QPixmapCache QPlastiqueStyle QPolygon QPolygonF QPrintDialog QPrintEngine QPrinter QProgressBar QProgressDialog QProxyModel QPushButton QRadialGradient QRadioButton QRegExpValidator QRegion QResizeEvent QRgb QRubberBand QScrollArea QScrollBar QSessionManager QShortcut QShortcutEvent QShowEvent QSizeGrip QSizePolicy QSlider QSortFilterProxyModel QSound QSpacerItem QSpinBox QSplashScreen QSplitter QSplitterHandle QStackedLayout QStackedWidget QStandardItem QStandardItemEditorCreator QStandardItemModel QStatusBar QStatusTipEvent QStringListModel QStyle QStyleFactory QStyleFactoryInterface QStyleHintReturn QStyleHintReturnMask QStyleOption QStyleOptionButton QStyleOptionComboBox QStyleOptionComplex QStyleOptionDockWidget QStyleOptionFocusRect QStyleOptionFrame QStyleOptionFrameV2 QStyleOptionGraphicsItem QStyleOptionGroupBox QStyleOptionHeader QStyleOptionMenuItem QStyleOptionProgressBar QStyleOptionProgressBarV2 QStyleOptionQ3DockWindow QStyleOptionQ3ListView QStyleOptionQ3ListViewItem QStyleOptionRubberBand QStyleOptionSizeGrip QStyleOptionSlider QStyleOptionSpinBox QStyleOptionTab QStyleOptionTabBarBase QStyleOptionTabV2 QStyleOptionTabWidgetFrame QStyleOptionTitleBar QStyleOptionToolBar QStyleOptionToolBox QStyleOptionToolButton QStyleOptionViewItem QStylePainter QStylePlugin QSyntaxHighlighter QSystemTrayIcon QTabBar QTabWidget QTableView QTableWidget QTableWidgetItem QTableWidgetSelectionRange QTabletEvent QTextBlock QTextBlockFormat QTextBlockGroup QTextBlockUserData QTextBrowser QTextCharFormat QTextCursor QTextDocument QTextDocumentFragment QTextEdit QTextFormat QTextFragment QTextFrame QTextFrameFormat QTextFrameLayoutData QTextImageFormat QTextInlineObject QTextItem QTextLayout QTextLength QTextLine QTextList QTextListFormat QTextObject QTextObjectInterface QTextOption QTextTable QTextTableCell QTextTableFormat QTimeEdit QToolBar QToolBarChangeEvent QToolBox QToolButton QToolTip QTreeView QTreeWidget QTreeWidgetItem QTreeWidgetItemIterator QUndoCommand QUndoGroup QUndoStack QUndoView QUpdateLaterEvent QVBoxLayout QValidator QWMatrix QWhatsThis QWhatsThisClickedEvent QWheelEvent QWidget QWidgetAction QWidgetData QWidgetItem QWidgetList QWidgetMapper QWindowStateChangeEvent QWindowsMime QWindowsStyle QWindowsXPStyle QWorkspace QAbstractSocket QFtp QHostAddress QHostInfo QHttp QHttpHeader QHttpRequestHeader QHttpResponseHeader QIPv6Address QNetworkAddressEntry QNetworkInterface QNetworkProxy QTcpServer QTcpSocket QUdpSocket QUrlInfo Q_IPV6ADDR QGLColormap QGLContext QGLFormat QGLFramebufferObject QGLPixelBuffer QGLWidget QIBaseDriver QIBaseResult QMYSQLDriver QMYSQLResult QODBCDriver QODBCResult QPSQLDriver QPSQLResult QSQLite2Driver QSQLite2Result QSQLiteDriver QSQLiteResult QSqlDatabase QSqlDriver QSqlDriverCreator QSqlDriverCreatorBase QSqlDriverFactoryInterface QSqlDriverPlugin QSqlError QSqlField QSqlIndex QSqlQuery QSqlQueryModel QSqlRecord QSqlRelation QSqlRelationalDelegate QSqlRelationalTableModel QSqlResult QSqlTableModel QSvgRenderer QSvgWidget QEventSizeOfChecker QSignalSpy QSpontaneKeyEvent QTestAccessibility QTestAccessibilityEvent QTestData QTestDelayEvent QTestEvent QTestEventList QTestEventLoop QTestKeyClicksEvent QTestKeyEvent QTestMouseEvent QUiLoader QDomAttr QDomCDATASection QDomCharacterData QDomComment QDomDocument QDomDocumentFragment QDomDocumentType QDomElement QDomEntity QDomEntityReference QDomImplementation QDomNamedNodeMap QDomNode QDomNodeList QDomNotation QDomProcessingInstruction QDomText QXmlAttributes QXmlContentHandler QXmlDTDHandler QXmlDeclHandler QXmlDefaultHandler QXmlEntityResolver QXmlErrorHandler QXmlInputSource QXmlLexicalHandler QXmlLocator QXmlNamespaceSupport QXmlParseException QXmlReader QXmlSimpleReader

二、智能补全

1、安装omnicppcomplete,从http://www.vim.org/scripts/script.php?script_id=1520上下载omnicppcomplete,直接解压到vim的安装目录下(window下为vimfiles)

2、安装ctags,http://ctags.sourceforge.net/,并将其加入环境变量中,到qt的include目录和src目录下分别执行

ctags -R --c++-kinds=+p --fields=+iaS --extra=+q

随后在两目录下分别生成了tags的文件。编辑_vimrc,加入

set nocp

filetype plugin indent on

set tags+=QTDIR/include/tags

set tags+=DQTDIR/src/tags

3、设置tab自动补全,http://www.vim.org/scripts/script.php?script_id=1643,将supertab.vim拷贝到plugin目录下,并在_vimrc中加入

set completeopt=longest,menu

let g:SuperTabRetainCompletionType = 2

let g:SuperTabDefaultCompletionType = "<C-X><C-O>"

关于补全的详细内容,参见:http://easwy.com/blog/archives/advanced-vim-skills-omin-complete/

打开语法高亮支持:syntax enable

三、windows下使用vim来编辑并编译QT

新建一个文本文件,命名为qt_vim.bat,找到qt目录下的qtenv.bat,做相应修改,以下是本人的内容,供参考

[cpp] view plaincopy

  1. @echo off
  2. rem
  3. rem This file is generated
  4. rem
  5. echo Setting up a MinGW/Qt only environment...
  6. echo -- QTDIR set to D:/Qt/4.6.0/qt
  7. echo -- PATH set to D:/Qt/4.6.0/qt/bin
  8. echo -- Adding D:/Qt/4.6.0/bin to PATH
  9. echo -- Adding %SystemRoot%/System32 to PATH
  10. echo -- QMAKESPEC set to win32-g++
  11. set QTDIR=D:/Qt/4.6.0/qt
  12. set PATH=D:/Qt/4.6.0/qt/bin
  13. set PATH=%PATH%;D:/Qt/4.6.0/bin;D:/Qt/4.6.0/mingw/bin;D:/Program Files/Vim/vim72 //记得加上vim的路径
  14. set PATH=%PATH%;%SystemRoot%/System32
  15. set QMAKESPEC=win32-g++
  16. cd "F:/code/qt"   //进入工作目录
  17. start "" gvim -O2 "F:/code/qt" //设置qt工作目录
  18. exit //退出cmd,保留gvim窗口

最后再在工程目录下运行 ctags -R --c++-kinds=+p --fields=+iaS --extra=+q

http://blog.csdn.net/huihui1988/article/details/5601495

时间: 2024-10-25 07:22:18

将vim作为QT开发的IDE的相关文章

【Qt开发】01-第一个Qt程序Hello World!

一:说在前头 我的第一份工作是做生产工具,当时用的MFC,IDE是VC6.0,现在想想真是古董级别,10年至今,微软也一直没有对MFC进行升级, 冥冥中感觉微软自己都放弃MFC了,市场上貌似MFC的岗位越来越了,基本上也都是原先的项目维护,qt已经成为新的客户端开发的趋势, 顺者昌,逆者亡,无奈只能放弃MFC转投Qt了,Qt实现了跨平台功能,一套代码可以在windows,linux,mac上运行,大大节省了开发者平台移植 工作量,Qt号称要做出像网页一样漂亮的界面,小编会出一系列的Qt开发的文章

将vim改造成C/C++开发环境(IDE) 2011

[参考资料]吴垠的“手把手教你把Vim改装成一个IDE编程环境”在Fedora下成功将Vim打造成适用于C/C++的IDE用Vim搭建C/C++开发环境 Ubuntu下vim+ctags的配置(转) Vim下的代码自动补全和代码跳转阅读(转) omnicppcomplete - a Vim plugin 我的vim IDE界面: 1.安装Vim和Vim基本插件 首先安装好Vim和Vim的基本插件.这些使用apt-get安装即可:[email protected]:~/arm$sudo apt-g

教你如何在Deepin搭建Qt开发环境

首先教大家一种很简单的方法,打开终端输入以下命令: sudo apt-get install qt5-default qt5-qmake g++ qtcreator 上面的命令会自动帮你安装qt5开发库,qmake,g++是c++的编译器,然后还有Qt专门的IDE 第二种方法就是到官方网站下载安装包然后进行安装 下载地址:https://www.qt.io/download-open-source-access/ 选择适合自己操作系统的版本,下载Offine Installers离线包,下载之后

7种流行PHP集成开发工具(IDE)的比较

本文发掘集成开发环境(IDE)的所有用途,并比较 7 种流行的 IDE 的成本和优势. 编写关于 php 的系列文章让我更加深刻地了解了 PHP 开发人员的世界.我和许多 PHP程序员交谈过,最令我惊奇的是只有很少的人使用 IDE.大多数程序员使用文本编辑器,比如 Microsoft Windows 上的记事本.Emacs 或者 Vim. 我提到的这些文本编辑器(以及我没提到)都是很不错的 -- 我不想讨论哪个编辑器更好.但是,我要强调的是不使用文本编辑器会使您对 PHP 代码有更深的见解.几乎

嵌入式linux QT开发(三)——GUI原理分析

嵌入式linux QT开发(三)--GUI原理分析 一.命令行程序 命令行程序是面向过程的程序设计. 命令行程序的特点: A.基于顺序结构执行 B.程序执行过程中不需与用户交互 C.程序执行结束给出最终运行结果 命令行程序适用场合: A.单任务场合 B.无交互.简单交互场合 C.服务器应用场合 二.GUI程序 GUI程序的特点: A.基于消息驱动模型的程序 B.程序执行依赖用户交互过程 C.程序执行过程中实时响应用户操作 D.一般程序执行后不会主动退出 GUI程序适用场合: A.多任务场合 B.

QT开发(六)——QT容器组件

QT开发(六)--QT容器组件 QT中有九种容器组件,分别是组合框QGroupBox.滚动区QScrollArea.工具箱QToolBox.选项卡QTabWidget.控件栈QWidgetStack.框架QFrame.组件QWidget.MDI窗口显示区QMdiArea.停靠窗口QDockWidget. 一.QGroupBox分组框 1.QGroupBox组件简介 QGroupBox为构建分组框提供了支持.分组框通常带有一个边框和一个标题栏,作为容器部件来使用,在其中可以布置各种窗口部件.分组框

windows下VisualStudio和QtCreator搭建Qt开发环境

一.简介 集成开发平台IDE都有各自的长处,编写Qt程序可根据自己的喜好来选择相应的IDE.下述文章都是装载博友的文章,其中有很多细节还得自己调整. 二.详解 1.VisualStudio搭建Qt开发环境 Visual Studio中文官方网站 Visual Studio所有下载 (1)Visual Studio Community 2013 1.选择Community 2013,下载安装 2.安装完Visual Studio默认是英文,如果对英文不感冒的童鞋,可以下载中文语言包. 3.安装完成

Windows 下最佳的 C++ 开发的 IDE 是什么?

作者:渡世白玉链接:https://www.zhihu.com/question/19589089/answer/30312199来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 这个需要看你开发什么类型的软件来定的,和使用什么类库来定的..如果只是做win下软件,开发MFC或者DUI,ATL这些,不用说的VS系列..如果你是之开发纯C++一类的无界面程序,这就选择多了,那个顺手用那个,如果需要考虑跨平他,那就Code::Blocks或者Qt-Creator吧,这可

Linux下C ,C ++, Qt开发环境

Linux 发行版的选择 尽量优选Ubuntu, 用户开发者多. 而且较大的公司的开源项目测试Linux平台也是优先Ubuntu. openSUSE也不错.但是大环境还是ubuntu. 建议安装时候选英文版.慢慢习惯就好了. 安装常用的开发工具 先换源. 清华或者科大不然速度不给力. (software & update中设置) sudo apt update sudo apt upgrade sudo apt install gcc g++ -y sudo apt install build-