mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 09:40:04 +08:00
perf(sourcecounter): use notify api instead of echo
This commit is contained in:
parent
0b22cc3e0b
commit
ee82313ec0
@ -1,3 +1,6 @@
|
|||||||
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
|
let s:NOTI = SpaceVim#api#import('notify')
|
||||||
|
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
let s:support_ft = ['vim', 'java', 'c', 'py', 'md', 'txt']
|
let s:support_ft = ['vim', 'java', 'c', 'py', 'md', 'txt']
|
||||||
function! SourceCounter#View(bang, ...) abort
|
function! SourceCounter#View(bang, ...) abort
|
||||||
@ -7,7 +10,8 @@ function! SourceCounter#View(bang, ...) abort
|
|||||||
else
|
else
|
||||||
let fts = s:support_ft
|
let fts = s:support_ft
|
||||||
endif
|
endif
|
||||||
echom string(fts)
|
call s:NOTI.notify('counting for: ' . join(fts, ', '))
|
||||||
|
" return
|
||||||
for ft in fts
|
for ft in fts
|
||||||
let _rs = s:counter(ft)
|
let _rs = s:counter(ft)
|
||||||
if !empty(_rs)
|
if !empty(_rs)
|
||||||
@ -22,7 +26,7 @@ function! SourceCounter#View(bang, ...) abort
|
|||||||
call append(line('$'), line)
|
call append(line('$'), line)
|
||||||
endfor
|
endfor
|
||||||
else
|
else
|
||||||
echo join(table, "\n")
|
call s:NOTI.notify(join(table, "\n"))
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -103,6 +107,14 @@ function! s:draw_table(rst) abort
|
|||||||
return table
|
return table
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:list_files_stdout(id, data, event) abort
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:list_files_exit(id, data, event) abort
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:counter(ft) abort
|
function! s:counter(ft) abort
|
||||||
let path = getcwd()
|
let path = getcwd()
|
||||||
let partten = '**/*.' . a:ft
|
let partten = '**/*.' . a:ft
|
||||||
|
Loading…
Reference in New Issue
Block a user