allow changing the python binary used

This commit is contained in:
Alan Hamlett 2015-02-12 19:19:40 -08:00
parent 30ce2e3067
commit d639c5ea7b
2 changed files with 26 additions and 6 deletions

View File

@ -28,3 +28,16 @@ Screen Shots
------------
![Project Overview](https://wakatime.com/static/img/ScreenShots/ScreenShot-2014-10-29.png)
Configuring
-----------
To use a custom python binary:
let g:wakatime_PythonBinary = '/usr/bin/python'
The default is to use `python` from your system PATH.
More configs can be set in your `$HOME/.wakatime.cfg` file, which will be read
by `wakatime-cli.py`. Learn more [here](https://github.com/wakatime/wakatime#configuring).

View File

@ -39,9 +39,14 @@ let s:VERSION = '3.0.7'
endif
endif
" Set default action frequency in minutes
if !exists("g:wakatime_ActionFrequency")
let g:wakatime_ActionFrequency = 2
" Set default python binary location
if !exists("g:wakatime_PythonBinary")
let g:wakatime_PythonBinary = 'python'
endif
" Set default heartbeat frequency in minutes
if !exists("g:wakatime_HeartbeatFrequency")
let g:wakatime_HeartbeatFrequency = 2
endif
" Globals
@ -77,9 +82,11 @@ let s:VERSION = '3.0.7'
let targetFile = a:last[2]
endif
if targetFile != ''
let python_bin = 'python'
let python_bin = g:wakatime_PythonBinary
if has('win32') || has('win64')
let python_bin = 'pythonw'
if python_bin == 'python'
let python_bin = 'pythonw'
endif
endif
let cmd = [python_bin, '-W', 'ignore', s:plugin_directory . 'packages/wakatime/wakatime-cli.py']
let cmd = cmd + ['--file', shellescape(targetFile)]
@ -122,7 +129,7 @@ let s:VERSION = '3.0.7'
function! s:EnoughTimePassed(now, last)
let prev = a:last[0]
if a:now - prev > g:wakatime_ActionFrequency * 60
if a:now - prev > g:wakatime_HeartbeatFrequency * 60
return 1
endif
return 0