Raimondi

Untitled

Dec 8th, 2011
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. " If the cursor is currently within a function body, show
  2. " the function name in the statusline.
  3.  
  4. function! VimCurrentFunction()
  5.   let fpos = search('^\s*:*fu', 'bnW')
  6.   if fpos != 0
  7.     let epos = search( '^\s*:*endf\%[unction]', 'bnW')
  8.     if (epos == 0) || (epos < fpos) || (epos == line('.'))
  9.       return ', ' . matchlist(getline(fpos), 'fu\%[nction]!\?\s*\(\w\+\)')[1]
  10.     else
  11.       return ''
  12.     endif
  13.   else
  14.     return ''
  15.   endif
  16. endfunction
  17.  
  18. set statusline=%f%m%r%h%w\ [%n:%{&ff}/%Y]%=[0x\%04.4B][%03v][%p%%\ line\ %l\ of\ %L\%{VimCurrentFunction()}]
  19.  
  20.  
Advertisement
Add Comment
Please, Sign In to add comment