upgrade wakatime conf file to ~/.wakatime.cfg

This commit is contained in:
Alan Hamlett 2013-12-13 16:03:09 +01:00
parent 292546d39e
commit 9d4ec4cfcb

View file

@ -35,13 +35,20 @@ let s:VERSION = '1.3.1'
if filereadable(expand("$HOME/.wakatime")) if filereadable(expand("$HOME/.wakatime"))
exec "silent !mv" expand("$HOME/.wakatime") expand("$HOME/.wakatime.conf") exec "silent !mv" expand("$HOME/.wakatime") expand("$HOME/.wakatime.conf")
endif endif
if filereadable(expand("$HOME/.wakatime.conf"))
if !filereadable(expand("$HOME/.wakatime.cfg"))
let contents = ['[settings]'] + readfile(expand("$HOME/.wakatime.conf"), '')
call writefile(contents, expand("$HOME/.wakatime.cfg"))
call delete(expand("$HOME/.wakatime.conf"))
endif
endif
" Create config file if does not exist " Create config file if does not exist
if !filereadable(expand("$HOME/.wakatime.conf")) if !filereadable(expand("$HOME/.wakatime.cfg"))
let key = input("Enter your WakaTi.me api key: ") let key = input("[WakaTime] Enter your wakatime.com api key: ")
if key != '' if key != ''
call writefile([printf("api_key=%s", key)], expand("$HOME/.wakatime.conf")) call writefile(['[settings]', printf("api_key=%s", key)], expand("$HOME/.wakatime.cfg"))
echo "WakaTi.me setup complete! Visit https://wakati.me to view your logged time." echo "[WakaTime] Setup complete! Visit http://wakatime.com to view your logged time."
endif endif
endif endif