събота, 28 май 2016 г.

How to use VIM for development with C language

How to use VIM for development with C language


Installing Tools

(Next instructions are typed in console)
1. Install VIM:
sudo apt-get install vim

2. Install ctags tool for indexing files:
sudo apt-get install ctags

3. Enter in directory:
cd ATmega32A_GCC_dev

4. Indexing (tag file) for only C and H source files with ctags in current directory: 
ctags -R *.c *.h

4a. Indexing (tag file) for all source files with ctags in current directory:
ctags -R .5. View index file:
view tags

Configure VIM to development tool

1. Open Vim with any source file from current directory and type
vim main.c

(Next instructions are typed in VIM)
2. Set index file to VIM:
:set tags=~/Desktop/ATmega32A_GCC_dev/tags

3. Search where is defined variable or function or any with
Ctrl+]
4. Return backward
Ctrl+t

5. Type any you search in <pattern> place
:tag /<pattern>

5a. Search main
:tag /main

6. Mark to search press shift+8 this is sign *

7. Next marked searching press n, n, n






Help:
http://vim.wikia.com/wiki/Browsing_programs_with_tags
http://vim.wikia.com/wiki/Single_tags_file_for_a_source_tree