[vlc-devel] [LONG] VIM, VLC and IDE

Jean-Baptiste Kempf jb at videolan.org
Thu Apr 30 01:16:34 CEST 2009


Hello,

Yeah, VIM is TEH awesome, but sometimes we would like more.
But usually, more is slow, incomplete and boring...


Would you want an editor with:
- VIM syntax and command,
- completion that is faster than the one from Eclipse
- Git inclusion
- Doesn't eat all your RAM
- Debuggueur and step-by-step+breakpoints integration like MSVC?

I guess so!
Believe it or not, I am speaking about QtCreator from Nokia/QtSoftware
that I have tested to work with VLC.

Even if you don't think this will be useful for you, at least read in
diagonale the following:


*********

* Take QtCreator 1.1 (don't take older versions, they won't fit for VLC,
        or the VIM part will suck...)

    `apt-get install qtcreator` in Sid (for other distros, DYI)

* Take Qt4.5.1 (I mean it)


*********

* Run QtCreator and launch Tools->options
  - Activate FakeVim and set ShiftWidth to 4
  - Text Editor->Behaviour, set Tab size at 4
  - Text Editor->Display, enable Text Wrapping and display right margin,
    and if you like Alexis' vim, Visualize whitespace
  - Text Editor, change the colour schemes to match you old editor ;)
Save options.

* VLC conf
  - For the example, I assume that you build your vlc in a "build" subdir of the
    source (as xtophe usually gives advice)
  - File->New
    Select 'Import of Makefile-based Project'
    -----
    Project Name 'VLC'
    Location '/home/you/vlc' and Choose, Next
    -----
    Let it process... It should take around 1minute
    Finish.

* EXIT QtCreator... I MEAN it.

QtCreator will have done VLC.includes VLC.creator, VLC.files and a VLC.config
in your vlc/ folder
Overwrite the VLC.includes and the VLC.files with the one you can find:
http://people.videolan.org/~jb/QtCreator/VLC.files
http://people.videolan.org/~jb/QtCreator/VLC.includes

Doing this will gain you some time. Those could be auto-generated one
day, I guess...


*********

* Relaunch QtCreator
  - Select Projects (on the left) and select VLC on the list
  - Build Settings,
    - Change Build directory to /home/you/vlc/build, using browse
  - Run Settings,
    - Add a custom Executable with the blue '+'
      Name it VLC, browse to /home/you/vlc/build/vlc for Executable
      Put -Iqt in Arguments
  - Click on Edit on the left. You should see VLC with most useful files.

* Build VLC and launch it.
  - In the Menu, Build and Build All, you should see the Compilation output on
    the bottom (or by clicking on the left build progressbar)
  - In the same menu, Build and Run it, and VLC will launch directly,
    outputting everything in the Application output.

Cool. That was a minimum...

Now the Good:
-------------
Open modules/codec/avcodec/audio.c from the file browser and see... You are
using VIM commands to control. You have Visual, Edit and all usual VIM modes!

Completion is triggered with Ctrl+Space and will give you a list. If there is
no ambiguition, it is filled.
. and -> triggers the list of the members of the struct or the class by default.
After function completions, it will give the type of the arguments.

F2 will give you access to the function definition where your mouse is.

Now the awesome:
----------------
- You can put breakpoints in the margins near the line numbers.
  (Like in modules/gui/qt4/main_interface.cpp:100 and 108
   Now re run it using debug running.

It will stop at your breakpoint and you will have the function call lists
(and line numbers) but also pointers values (like p_intf, and this in
 main_interface.cpp)
See screenshot at
http://people.videolan.org/~jb/QtCreator/VLC_Qt_Creator.png

You can, of course Step In, Step Into and Step Out, resume or stop the code

More coolness:
--------------
Use the locate search box to find quick declarations:
 'm vlc_object_act' will help you to go quickly to the method declaration
Etc...

Use the Git menu to checkout from within QtCreator.


The indexing shouldn't be too long, but could be a bit longer the first
time you launch the project!

Have fun!


Best Regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/



More information about the vlc-devel mailing list