Read the source code using vim
hi all, I am a vim user.After 3 year's work under linux, I get some
experiences about how to read source code using vim.Here I am very
glad to share for it.
1. ctags plugin
ctags R *
generate the tags file,edit the tags file using shell,make it easily
be read
Ctrl+] Ctrl+t
jump to and back the function defined
2.foldermethod setting
nmap zf zf}a
“fold all
nmap fa :set foldermethod=syntax :set foldermethod=manual
set the foldermethod option in .vimrc,make it can folder the whole
file.
3.taglist plugin
nmap tl :Tlist
4.screen
using screen,you can easily to get through the terminal you open
Ctrl+a+S split the current terminal in two
Ctrl+a+Q close other terminals,and remain the current terminal
Ctrl+a+Tab alternate between the terminals
5.MiniBufExplorer plugin
let mapleader=”,”
let g:mapleader=”,”
nmap b :MiniBufExplorer
6.grep, quickfix window
nnoremap :Grep
search char under the current directory
7.cscope,CCtree
cscope * Rbq
:cs add thewholepathofcscope.out thewholepathofcurrent
directory
8.:tags :redir!>filename
:redir!>filename remember the vim quickfix window's output
:tags under vim can get the trace you get through,and then you can
get the relationship a function is
used.
9.drawit plugin
use drawit plugin you can draw the data structures of the file,it
make you easily to understand the code.
Or the uml graph
10.:find
find the file under $path
11.write document for the code
-----
sorry about my poor english,just as too poor to use it
阅读(1601) | 评论(0) | 转发(0) |