robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
fb6f27e86f
master
1" Language: gprof 2" Maintainer: Dominique Pelle <dominique.pelle@gmail.com> 3" Contributors: Doug Kearns <dougkearns@gmail.com> 4" Last Change: 2021 Sep 19 5 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" ) 9finish 10endif 11let b: did_ftplugin = 1 12 13func ! <SID> GprofJumpToFunctionIndex () 14let l: line = getline ( '.' ) 15if l: line =~ '[\d\+\]$' 16" We're in a line in the call graph. 17norm ! $y% 18call search ( '^' . escape ( @", '[]' ), 'sw' ) 19norm ! zz 20elseif l: line =~ '^\(\s*[0-9\.]\+\)\{3}\s\+' 21" We're in line in the flat profile. 22norm ! 55|eby$ 23call search ( '^\[\d\+\].*\d\s\+' . escape ( @", '[]*.' ) . '\>' , 'sW' ) 24norm ! zz 25endif 26endfunc 27 28if ! exists ( "no_plugin_maps" ) && ! exists ( "no_gprof_maps" ) 29" Pressing <C-]> on a line in the gprof flat profile or in 30" the call graph, jumps to the corresponding function inside 31" the flat profile. 32map <buffer> <silent> < C-] > :call< SID > GprofJumpToFunctionIndex()< CR > 33let b: undo_ftplugin = "silent! unmap <buffer> <C-]>" 34endif 35 36" vim:sw=2 fdm=indent