Skip to content

Commit 9977dfd

Browse files
committed
feat: optimise, lazy load
1 parent 9d2c505 commit 9977dfd

28 files changed

+1596
-3124
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 82 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,206 +1,136 @@
11
# codeme.nvim
22

3-
> Beautiful coding activity dashboard for Neovim
3+
> Beautiful coding dashboard for Neovim
44
5-
## Features
6-
7-
- 100% private and local - all data stored in SQLite on your machine
8-
- Tab-based dashboard with 6 interactive views
9-
- GitHub-style contribution heatmap (12 weeks)
10-
- Language and project breakdowns with visual bar graphs
11-
- Daily goals with progress tracking
12-
- Streak tracking with flame visualization
13-
- Achievements and gamification
14-
- Session tracking for focused coding periods
15-
- Trend comparisons (today vs yesterday, this week vs last)
16-
- Peak productivity insights
17-
- Auto-tracking on file save
18-
- Zero config - works out of the box
19-
- **Adaptive colorscheme** - automatically adapts to ANY Neovim colorscheme (Catppuccin, Gruvbox, Tokyo Night, Nord, etc.)
20-
- Smooth colorscheme transitions - updates instantly when you change themes
21-
22-
## Privacy
5+
Zero config. 100% private. Auto-adapts to your colorscheme.
236

24-
Your coding data never leaves your machine:
7+
![Overview](./docs/img/overview.png)
258

26-
- SQLite database stored locally at `~/.local/share/codeme/`
27-
- No accounts, no cloud sync, no telemetry
28-
- You own your data
29-
30-
## Installation
9+
## Features
3110

32-
### Prerequisites
11+
- Local-only, privacy-first SQLite storage
12+
- Heatmaps, streaks, achievements, and daily goals
13+
- Automatic session tracking with idle detection and theme support
3314

34-
- Neovim >= 0.11
35-
- [Codeme binary](https://github.com/tduyng/codeme) - auto-installed on first use
15+
## Install
3616

37-
### Using lazy.nvim
17+
### lazy.nvim
3818

3919
```lua
4020
{
4121
"tduyng/codeme.nvim",
22+
cmd = { "CodeMe", "CodeMeToggle" },
4223
config = function()
43-
require("codeme").setup({
44-
-- Optional configuration
45-
auto_install = true, -- Auto-install binary if not found (default: true)
46-
auto_track = true, -- Auto track on save (default: true)
47-
})
24+
require("codeme").setup()
4825
end,
49-
cmd = { "CodeMe", "CodeMeToggle", "CodeMeInstall" },
5026
}
5127
```
5228

53-
### Using native vim.pack (Neovim 0.12+)
29+
### vim.pack (Neovim 0.12+)
5430

5531
```lua
56-
vim.pack.add({
57-
"https://github.com/tduyng/codeme.nvim",
58-
})
59-
32+
vim.pack.add("https://github.com/tduyng/codeme.nvim")
6033
require("codeme").setup()
6134
```
6235

63-
### Binary Installation
64-
65-
The codeme binary will be **automatically installed** on first use. If you prefer manual installation:
66-
67-
```bash
68-
# Download from GitHub releases
69-
# Go to https://github.com/tduyng/codeme/releases
70-
# Download for your platform (macOS arm64 or x86_64)
71-
72-
# Or use the Neovim command
73-
:CodeMeInstall
74-
```
36+
The [codeme binary](https://github.com/tduyng/codeme) auto-installs on first use.
7537

7638
## Usage
7739

78-
### Commands
79-
80-
| Command | Description |
81-
| ----------------- | ---------------------------------------- |
82-
| `:CodeMe` | Open the beautiful dashboard |
83-
| `:CodeMeToggle` | Toggle dashboard visibility |
84-
| `:CodeMeToday` | Show today's stats notification |
85-
| `:CodeMeProjects` | Show project breakdown |
86-
| `:CodeMeInstall` | Install/update codeme binary from GitHub |
87-
| `:CodeMeVersion` | Show installed codeme version |
88-
89-
### Dashboard
90-
91-
**Navigation**
40+
```vim
41+
:CodeMe " Open dashboard
42+
:CodeMeToggle " Toggle visibility
43+
:CodeMeToday " Today's stats notification
44+
```
9245

93-
- `<Tab>` or `L` - Next tab
94-
- `<S-Tab>` or `H` - Previous tab
95-
- `1-6` - Jump to specific tab
96-
- `q` or `<Esc>` - Close dashboard
46+
**Keybinding example:**
9747

98-
**Tabs**
48+
```lua
49+
vim.keymap.set("n", "<leader>cm", "<cmd>CodeMe<cr>")
50+
```
9951

100-
1. **β˜€οΈ Today** - Today's coding session with time, lines, files, languages, top files, sessions, hourly activity, and daily goal progress
101-
2. **πŸ“… Weekly** - Week summary with comparison to last week and GitHub-style contribution heatmap
102-
3. **πŸ“Š Overview** - Overall stats with streak flames, coding trends, and totals
103-
4. **πŸ’‘ Insights** - Peak productivity times, comparisons, and achievements
104-
5. **πŸ’» Languages** - Top languages breakdown with time and lines
105-
6. **πŸ”₯ Projects** - Active projects breakdown
52+
## Dashboard
10653

107-
#### Today
54+
**Navigate:**
10855

109-
![today](./docs/img/today.png)
56+
- `Tab` / `L` β†’ Next tab
57+
- `Shift-Tab` / `H` β†’ Previous tab
58+
- `1-5` β†’ Jump to tab
59+
- `q` / `Esc` β†’ Close
11060

111-
#### Overview
61+
**Tabs:**
11262

113-
![overview](./docs/img/overview.png)
63+
| Tab | Content |
64+
| --------------- | ----------------------------------- |
65+
| πŸ“Š **Overview** | Streaks, achievements, totals |
66+
| ⏰ **Activity** | Today's sessions, languages, files |
67+
| πŸ“… **Weekly** | GitHub-style heatmap, weekly trends |
68+
| πŸ“ **Work** | Projects and languages breakdown |
69+
| πŸ† **Records** | Personal bests and milestones |
11470

115-
#### Languages
71+
![Today](./docs/img/today.png)
72+
![Languages](./docs/img/languages.png)
73+
![Projects](./docs/img/projects.png)
11674

117-
![languages](./docs/img/languages.png)
75+
## Achievements
11876

119-
#### Projects
77+
Unlock achievements as you code:
12078

121-
![projects](./docs/img/projects.png)
79+
| Icon | Name | Unlock |
80+
| ---- | ----------------- | ------------------- |
81+
| πŸ”₯ | 5-Day Fire | 5-day streak |
82+
| 🧨 | 30-Day Streak | 30-day streak |
83+
| πŸ’₯ | 90-Day Inferno | 90-day streak |
84+
| πŸŒ‹ | 180-Day Blaze | 180-day streak |
85+
| 🌞 | Eternal Flame | 365-day streak |
86+
| 🌧️ | 1K Line Wave | 1,000 lines |
87+
| ⚑ | 10K Line Surge | 10,000 lines |
88+
| β›ˆοΈ | 50K Line Flood | 50,000 lines |
89+
| 🌊 | 100K Line Ocean | 100,000 lines |
90+
| ⚑ | 50h Spark | 50 hours total |
91+
| 🌩️ | 1K h Lightning | 1,000 hours |
92+
| β›ˆοΈ | 5K h Thunder | 5,000 hours |
93+
| πŸŒ€ | 10K h Mastery | 10,000 hours |
94+
| πŸ’‘ | 20K h Grandmaster | 20,000 hours |
95+
| πŸš€ | Bilingual | 2 languages |
96+
| 🌍 | Polyglot | 5 languages |
97+
| 🧠 | Polyglot Master | 10 languages |
98+
| πŸŽ“ | Code Polymath | 15 languages |
99+
| πŸŒ… | Dawn Coder | Code before 6 AM |
100+
| 🌌 | Night Coder | Code after midnight |
101+
| β˜• | 2h Warm Up | 2+ hour session |
102+
| 🎯 | 4h Focus | 4+ hour session |
103+
| 🌊 | 6h Flow State | 6+ hour session |
104+
| 🧠 | 8h Deep Work | 8+ hour session |
105+
| πŸ§˜β€β™‚οΈ | 10h Monk Mode | 10+ hour session |
106+
| πŸ‘‘ | 12h Legendary | 12+ hour session |
122107

123108
## Configuration
124109

110+
Here are the default configs:
111+
125112
```lua
126113
require("codeme").setup({
127-
-- Binary settings
128-
codeme_bin = "codeme", -- Binary name (auto-detected if installed)
129-
auto_install = true, -- Auto-install binary if not found
130-
131-
-- Tracking settings
132-
auto_track = true, -- Track files on save
133-
track_on_idle = false, -- Track on cursor idle (not implemented)
114+
-- Binary
115+
codeme_bin = "codeme", -- Auto-detected
116+
auto_install = true, -- Install if missing
134117

135-
-- UI settings
136-
verbose = false, -- Show tracking notifications
118+
-- Tracking
119+
auto_track = true, -- Track on save
120+
verbose = false, -- Show notifications
137121

138-
-- Daily goals (set to 0 to disable)
122+
-- Goals (0 to disable)
139123
goals = {
140-
daily_hours = 4, -- Daily goal in hours
141-
daily_lines = 500, -- Daily goal in lines
124+
daily_hours = 4, -- Hours per day
125+
daily_lines = 500, -- Lines per day
142126
},
143127
})
144128
```
145129

146-
### Custom Keybinding
147-
148-
```lua
149-
vim.keymap.set("n", "<leader>cm", "<cmd>CodeMe<cr>", { desc = "Open CodeMe Dashboard" })
150-
vim.keymap.set("n", "<leader>ct", "<cmd>CodeMeToggle<cr>", { desc = "Toggle CodeMe" })
151-
```
152-
153-
## Colorscheme Support
154-
155-
CodeMe automatically adapts to **ANY** Neovim colorscheme! It intelligently extracts colors from your active theme's highlight groups, ensuring the dashboard always looks beautiful and cohesive.
156-
157-
### How it works
158-
159-
- **Automatic color extraction** - Colors are pulled from standard highlight groups (String, Function, Error, etc.)
160-
- **Instant updates** - Dashboard colors update automatically when you change colorschemes
161-
- **Universal compatibility** - Works with ALL colorschemes: Catppuccin, Gruvbox, Tokyo Night, Nord, Everforest, Kanagawa, and more
162-
- **Graceful fallbacks** - If a color isn't found, it intelligently falls back to ensure nothing breaks
163-
164-
### Example
165-
166-
```lua
167-
-- Switch colorscheme anytime - CodeMe adapts instantly!
168-
vim.cmd.colorscheme("catppuccin")
169-
vim.cmd("CodeMe")
170-
171-
-- Change to Gruvbox - dashboard colors update automatically
172-
vim.cmd.colorscheme("gruvbox")
173-
vim.cmd("CodeMe")
174-
175-
-- Try Tokyo Night - perfect color harmony maintained
176-
vim.cmd.colorscheme("tokyonight")
177-
vim.cmd("CodeMe")
178-
```
179-
180-
No configuration needed - it just works! The dashboard will always match your editor's aesthetic.
181-
182-
## Achievements
183-
184-
Unlock achievements as you code:
185-
186-
| Achievement | Description |
187-
| ---------------------- | -------------------------------- |
188-
| 🎯 First Steps | Track your first coding activity |
189-
| πŸ”₯ Getting Started | Maintain a 3-day coding streak |
190-
| ⚑ Weekly Warrior | Maintain a 7-day coding streak |
191-
| πŸ‘‘ Monthly Master | Maintain a 30-day coding streak |
192-
| πŸ’» Code Machine | Write 1,000 lines of code |
193-
| πŸš€ Prolific Programmer | Write 10,000 lines of code |
194-
| ⏰ Dedicated Developer | Code for 10 hours total |
195-
| πŸ† Century Coder | Code for 100 hours total |
196-
| 🌍 Polyglot | Code in 5 different languages |
197-
| πŸŒ… Early Bird | Code before 7 AM |
198-
| πŸ¦‰ Night Owl | Code after midnight |
199-
200130
## License
201131

202132
MIT
203133

204134
---
205135

206-
Made with ❀️ for the Neovim community
136+
Made with ❀️ for Neovim

0 commit comments

Comments
Β (0)