The Ultimate Qt Community site
Home News Forum Wiki Contest FAQ Links

Vim

From QtCentreWiki

Jump to: navigation, search

[edit] Getting nice autocompletion for QT classes in VIM

- Install ctags (sudo apt-get install ctags)
- Get the latest omnicppcomplete
- Install QT

cd ~
mkdir .vim
cd .vim
cp ~/Desktop/omni*.zip .
unzip omni*.zip
vim ~/.vimrc
 
While editing .vimrc:
-----------------------
syntax enable
filetype on
filetype plugin on
set nocp
set tags +=~/qtsdk-2009.03/qt/include/tags
set tags +=~/my_qt_project/tags
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
-----------------------
 
cd qtsdk-2009.03/qt/include/
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -I Q_REQUIRED_RESULT

So this assumes that you have the qt sdk installed in your home directory. Make sure that the tags file generated by the ctags command is pointed to correctly in the .vimrc file. Also note that control+F12 is now mapped to the ctags command. While you are editing your project you can regenerate the tags database easily. Simply make sure to replace "my_qt_project" with the actual path to your source code.

There is quite a bit more that you can do here and I'm sure I will come back to edit this later as my setup evolves.

Personal tools