Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/YannickFricke/codestats.nvim
A CodeStats.net client written for NeoVIM in LUA.
https://github.com/YannickFricke/codestats.nvim
Last synced: about 2 months ago
JSON representation
A CodeStats.net client written for NeoVIM in LUA.
- Host: GitHub
- URL: https://github.com/YannickFricke/codestats.nvim
- Owner: YannickFricke
- Created: 2021-06-10T06:28:07.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-26T22:57:09.000Z (3 months ago)
- Last Synced: 2024-07-05T10:44:24.268Z (2 months ago)
- Language: Lua
- Homepage:
- Size: 13.7 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# codestats.nvim
A [CodeStats.net](https://codestats.net/) client written for [NeoVIM](https://github.com/neovim/neovim) in LUA.
## Preqrequisites
This plugin is only available for NeoVIM with LUA support (version 0.5 and above).
## Installation
### Packer
```lua
-- 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'}}
}
```## Defaults
```lua
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
})
```## FAQ
### Getting the filetype of the current buffer
```vim
:lua print(vim.bo.filetype)
```The filetype will then be printed at the bottom left side.
### The plugin doesn't detect the correct language
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](#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.
1. Go to your [preferences](https://codestats.net/my/preferences)
2. Click on `Language aliases`
3. Follow the instructions on the page### The plugin sends XP where it shouldn't
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](#getting-the-filetype-of-the-current-buffer).
### The plugin doesn't count deletions
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.