Extract method for clarity.

This commit is contained in:
Andy Stewart
2013-03-08 11:45:13 +01:00
parent cf2db0df65
commit a61ddf453c
2 changed files with 39 additions and 8 deletions

View File

@@ -38,7 +38,6 @@ function! s:init()
endif
endfunction
" }}}
" Utility {{{
@@ -86,6 +85,10 @@ function! s:is_tracked_by_git()
return !v:shell_error
endfunction
function! s:snake_case_to_camel_case(text)
return substitute(a:text, '\v(.)(\a+)(_(.)(.+))?', '\u\1\l\2\u\4\l\5', '')
endfunction
" }}}
" {{{ Colours and signs
@@ -140,7 +143,6 @@ function! s:update_line_highlights(highlight_lines)
redraw!
endfunction
" }}}
" Diff processing {{{
@@ -305,8 +307,7 @@ endfunction
function! s:show_signs(file_name, modified_lines)
for line in a:modified_lines
let line_number = line[0]
" snake case to camel case
let type = substitute(line[1], '\v(.)(\a+)(_(.)(.+))?', '\u\1\l\2\u\4\l\5', '')
let type = s:snake_case_to_camel_case(line[1])
call s:add_sign(line_number, 'GitGutterLine' . type, a:file_name)
endfor
endfunction