A simple neovim plugin for Code::Stats.
- no need for Python, Lua is bundled with neovim!
- compatible with codestats-fish and codestats-zsh (
CODESTATS_API_KEY
)
- cURL
- neovim 0.5 or newer
use("mcarn/codestats.nvim")
local plugins = {"mcarn/codestats.nvim"}
require("lazy").setup(plugins, opts)
local present, codestats = pcall(require, "codestats")
if not present then
return
end
codestats.setup({
key: "CODESTATS_API_KEY",
username: "username"
})
Set the CODESTATS_API_KEY
environment variable to your CodeStats token.
set -Ux "SFMyNTY.OEotWWdnPT0jI01qaz0.X0wVEZquh8Ogau1iTtBihYqqL71FD8N6p5ChQiIpaxQ"
echo "export CODESTATS_API_KEY=SFMyNTY.OEotWWdnPT0jI01qaz0.X0wVEZquh8Ogau1iTtBihYqqL71FD8N6p5ChQiIpaxQ" >> ~/.zshenv
echo "export CODESTATS_API_KEY=SFMyNTY.OEotWWdnPT0jI01qaz0.X0wVEZquh8Ogau1iTtBihYqqL71FD8N6p5ChQiIpaxQ" >> ~/.bash_profile
You can also set CODESTATS_API_URL
if you want to use a different instance, eg.
set -Ux CODESTATS_API_URL "https://beta.codestats.net/api"
Use :Codestats
to open a popup window exposing your api response information.
Call get_codestats
in any of the sections.
local function get_codestats()
local codestats = require("codestats")
local exp = codestats.current_xp()
return "CS::" .. tostring(exp)
end