A CodeStats.net client written for NeoVIM in LUA.
This plugin is only available for NeoVIM with LUA support (version 0.5 and above).
-- Initialize with explicit token
use {
'YannickFricke/codestats.nvim',
config = function()
require('codestats-nvim').setup({
token = "MY-CODESTATS-MACHINE-TOKEN"
})
end,
requires = {{'nvim-lua/plenary.nvim'}}
}
-- Initialize via the CODESTATS_API_KEY environment variable
use {
'YannickFricke/codestats.nvim',
config = function()
require('codestats-nvim').setup()
end,
requires = {{'nvim-lua/plenary.nvim'}}
}
require('codestats-nvim').setup({
token = nil, -- When the token is not provided, codestats.nvim will fallback to the CODESTATS_API_KEY environment variable
endpoint = "https://codestats.net", -- The endpoint which should be used. Mostly you dont want to overwrite it
interval = 60, -- The interval in seconds between pushes to the CodeStats API
})
:lua print(vim.bo.filetype)
The filetype will then be printed at the bottom left side.
Every known filetype which maps to the correct language are defined in ./lua/codestats-nvim/filetypes.lua
in the mapped_filetypes
variable.
To get the filetype of the current buffer see Getting the filetype of the current buffer.
Feel free to send a pull request to make your alias available to everyone else!
Beware: I won't merge pull request with wrong mappings.
For example vimwiki
maps the markdown
to vimwiki
(which is absolutely wrong)
Otherwise you have the possibility to remap existing languages in Code::Stats itself.
- Go to your preferences
- Click on
Language aliases
- Follow the instructions on the page
All filetypes which should be ignored are defined in ./lua/codestats-nvim/filetypes.lua
in the ignored_filetypes
variable.
To get the filetype of the current buffer see Getting the filetype of the current buffer.
Yes this is a serious thing. Currently I didn't found a nice way to detect deletions.
Sadly the autocmd
s don't offer an event way to detect single deletions.