Skip to content

Commit a93b185

Browse files
author
George Sofianos
committed
clean code & apply some linting fixes with vint
1 parent 8e58a6f commit a93b185

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

autoload/blamer.vim

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
scriptencoding utf-8
2+
13
if exists('g:blamer_autoloaded')
24
finish
35
endif
46
let g:blamer_autoloaded = 1
57

6-
let s:save_cpo = &cpo
7-
set cpo&vim
8+
let s:save_cpo = &cpoptions
9+
set cpoptions&vim
810

911
let s:blamer_prefix = get(g:, 'blamer_prefix', ' ')
1012
let s:blamer_template = get(g:, 'blamer_template', '<author>, <author-time> • <summary>')
@@ -74,14 +76,6 @@ function! s:Head(array) abort
7476
return a:array[0]
7577
endfunction
7678

77-
function! s:IsFileInPath(file_path, path) abort
78-
if a:file_path =~? a:path
79-
return 1
80-
else
81-
return 0
82-
endif
83-
endfunction
84-
8579
function! s:GetLines() abort
8680
let l:visual_line_number = line('v')
8781
let l:cursor_line_number = line('.')
@@ -136,10 +130,8 @@ function! blamer#GetMessages(file, line_number, line_count) abort
136130
let l:result = system(l:command)
137131
let l:lines = split(l:result, '\n')
138132

139-
let l:info = {}
140-
let l:info['commit-short'] = split(l:lines[0], ' ')[0][:7]
141-
let l:info['commit-long'] = split(l:lines[0], ' ')[0]
142-
let l:hash_is_empty = empty(matchstr(info['commit-long'],'\c[0-9a-f]\{40}'))
133+
let hash = split(l:lines[0], ' ')[0]
134+
let l:hash_is_empty = empty(matchstr(hash,'\c[0-9a-f]\{40}'))
143135

144136
if l:hash_is_empty
145137
if l:result =~? 'fatal' && l:result =~? 'not a git repository'
@@ -168,8 +160,6 @@ function! blamer#GetMessages(file, line_number, line_count) abort
168160
endif
169161

170162
let l:TAB_ASCII = 9
171-
172-
let l:reading_commit_data = 0
173163
let l:commit_data = {}
174164
let l:commit_data_per_line = []
175165

@@ -187,7 +177,7 @@ function! blamer#GetMessages(file, line_number, line_count) abort
187177
elseif l:has_line_tab
188178
" line type TAB
189179
" Change messsage when changes are not commited
190-
if l:commit_data.author ==? "Not Committed Yet"
180+
if l:commit_data.author ==? 'Not Committed Yet'
191181
let l:commit_data.author = 'You'
192182
let l:commit_data.committer = 'You'
193183
let l:commit_data.summary = 'Uncommitted changes'
@@ -200,7 +190,7 @@ function! blamer#GetMessages(file, line_number, line_count) abort
200190
endif
201191
endfor
202192

203-
return map(l:commit_data_per_line,"blamer#CommitDataToMessage(v:val)")
193+
return map(l:commit_data_per_line,'blamer#CommitDataToMessage(v:val)')
204194
endfunction
205195

206196
function! blamer#SetVirtualText(buffer_number, line_number, message) abort
@@ -224,7 +214,7 @@ function! blamer#CreatePopup(buffer_number, line_number, message) abort
224214
\ 'id': l:propid,
225215
\})
226216

227-
let l:popup_winid = popup_create(s:blamer_prefix . a:message, {
217+
call popup_create(s:blamer_prefix . a:message, {
228218
\ 'textprop': 'blamer_popup_marker',
229219
\ 'textpropid': l:propid,
230220
\ 'line': -1,
@@ -240,7 +230,7 @@ function! blamer#Show() abort
240230
return
241231
endif
242232

243-
let l:is_buffer_special = &buftype != '' ? 1 : 0
233+
let l:is_buffer_special = &buftype !=# '' ? 1 : 0
244234
if l:is_buffer_special
245235
return
246236
endif
@@ -406,5 +396,5 @@ function! s:substitute_path_separator(path) abort
406396
return s:is_windows ? substitute(a:path, '\\', '/', 'g') : a:path
407397
endfunction
408398

409-
let &cpo = s:save_cpo
399+
let &cpoptions = s:save_cpo
410400
unlet s:save_cpo

0 commit comments

Comments
 (0)