转载请注明链接与作者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>"
 
 
打开语法高亮支持:syntax enable
 
 
三、windows下使用vim来编辑并编译QT
新建一个文本文件,命名为qt_vim.bat,找到qt目录下的qtenv.bat,做相应修改,以下是本人的内容,供参考
  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

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

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

    一:说在前头 我的第一份工作是做生产工具,当时用的MFC,IDE是VC6.0,现在想想真是古董级别,10年至今,微软也一直没有对MFC进行升级, 冥冥中感觉微软自己都放弃MFC了,市场上貌似MFC的岗 ...

  2. 【Qt开发】第一个Qt程序Hello World!

    一:说在前头 我的第一份工作是做生产工具,当时用的MFC,IDE是VC6.0,现在想想真是古董级别,10年至今,微软也一直没有对MFC进行升级,冥冥中感觉微软自己都放弃MFC了,市场上貌似MFC的岗位 ...

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

        [参考资料]吴垠的“手把手教你把Vim改装成一个IDE编程环境”在Fedora下成功将Vim打造成适用于C/C++的IDE用Vim搭建C/C++开发环境 Ubuntu下vim+ctags的配置 ...

  4. 【转】windows和linux中搭建python集成开发环境IDE

    本系列分为两篇: 1.[转]windows和linux中搭建python集成开发环境IDE 2.[转]linux和windows下安装python集成开发环境及其python包 3.windows和l ...

  5. Ubuntu 12.04下搭建Qt开发环境

    http://download.qt.io/official_releases/qt/ Ubuntu 环境下Gtk与Qt编译环境安装与配置(系统环境是Ubuntu 12.04) 1.配置基础开发环境G ...

  6. QT开发环境搭建

    一.Qt发展史 1991年,由奇趣科技开发的跨平台C++图形用户界面应用程序开发框架: 2008年,Nokia从Trolltech公司收购Qt, 并增加LGPL的授权模式: 2011年,Digia从N ...

  7. 【Python开发】python集成开发环境IDE搭建

    http://blog.csdn.net/pipisorry/article/details/39854707 使用的系统及软件 Ubuntu / windows Python 2.7 / pytho ...

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

    目录 Linux发行版的选择 安装常用的开发工具(这里针对C/C++/Qt) 安装openGL 中文输入法 安装sublime text 安装vscode apt-get常用命令 Qt环境 Qt常见问 ...

  9. Unix/Linux环境C编程入门教程(20) 搭建基于Mac的 Xcode 与 QT 开发环境

    1.启动 Vmware,如果没有 VMware 的同学,请看前面我们搭建 VMware 的视频 2.打开虚拟机以后,出现虚拟机界面 3 新建一个虚拟机 4 选择自定义,单击下一步 5 选择默认的 VM ...

随机推荐

  1. cf C. Xenia and Weights

    http://codeforces.com/contest/339/problem/C #include <cstdio> #include <cstring> #includ ...

  2. 猎豹上市(猎豹的广告收入中有70%来自BAT三家公司,总收入中有58%来自BAT)

    发表日期: 2014 年 5 月 9 日 From 网易专题 文/赵楠 村里那点儿事 猎豹移动上市之夜,我挺激动. 激动除了因为有好朋友在这家公司外,也因为猎豹移动在历史上的几次起承转合非常不易,在巨 ...

  3. poj 1017 Packets 贪心

    题意:所有货物的高度一样,且其底面积只有六种,分别为1*1 2*2 3*3 4*4 5*5 6*6的,货物的个数依次为p1,p2,p3,p4,p5,p6, 包裹的高度与货物一样,且底面积就为6*6,然 ...

  4. 值传递 & 引用传递

    以下程序的输出结果是? public class Example { String str = new String("good"); char[] ch = { 'a', 'b' ...

  5. chroot 与 jail

    所谓“监牢”就是指通过chroot机制来更改某个进程所能看到的根文件夹,即将某进程限制在指定文件夹中,保证该进程仅仅能对该文件夹及其子文件夹的文件有所动作,从而保证整个server的安全. 创建chr ...

  6. Afianl加载网络图片(延续)

    上一页"已经谈到了如何使用Afianl网络负载的图片和下载文件,本文将继续介绍使用Afinal使用网络负载图片,主绑定listview采用: 看效果图: listview在滑动过程中没用明显 ...

  7. IOS基于新浪微博开放平台微博APP

    1.基于新浪微博开放平台APP源码 2.gitHub源代码下载地址 https://github.com/whzhaochao/SinaWeiBoOpen 3.用到的第三放开源库 3.1  RTLab ...

  8. php字符串标点等字符截取不乱吗 封装方法

    方法一: /**   +----------------------------------------------------------  * 功能:字符串截取指定长度  * leo.li hen ...

  9. ubuntu apache2配置详解(含虚拟主机配置方法)

    ubuntu apache2配置详解(含虚拟主机配置方法) 在Windows下,Apache的配置文件通常只有一个,就是httpd.conf.但我在Ubuntu Linux上用apt-get inst ...

  10. django中的Model模型一:

    在django的框架设计中采用了mtv模型,即Model,template,viewer Model相对于传统的三层或者mvc框架来说就相当对数据处理层,它主要负责与数据的交互,在使用django框架 ...