New command :WakaTimeToday for displaying today's coding time

This commit is contained in:
Alan Hamlett 2019-05-07 01:02:39 -07:00
parent 904fe6bd1e
commit 6c21f85332
2 changed files with 12 additions and 1 deletions

View file

@ -43,6 +43,7 @@ Configuring
* `:WakaTimeScreenRedrawEnable` - enable screen redraw to prevent artifacts (only for Vim < 8.0)
* `:WakaTimeScreenRedrawEnableAuto` - redraw screen when plugin takes too long (only for Vim < 8.0)
* `:WakaTimeScreenRedrawDisable` - disable screen redraw
* `:WakaTimeToday` - echo your total coding activity for Today
#### Vimrc Settings:

View file

@ -118,6 +118,10 @@ let s:VERSION = '7.1.5'
return substitute(a:str, '^\s*\(.\{-}\)\s*$', '\1', '')
endfunction
function! s:Chomp(str)
return substitute(a:str, '\n\+$', '', '')
endfunction
function! s:SetupConfigFile()
if !s:config_file_already_setup
@ -588,6 +592,11 @@ let s:VERSION = '7.1.5'
endif
endfunction
function! g:WakaTimeToday()
let cmd = s:GetCommandPrefix() + ['--show-time-today']
echo "Today: " . s:Chomp(system(s:JoinArgs(cmd)))
endfunction
" }}}
@ -616,6 +625,7 @@ call s:Init()
:command -nargs=0 WakaTimeScreenRedrawDisable call s:DisableScreenRedraw()
:command -nargs=0 WakaTimeScreenRedrawEnable call s:EnableScreenRedraw()
:command -nargs=0 WakaTimeScreenRedrawEnableAuto call s:EnableScreenRedrawAuto()
:command -nargs=0 WakaTimeToday call g:WakaTimeToday()
" }}}