codekingpro/portable-devtools
114k
1" Language: gprof2" Maintainer: Dominique Pelle <dominique.pelle@gmail.com>3" Contributors: Doug Kearns <dougkearns@gmail.com>4" Last Change: 2021 Sep 195 6" When cursor is on one line of the gprof call graph,7" calling this function jumps to this function in the call graph.8if exists("b:did_ftplugin")9 finish10endif11let b:did_ftplugin=112 13func! <SID>GprofJumpToFunctionIndex()14 let l:line = getline('.')15 if l:line =~ '[\d\+\]$'16 " We're in a line in the call graph.17 norm! $y%18 call search('^' . escape(@", '[]'), 'sw')19 norm! zz20 elseif l:line =~ '^\(\s*[0-9\.]\+\)\{3}\s\+'21 " We're in line in the flat profile.22 norm! 55|eby$23 call search('^\[\d\+\].*\d\s\+' . escape(@", '[]*.') . '\>', 'sW')24 norm! zz25 endif26endfunc27 28if !exists("no_plugin_maps") && !exists("no_gprof_maps")29 " Pressing <C-]> on a line in the gprof flat profile or in30 " the call graph, jumps to the corresponding function inside31 " the flat profile.32 map <buffer> <silent> <C-]> :call <SID>GprofJumpToFunctionIndex()<CR>33 let b:undo_ftplugin = "silent! unmap <buffer> <C-]>"34endif35 36" vim:sw=2 fdm=indent37 