Skip to content

Commit 53bba6b

Browse files
committed
Disable plugin when missing api key
1 parent d72aac7 commit 53bba6b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

plugin/wakatime.vim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,10 @@ EOF
337337
endif
338338

339339
if !found_api_key
340-
echoerr '[WakaTime] Type the Vim command :WakaTimeApiKey to enter your WakaTime API Key. Find yours at https://wakatime.com/api-key'
340+
echomsg '[WakaTime] Type the Vim command :WakaTimeApiKey to enter your WakaTime API Key. Find yours at https://wakatime.com/api-key'
341+
else
342+
let s:config_file_already_setup = s:true
341343
endif
342-
343-
let s:config_file_already_setup = s:true
344344
endif
345345
endfunction
346346

@@ -740,14 +740,16 @@ EOF
740740
endfunction
741741

742742
function! s:PromptForApiKey()
743-
let api_key = s:false
744743
let api_key = s:GetIniSetting('settings', 'api_key')
745744
if empty(api_key)
746745
let api_key = s:GetIniSetting('settings', 'apikey')
747746
endif
748747

749748
let api_key = inputsecret("[WakaTime] Enter your wakatime.com api key: ", api_key)
750749
call s:SetIniSetting('settings', 'api_key', api_key)
750+
if !empty(api_key)
751+
let s:config_file_already_setup = s:true
752+
endif
751753
endfunction
752754

753755
function! s:EnableDebugMode()
@@ -783,6 +785,9 @@ EOF
783785
endfunction
784786

785787
function! s:HandleActivity(is_write)
788+
if !s:config_file_already_setup
789+
return
790+
endif
786791
let file = s:GetCurrentFile()
787792
if !empty(file) && file !~ "-MiniBufExplorer-" && file !~ "--NO NAME--" && file !~ "^term:"
788793
let last = s:GetLastHeartbeat()

0 commit comments

Comments
 (0)