Install vim74
[msysgit.git] / share / vim / vim74 / ftplugin / gprof.vim
blob750751c372a8b0412f041703a7821ccce92b7302
1 " Language:    gprof
2 " Maintainer:  Dominique Pelle <dominique.pelle@gmail.com>
3 " Last Change: 2013 Jun 09
5 " When cursor is on one line of the gprof call graph,
6 " calling this function jumps to this function in the call graph.
7 if exists("b:did_ftplugin")
8   finish
9 endif
10 let b:did_ftplugin=1
12 fun! <SID>GprofJumpToFunctionIndex()
13   let l:line = getline('.')
14   if l:line =~ '[\d\+\]$'
15     " We're in a line in the call graph.
16     norm! $y%
17     call search('^' . escape(@", '[]'), 'sw')
18     norm! zz
19   elseif l:line =~ '^\(\s\+[0-9\.]\+\)\{3}\s\+'
20     " We're in line in the flat profile.
21     norm! 55|eby$
22     call search('^\[\d\+\].*\d\s\+' .  escape(@", '[]*.') . '\>', 'sW')
23     norm! zz
24   endif
25 endfun
27 " Pressing <C-]> on a line in the gprof flat profile or in
28 " the call graph, jumps to the corresponding function inside
29 " the flat profile.
30 map <buffer> <silent> <C-]> :call <SID>GprofJumpToFunctionIndex()<CR>
32 " vim:sw=2 fdm=indent