https://github.com/leonardcser/wpm-tracker.nvim
Track your wpm in neovim
https://github.com/leonardcser/wpm-tracker.nvim
lua nvim wpm
Last synced: 2 months ago
JSON representation
Track your wpm in neovim
- Host: GitHub
- URL: https://github.com/leonardcser/wpm-tracker.nvim
- Owner: leonardcser
- License: mit
- Created: 2025-05-31T15:52:20.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-10-02T12:46:03.000Z (9 months ago)
- Last Synced: 2025-10-19T09:03:53.290Z (8 months ago)
- Topics: lua, nvim, wpm
- Language: Lua
- Homepage:
- Size: 32.2 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WPM Tracker for Neovim
Track your typing speed in Neovim with separate metrics for manual typing and
completions/AI-assisted coding.
## Features
- **📝 Manual WPM**: Track your pure typing speed
- **🤖 Assisted WPM**: Include completions and AI assistance
- **📊 Live Display**: Real-time WPM in your statusline
- **💾 Data Export**: Save sessions to CSV for analysis
## Installation
### Using [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{
"leonardcser/wpm-tracker.nvim",
config = function()
require("wpm-tracker").setup({
-- Log file location (CSV format)
log_file = vim.fn.stdpath("data") .. "/wpm-tracker.csv",
-- Rolling average window size
average_window = 10,
-- Minimum session length to record (milliseconds)
min_session_length = 5000,
-- Update interval for lualine (milliseconds)
update_interval = 1000,
-- Stop tracking after inactivity (milliseconds)
idle_timeout = 5000,
})
-- Optional keymaps
vim.keymap.set("n", "ws", "WPMStats", { desc = "Show WPM statistics" })
vim.keymap.set("n", "wl", "WPMLog", { desc = "Open WPM log file" })
vim.keymap.set("n", "wc", "WPMClear", { desc = "Clear WPM history" })
vim.keymap.set("n", "wp", "WPMPlot", { desc = "Plot WPM data" })
end,
}
```
### Add to Lualine (Optional)
```lua
-- Add to your lualine configuration
sections = {
lualine_x = {
{
function()
return require("wpm-tracker").get_wpm_display()
end,
cond = function()
return require("wpm-tracker").get_current_wpm() > 0
end,
color = { fg = "#3EFFDC" },
},
-- ... other components
},
}
```
#### Custom Display Format
Use the `get_current_wpm()` function to get the current WPM instead of calling
`get_wpm_display()`.
```lua
sections = {
lualine_x = {
{
function()
local wpm = require("wpm-tracker").get_current_wpm()
-- Format the WPM as you like
return string.format("WPM: %d", wpm)
end,
cond = function()
return require("wpm-tracker").get_current_wpm() > 0
end,
color = { fg = "#3EFFDC" },
},
-- ... other components
},
}
```
## Usage
Just start typing! The plugin automatically tracks your WPM and shows it in
lualine.
**Commands:**
- `:WPMStats` - Show detailed statistics
- `:WPMLog` - Open your WPM log file
- `:WPMClear` - Clear all WPM history and log file (with confirmation prompt)
- `:WPMPlot [N]` - Display ASCII charts of your WPM data (optionally limit to last N points)
## How It Works
The plugin tracks two types of WPM:
- **Manual WPM**: Only counts characters you actually type
- **Assisted WPM**: Includes completions from LSP, Supermaven, etc.
The plugin automatically stops tracking if you enter insert mode but don't type
anything within the configured idle timeout period (default 5 seconds),
preventing empty sessions from being recorded.
This gives you insight into both your raw typing speed and your overall coding
productivity.
## CSV Export
Your typing sessions are automatically saved to a CSV file:
```csv
timestamp,manual_wpm,assisted_wpm,duration,manual_chars,total_chars
2024-01-15 14:30:25,65,120,12.3,95,185
```
## Documentation
For advanced usage and API details:
```vim
:help wpm-tracker
```
## Contributing
Contributions welcome! Please feel free to submit issues and pull requests.
## License
MIT License