mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Extract method for clarity.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user