Permalink
Browse files

modified behaviour a command 'EdTime'

argument is not given then display current file,
if not display all files
  • Loading branch information...
1 parent 2a6a876 commit f3e9f590393316d6c03422f059301a8bfc5e1595 @tacahiroy committed Mar 22, 2012
Showing with 15 additions and 3 deletions.
  1. +15 −3 plugin/edtime.vim
View
@@ -127,10 +127,17 @@ function! s:edtime.load() dict
endfor
endfunction
-function! s:edtime.show() dict
+function! s:edtime.show(...) dict
try
call self.stop(s:curfile())
- for [k, v] in items(self.files)
+
+ let files = {}
+ if a:0 == 0
+ let files = {s:curfile(): self.files[s:curfile()]}
+ else
+ let files = self.files
+ endif
+ for [k, v] in items(files)
echo printf('%s: %s', k, s:format_time(float2nr(round(v.total))))
endfor
finally
@@ -140,7 +147,12 @@ endfunction
" }}}
-command! EdTime call s:edtime.show()
+" Command
+function! s:complete_edtime(A, L, P)
+ return ['all']
+endfunction
+command! -nargs=? -complete=customlist,s:complete_edtime
+ \ EdTime call s:edtime.show(<f-args>)
augroup EdTime

0 comments on commit f3e9f59

Please sign in to comment.