Skip to content

Commit

Permalink
New command :WakaTimeToday for displaying today's coding time
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhamlett committed May 7, 2019
1 parent 904fe6b commit 6c21f85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -19,7 +19,7 @@ Installation
Or with [Vim-plug](https://github.com/junegunn/vim-plug): add `Plug 'wakatime/vim-wakatime'` to .vimrc file. While in vim reload .vimrc with `:so ~/.vimrc` or restart vim, enter
`:PlugInstall`.

2. Enter your [api key](https://wakatime.com/settings#apikey), then press `enter`.
2. Enter your [api key](https://wakatime.com/settings#apikey), then press `enter`.

3. Use Vim and your coding activity will be displayed on your [WakaTime dashboard](https://wakatime.com).

Expand All @@ -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:

Expand Down
10 changes: 10 additions & 0 deletions plugin/wakatime.vim
Expand Up @@ -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

Expand Down Expand Up @@ -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

" }}}


Expand Down Expand Up @@ -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()

" }}}

Expand Down

0 comments on commit 6c21f85

Please sign in to comment.