Code::Stats plugin for Zsh
This a fork of the original zsh-codestats plugin Licensed to Hannu Hartikainen
zsh-codestats hooks onto Zsh, counts characters as you type and saves your statistics in Code::Stats. You'll receive XP for the following languages for each character you type.
Terminal (Zsh)
Git
Vagrant
Docker
Gradle
- Ensure you have
curl
. - Get your personal API key from https://codestats.net/my/machines and set environment variable in e.g.
.zshrc
.CODESTATS_API_KEY="<api key here>"
- Install and source the script in one of the following ways (in
.zshrc
after the environment variable):
zplug "eendroroy/zsh-codestats"
Add a line for the plugin, run zplug update
, then restart the shell by e.g. exec zsh
.
Clone this git repo and source the script directly.
source codestats.plugin.zsh
If you are running Zsh on Windows and see this message:
_codestats_send_pulse:23: nice(5) failed: operation not permitted
This is caused due to WSL not supporting nice
and Zsh using it by default for
backgrounded processes. As a workaround, in your .zshrc
, set:
unsetopt BG_NICE
See the discussion in this related issue: microsoft/WSL#1887
CODESTATS_API_KEY
: the API key used when submitting pulses. Required.CODESTATS_API_URL
: the base URL to the Code::Stats API. Only set this if you know what you're doing! :)CODESTATS_LOG_FILE
: a log file for debugging. Must exist and be writable.
Bug reports and pull requests are welcome on GitHub at zsh-codestats repository. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
- Fork it ( https://github.com/eendroroy/zsh-codestats/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
The project is available as open source under the terms of the MIT License.