mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 07:09:11 +08:00
Fix lint
This commit is contained in:
parent
a01ca069c2
commit
ae00f6bda1
@ -1,9 +1,10 @@
|
|||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
scriptencoding utf-8
|
||||||
|
|
||||||
let s:fish = &shell =~# 'fish'
|
let s:fish = &shell =~# 'fish'
|
||||||
|
|
||||||
function! vimfiler#columns#gitstatus#define()
|
function! vimfiler#columns#gitstatus#define() abort
|
||||||
return s:column
|
return s:column
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
|
||||||
@ -13,9 +14,14 @@ let s:column = {
|
|||||||
\ 'syntax' : 'vimfilerColumn__Git',
|
\ 'syntax' : 'vimfilerColumn__Git',
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! s:column.length(files, context) "{{{
|
" @vimlint(EVL103, 1, a:files)
|
||||||
|
" @vimlint(EVL103, 1, a:context)
|
||||||
|
function! s:column.length(files, context) abort
|
||||||
return 3
|
return 3
|
||||||
endfunction "}}}
|
endfunction
|
||||||
|
" @vimlint(EVL103, 0, a:files)
|
||||||
|
" @vimlint(EVL103, 0, a:context)
|
||||||
|
|
||||||
if !exists('g:VimFilerGitIndicatorMap')
|
if !exists('g:VimFilerGitIndicatorMap')
|
||||||
let g:VimFilerGitIndicatorMap = {
|
let g:VimFilerGitIndicatorMap = {
|
||||||
\ 'Modified' : '✹',
|
\ 'Modified' : '✹',
|
||||||
@ -31,9 +37,10 @@ if !exists('g:VimFilerGitIndicatorMap')
|
|||||||
\ }
|
\ }
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:column.define_syntax(context) "{{{
|
" @vimlint(EVL103, 1, a:context)
|
||||||
|
function! s:column.define_syntax(context) abort
|
||||||
for name in keys(g:VimFilerGitIndicatorMap)
|
for name in keys(g:VimFilerGitIndicatorMap)
|
||||||
exe "syntax match vimfilerColumn__Git" . name
|
exe 'syntax match vimfilerColumn__Git' . name
|
||||||
\ . " '\[" . g:VimFilerGitIndicatorMap[name]
|
\ . " '\[" . g:VimFilerGitIndicatorMap[name]
|
||||||
\ . "\]' contained containedin=vimfilerColumn__Git"
|
\ . "\]' contained containedin=vimfilerColumn__Git"
|
||||||
endfor
|
endfor
|
||||||
@ -46,20 +53,21 @@ function! s:column.define_syntax(context) "{{{
|
|||||||
highlight def link vimfilerColumn__GitDirty Tag
|
highlight def link vimfilerColumn__GitDirty Tag
|
||||||
highlight def link vimfilerColumn__GitClean DiffAdd
|
highlight def link vimfilerColumn__GitClean DiffAdd
|
||||||
highlight def link vimfilerColumn__GitUnknown Text
|
highlight def link vimfilerColumn__GitUnknown Text
|
||||||
endfunction "}}}
|
endfunction
|
||||||
|
" @vimlint(EVL103, 0, a:context)
|
||||||
|
|
||||||
function s:directory_of_file(file)
|
function! s:directory_of_file(file) abort
|
||||||
return fnamemodify(a:file, ':h')
|
return fnamemodify(a:file, ':h')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:system(cmd, ...)
|
function! s:system(cmd, ...) abort
|
||||||
silent let output = (a:0 == 0) ? system(a:cmd) : system(a:cmd, a:1)
|
silent let output = (a:0 == 0) ? system(a:cmd) : system(a:cmd, a:1)
|
||||||
return output
|
return output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:git_shellescape(arg)
|
function! s:git_shellescape(arg) abort
|
||||||
if a:arg =~ '^[A-Za-z0-9_/.-]\+$'
|
if a:arg =~# '^[A-Za-z0-9_/.-]\+$'
|
||||||
return a:arg
|
return a:arg
|
||||||
elseif &shell =~# 'cmd' || gitgutter#utility#using_xolox_shell()
|
elseif &shell =~# 'cmd' || gitgutter#utility#using_xolox_shell()
|
||||||
return '"' . substitute(substitute(a:arg, '"', '""', 'g'), '%', '"%"', 'g') . '"'
|
return '"' . substitute(substitute(a:arg, '"', '""', 'g'), '%', '"%"', 'g') . '"'
|
||||||
@ -68,13 +76,13 @@ function! s:git_shellescape(arg)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:cmd_in_directory_of_file(file, cmd)
|
function! s:cmd_in_directory_of_file(file, cmd) abort
|
||||||
return 'cd '.s:git_shellescape(s:directory_of_file(a:file)) . (s:fish ? '; and ' : ' && ') . a:cmd
|
return 'cd '.s:git_shellescape(s:directory_of_file(a:file)) . (s:fish ? '; and ' : ' && ') . a:cmd
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function! s:git_state_to_name(symb) " TODO: X, Y
|
function! s:git_state_to_name(symb) abort
|
||||||
if a:symb ==# '?'
|
if a:symb ==# '?'
|
||||||
return 'Untracked'
|
return 'Untracked'
|
||||||
elseif a:symb ==# ' '
|
elseif a:symb ==# ' '
|
||||||
@ -93,15 +101,16 @@ endif
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:git_state_to_symbol(s)
|
function! s:git_state_to_symbol(s) abort
|
||||||
let name = s:git_state_to_name(a:s)
|
let name = s:git_state_to_name(a:s)
|
||||||
return g:VimFilerGitIndicatorMap[name]
|
return g:VimFilerGitIndicatorMap[name]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let g:wsd = []
|
let g:wsd = []
|
||||||
|
|
||||||
function! s:column.get(file, context) "{{{
|
" @vimlint(EVL103, 1, a:context)
|
||||||
let cmd = "git -c color.status=false status -s " . fnamemodify(a:file.action__path, ':.')
|
function! s:column.get(file, context) abort
|
||||||
|
let cmd = 'git -c color.status=false status -s ' . fnamemodify(a:file.action__path, ':.')
|
||||||
let output = systemlist(cmd)
|
let output = systemlist(cmd)
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
return ' '
|
return ' '
|
||||||
@ -120,7 +129,8 @@ function! s:column.get(file, context) "{{{
|
|||||||
return ' '
|
return ' '
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction
|
||||||
|
" @vimlint(EVL103, 0, a:context)
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user