Skip to content

Commit 117b079

Browse files
committed
feat: marksman mk1
1 parent 3291901 commit 117b079

File tree

2 files changed

+858
-0
lines changed

2 files changed

+858
-0
lines changed

README.md

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# Marksman.nvim
2+
3+
A project-scoped bookmark manager for Neovim with beautiful UI and Telescope integration.
4+
5+
## Installation
6+
7+
### Using lazy.nvim
8+
9+
```lua
10+
{
11+
"alexekdahl/marksman.nvim",
12+
event = "VeryLazy",
13+
keys = {
14+
{ "<C-a>", function() require("marksman").add_mark() end, desc = "Add mark" },
15+
{ "<C-e>", function() require("marksman").show_marks() end, desc = "Show marks" },
16+
{ "<M-y>", function() require("marksman").goto_mark(1) end, desc = "Go to mark 1" },
17+
{ "<M-u>", function() require("marksman").goto_mark(2) end, desc = "Go to mark 2" },
18+
{ "<M-i>", function() require("marksman").goto_mark(3) end, desc = "Go to mark 3" },
19+
{ "<M-o>", function() require("marksman").goto_mark(4) end, desc = "Go to mark 4" },
20+
},
21+
cmd = {
22+
"MarkAdd", "MarkGoto", "MarkDelete", "MarkRename",
23+
"MarkList", "MarkClear", "MarkTelescope",
24+
"MarkExport", "MarkImport",
25+
},
26+
opts = {
27+
-- Configuration goes here
28+
},
29+
}
30+
```
31+
32+
## Configuration
33+
34+
Default configuration:
35+
36+
```lua
37+
{
38+
keymaps = {
39+
add = "<C-a>",
40+
show = "<C-e>",
41+
goto_1 = "<M-y>",
42+
goto_2 = "<M-u>",
43+
goto_3 = "<M-i>",
44+
goto_4 = "<M-o>",
45+
},
46+
highlights = {
47+
ProjectMarksTitle = { fg = "#7aa2f7", bold = true },
48+
ProjectMarksNumber = { fg = "#bb9af7" },
49+
ProjectMarksName = { fg = "#9ece6a", bold = true },
50+
ProjectMarksFile = { fg = "#73daca" },
51+
ProjectMarksLine = { fg = "#ff9e64" },
52+
ProjectMarksText = { fg = "#565f89", italic = true },
53+
ProjectMarksHelp = { fg = "#7aa2f7" },
54+
ProjectMarksBorder = { fg = "#3b4261" },
55+
},
56+
auto_save = true,
57+
max_marks = 100,
58+
}
59+
```
60+
61+
### Custom Configuration Example
62+
63+
```lua
64+
{
65+
"alexekdahl/marksman.nvim",
66+
opts = {
67+
keymaps = {
68+
add = "<leader>ma",
69+
show = "<leader>ms",
70+
goto_1 = "<leader>m1",
71+
goto_2 = "<leader>m2",
72+
goto_3 = "<leader>m3",
73+
goto_4 = "<leader>m4",
74+
},
75+
max_marks = 50,
76+
auto_save = true,
77+
},
78+
}
79+
```
80+
81+
### Disable Keymaps
82+
83+
```lua
84+
{
85+
"alexekdahl/marksman.nvim",
86+
opts = {
87+
keymaps = false, -- Disable all default keymaps
88+
},
89+
}
90+
```
91+
92+
## Commands
93+
94+
| Command | Description |
95+
|---------|-------------|
96+
| `:MarkAdd [name]` | Add a mark at current cursor position |
97+
| `:MarkGoto [name]` | Go to a mark (shows list if no name provided) |
98+
| `:MarkDelete [name]` | Delete a mark (clears all if no name provided) |
99+
| `:MarkRename <old> <new>` | Rename a mark |
100+
| `:MarkList` | Show all marks in floating window |
101+
| `:MarkClear` | Clear all marks (with confirmation) |
102+
| `:MarkTelescope` | Open marks in Telescope |
103+
| `:MarkExport` | Export marks to JSON file |
104+
| `:MarkImport` | Import marks from JSON file |
105+
106+
## Features
107+
108+
- **Project-scoped**: Marks are stored per-project (based on git root)
109+
- **Smart naming**: Auto-generates meaningful names from context
110+
- **Beautiful UI**: Floating window with syntax highlighting
111+
- **File icons**: Automatic file type icons
112+
- **Quick navigation**: Number keys (1-9) for instant jumping
113+
- **Telescope integration**: Browse marks with preview
114+
- **Import/Export**: Share marks across machines
115+
- **Persistent**: Marks survive Neovim restarts
116+
117+
## Usage
118+
119+
### Adding Marks
120+
121+
```vim
122+
" Add mark with auto-generated name
123+
:MarkAdd
124+
125+
" Add mark with custom name
126+
:MarkAdd important_function
127+
```
128+
129+
Or use the keymap: `<C-a>` (default)
130+
131+
### Viewing Marks
132+
133+
```vim
134+
:MarkList
135+
```
136+
137+
Or use the keymap: `<C-e>` (default)
138+
139+
In the marks window:
140+
- `<CR>` or `1-9`: Jump to mark
141+
- `d`: Delete mark
142+
- `r`: Rename mark
143+
- `q` or `<Esc>`: Close window
144+
145+
### Quick Access
146+
147+
Use the quick goto keymaps to jump to your most recent marks:
148+
- `<M-y>`: Jump to mark #1
149+
- `<M-u>`: Jump to mark #2
150+
- `<M-i>`: Jump to mark #3
151+
- `<M-o>`: Jump to mark #4
152+
153+
### Telescope Integration
154+
155+
```vim
156+
:MarkTelescope
157+
```
158+
159+
Use Telescope's fuzzy finder to search through your marks with live preview.
160+
161+
## API
162+
163+
```lua
164+
local marksman = require("marksman.nvim")
165+
166+
-- Add a mark
167+
marksman.add_mark("my_mark")
168+
169+
-- Go to a mark
170+
marksman.goto_mark("my_mark")
171+
marksman.goto_mark(1) -- Jump to first mark
172+
173+
-- Delete a mark
174+
marksman.delete_mark("my_mark")
175+
176+
-- Rename a mark
177+
marksman.rename_mark("old_name", "new_name")
178+
179+
-- Show marks UI
180+
marksman.show_marks()
181+
182+
-- Get marks count
183+
local count = marksman.get_marks_count()
184+
185+
-- Clear all marks
186+
marksman.clear_all_marks()
187+
188+
-- Export/Import
189+
marksman.export_marks()
190+
marksman.import_marks()
191+
192+
-- Telescope integration
193+
marksman.telescope_marks()
194+
```
195+
196+
## Tips
197+
198+
1. **Auto-naming**: Leave the name empty when adding marks - the plugin will generate meaningful names based on the code context (function names, class names, etc.)
199+
200+
2. **Quick marks**: Use the numbered quick access keys (`<M-y>`, `<M-u>`, etc.) for frequently used marks
201+
202+
3. **Organization**: Rename marks to meaningful names for better organization
203+
204+
4. **Backup**: Use `:MarkExport` to backup your marks before major changes
205+
206+
## License
207+
208+
MIT

0 commit comments

Comments
 (0)