comparison plugin/lawrencium.vim @ 5:3a4f9f41a7e2

Use a hackish shortcut to get the current branch faster for the statusline.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 08 Dec 2011 21:12:04 -0800
parents b6e4446ed292
children 1da613c13d81
comparison
equal deleted inserted replaced
4:b6e4446ed292 5:3a4f9f41a7e2
290 " displaying on the status line. 290 " displaying on the status line.
291 function! lawrencium#statusline(...) 291 function! lawrencium#statusline(...)
292 if !exists('b:mercurial_dir') 292 if !exists('b:mercurial_dir')
293 return '' 293 return ''
294 endif 294 endif
295 let l:summary = s:hg_repo().RunCommand('summary') 295 let l:prefix = (a:0 > 0 ? a:1 : '')
296 let l:parent_rev = matchstr(l:summary, 'parent\: \d+\:[0-9a-f]+') 296 let l:suffix = (a:0 > 1 ? a:2 : '')
297 let l:branch = matchstr(l:summary, 'branch\: [\d\w\-_\.]+') 297 let l:branch_file = s:hg_repo().GetFullPath('.hg/branch')
298 return l:branch . ', ' . l:parent_rev 298 let l:branch = readfile(l:branch_file)[0]
299 return l:prefix . l:branch . l:suffix
299 endfunction 300 endfunction
300 301
301 " Rescans the current buffer for setting up Mercurial commands. 302 " Rescans the current buffer for setting up Mercurial commands.
302 " Passing '1' as the parameter enables debug traces temporarily. 303 " Passing '1' as the parameter enables debug traces temporarily.
303 function! lawrencium#rescan(...) 304 function! lawrencium#rescan(...)