prompt for api key after first buffer window has opened, because MacVim hangs forever waiting for user input before opening a buffer.
This commit is contained in:
parent
7936938364
commit
28ec37cab4
1 changed files with 16 additions and 12 deletions
|
@ -39,6 +39,22 @@ let s:VERSION = '3.0.5'
|
|||
endif
|
||||
endif
|
||||
|
||||
" Set default action frequency in minutes
|
||||
if !exists("g:wakatime_ActionFrequency")
|
||||
let g:wakatime_ActionFrequency = 2
|
||||
endif
|
||||
|
||||
" Globals
|
||||
let s:plugin_directory = expand("<sfile>:p:h") . '/'
|
||||
let s:config_file_exists = 0
|
||||
|
||||
" }}}
|
||||
|
||||
|
||||
" Function Definitions {{{
|
||||
|
||||
function! s:SetupConfigFile()
|
||||
if !s:config_file_exists
|
||||
" Create config file if does not exist
|
||||
if !filereadable(expand("$HOME/.wakatime.cfg"))
|
||||
let key = input("[WakaTime] Enter your wakatime.com api key: ")
|
||||
|
@ -47,21 +63,9 @@ let s:VERSION = '3.0.5'
|
|||
echo "[WakaTime] Setup complete! Visit http://wakatime.com to view your logged time."
|
||||
endif
|
||||
endif
|
||||
|
||||
" Set default action frequency in minutes
|
||||
if !exists("g:wakatime_ActionFrequency")
|
||||
let g:wakatime_ActionFrequency = 2
|
||||
let s:config_file_exists = 1
|
||||
endif
|
||||
|
||||
" Globals
|
||||
let s:plugin_directory = expand("<sfile>:p:h") . '/'
|
||||
let s:last_action = 0
|
||||
let s:fresh = 1
|
||||
|
||||
" }}}
|
||||
|
||||
|
||||
" Function Definitions {{{
|
||||
endfunction
|
||||
|
||||
function! s:GetCurrentFile()
|
||||
return expand("%:p")
|
||||
|
@ -105,7 +109,6 @@ let s:VERSION = '3.0.5'
|
|||
endfunction
|
||||
|
||||
function! s:SetLastAction(time, last_update, targetFile)
|
||||
let s:fresh = 0
|
||||
call writefile([substitute(printf('%d', a:time), ',', '.', ''), substitute(printf('%d', a:last_update), ',', '.', ''), a:targetFile], expand("$HOME/.wakatime.data"))
|
||||
endfunction
|
||||
|
||||
|
@ -131,6 +134,7 @@ let s:VERSION = '3.0.5'
|
|||
" Event Handlers {{{
|
||||
|
||||
function! s:normalAction()
|
||||
call s:SetupConfigFile()
|
||||
let targetFile = s:GetCurrentFile()
|
||||
let now = localtime()
|
||||
let last = s:GetLastAction()
|
||||
|
|
Loading…
Reference in a new issue