Slide 1

Slide 1 text

Using VIM as C++ IDE In this short talk I am going to cover how to make better use of VIM while programming in c++ .  Operating multiple windows and working with buffers  c.vim plugin  Cscope plugin

Slide 2

Slide 2 text

Multiple windows and buffers One of the nice things is buffers  :open – opens the file in the current window  :split – splits horizontally into 2 windows  :vsplit – splits vertically into two windows  :ls – view all currently open buffers  :b - open buffer in current window

Slide 3

Slide 3 text

c.vim  The script : http://www.vim.org/scripts/script.php?script_id=213  This plugin speeds up writing new code considerably. It has many predefined code snippets for almost all tasks like main , function , try catch block . It prints out templates which create a professional appearence . Eg: \if – Insert a new function : creates a block of code containing fields for name , description in comments and a stub for function  Keystrokes defined for compiling and runnning programs programs : \rc – compile the program \rr – run the program :h csupport – to view the complete do:cumentation

Slide 4

Slide 4 text

Cscope  Cscope is a terminal utility which integrates with vim by default . Cscope is very useful for browsing C/C++ source code . $sudo apt-get install cscope $cscope -R : This builds the cscope.out covering all subdirecteries under cur dir and opens the ui . [ Remember CTRL-D to quit and CTRL-TAB to switch ]

Slide 5

Slide 5 text

Cscope [ Contd. ]  In VIM : Once cscope installed you can directly call the csope commands :cscope find symbol (or in short) :cs f s Additionally you can add the script http://cscope.sourceforge.net/cscope_maps.vim which defines some keyboard mappings. CTRL \ + s – find the symbol CTRL spacebar + s – split window CTRL spacebar spacebar + s – vsplit window g – global defn , c – calls to function s – symbol , f – file