tech_log: Vim as a C IDE

Saturday, November 1, 2008

Vim as a C IDE

Ingredients:

TAGLIST
Nice plugin for jumping on tags within currently opened C module. More info on http://vim-taglist.sourceforge.net/ and http://vim.sourceforge.net/scripts/script.php?script_id=273.

Requires Exuberant CTAGS (http://ctags.sourceforge.net/).

Few nice settings in .vimrc:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CTags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"let Tlist_Ctags_Cmd = $VIM.'\ctags.exe' " Location of ctags
let Tlist_Sort_Type = "name" " order by
let Tlist_Use_Right_Window = 1 " split to the right side of the screen
let Tlist_Compart_Format = 1 " show small meny
let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill yourself
"let Tlist_File_Fold_Auto_Close = 0 " Do not close tags for other files
"let Tlist_Enable_Fold_Column = 0 " Do not show folding tree
let Tlist_Auto_Open = 1 " Automatically open the taglist window on Vim startup
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


NERDTree

Nice file explorer. Here is the link: http://www.vim.org/scripts/script.php?script_id=1658.
To keep it open on start of every file (* glob in the following Vim's autocomand means everyfile),
put this line in your .vimrc:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Autocommands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
au vimenter * nerdtree " fire up NERDTree on entering vim

minibufexpl

From the site (http://www.vim.org/scripts/script.php?script_id=159): Elegant buffer explorer - takes very little screen space. This give
Vim "tabbing" for files opened from NERDExplorer on doubleclick, which will start to open in the central window, but in a different buffer. Minibufexpl gives opportunity to easy switch between the buffers.

Here is my .vimrc extract:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Minibuf
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:miniBufExplTabWrap = 1                 " make tabs show complete (no broken on two lines)
"let g:miniBufExplModSelTarget = 1
let g:miniBufExplSplitToEdge = 0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Buffers from MBE window are delted by pressing "d" when cursor is on the tab.

Other Utilities
Except from Exuberant CTAGS, mentioned before I recommend also:
  1. cscope (http://cscope.sourceforge.net/)
  2. Color Scheme Sampler Pack (http://www.vim.org/scripts/script.php?script_id=625)
  3. c.vim (http://www.vim.org/scripts/script.php?script_id=213)
  4. CRefVim (http://www.vim.org/scripts/script.php?script_id=614)
All are straigtforward to install. Additional notes for CRefVim:
  • copy all, ecpecially docs to .vim folder
  • run :helptags ~/.vim/doc   (or :helptags c:\vimfiles\doc for Windows)
  • \cr normal mode:  get help for word under cursor


0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home