Skip to content

Commit de2891f

Browse files
committed
feat: add commands
1 parent 222528e commit de2891f

File tree

3 files changed

+558
-0
lines changed

3 files changed

+558
-0
lines changed

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,95 @@
11
# archive.nvim
2+
3+
Intelligent notes with wikilink support and autocomplete. Heavily inspired by [The Archive](https://zettelkasten.de/the-archive/) app.
4+
5+
## Features
6+
7+
- Create timestamped markdown notes with unique IDs
8+
- Wikilink autocomplete with `nvim-cmp` integration
9+
- Navigate between notes using wikilinks (`[[Note Title]]`) and markdown syntax links (`[text](url)`)
10+
- Automatic note creation
11+
- Open URLs in default browser
12+
13+
## Requirements
14+
15+
- [ripgrep](https://github.com/BurntSushi/ripgrep) (required for file searching)
16+
- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) (optional, for autocomplete)
17+
18+
## Installation
19+
20+
### vim-plug
21+
22+
```vim
23+
Plug 'hisamafahri/archive.nvim'
24+
```
25+
26+
### dein.vim
27+
28+
```vim
29+
call dein#add('hisamafahri/archive.nvim')
30+
```
31+
32+
### packer.nvim
33+
34+
```lua
35+
use 'hisamafahri/archive.nvim'
36+
```
37+
38+
### lazy.nvim
39+
40+
```lua
41+
{
42+
'hisamafahri/archive.nvim',
43+
config = function()
44+
require('archive').setup({
45+
workspace = '~/notes' -- Required: path to your notes directory
46+
})
47+
end
48+
}
49+
```
50+
51+
## Configuration
52+
53+
### Basic Setup
54+
55+
```lua
56+
require('archive').setup({
57+
workspace = '~/notes' -- Required: path to your notes directory
58+
})
59+
```
60+
61+
### With nvim-cmp Integration
62+
63+
```lua
64+
-- Setup archive.nvim
65+
require('archive').setup({
66+
workspace = '~/notes'
67+
})
68+
69+
-- Add to your nvim-cmp sources
70+
require('cmp').setup({
71+
sources = {
72+
{ name = 'archive_wikilink' },
73+
-- your other sources...
74+
}
75+
})
76+
```
77+
78+
## Usage
79+
80+
### Available Commands
81+
82+
- `:Archive new` - Create a new note with user input title
83+
- `:Archive go_to_link` - Navigate to link under cursor
84+
85+
### Keybindings
86+
87+
Add these to your Neovim configuration:
88+
89+
```lua
90+
-- Create new note
91+
vim.keymap.set('n', '<leader>an', ':Archive new<CR>', { desc = 'Create new note' })
92+
93+
-- Navigate to link under cursor
94+
vim.keymap.set('n', '<leader>ag', ':Archive go_to_link<CR>', { desc = 'Go to link under cursor' })
95+
```

doc/archive.nvim.txt

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
*archive.nvim.txt* Archive.nvim - Markdown note management with wikilinks
2+
3+
Author: Hisam Fahri <https://github.com/hisamafahri>
4+
License: MIT License
5+
6+
==============================================================================
7+
CONTENTS *archive-contents*
8+
9+
1. Introduction .......................... |archive-introduction|
10+
2. Requirements .......................... |archive-requirements|
11+
3. Installation .......................... |archive-installation|
12+
4. Configuration ......................... |archive-configuration|
13+
5. Commands .............................. |archive-commands|
14+
6. Functions ............................. |archive-functions|
15+
7. Usage ................................. |archive-usage|
16+
8. Troubleshooting ....................... |archive-troubleshooting|
17+
18+
==============================================================================
19+
1. INTRODUCTION *archive-introduction*
20+
21+
Archive.nvim is a Neovim plugin for creating and managing markdown notes with
22+
wikilink support and intelligent autocomplete. Heavily inspired by The Archive
23+
app.
24+
25+
Features:
26+
- Create timestamped markdown notes with unique IDs
27+
- Wikilink autocomplete with nvim-cmp integration
28+
- Navigate between notes using wikilinks ([[Note Title]]) and markdown
29+
syntax links ([text](url))
30+
- Automatic note creation
31+
- Open URLs in default browser
32+
33+
==============================================================================
34+
2. REQUIREMENTS *archive-requirements*
35+
36+
- ripgrep (required for file searching)
37+
- nvim-cmp (optional, for autocomplete)
38+
39+
==============================================================================
40+
3. INSTALLATION *archive-installation*
41+
42+
Using vim-plug: >
43+
Plug 'hisamafahri/archive.nvim'
44+
<
45+
46+
Using dein.vim: >
47+
call dein#add('hisamafahri/archive.nvim')
48+
<
49+
50+
Using packer.nvim: >
51+
use 'hisamafahri/archive.nvim'
52+
<
53+
54+
Using lazy.nvim: >
55+
{
56+
'hisamafahri/archive.nvim',
57+
config = function()
58+
require('archive').setup({
59+
workspace = '~/notes' -- Required: path to your notes directory
60+
})
61+
end
62+
}
63+
<
64+
65+
==============================================================================
66+
4. CONFIGURATION *archive-configuration*
67+
68+
Setup function: *archive.setup()*
69+
70+
require('archive').setup({opts})
71+
72+
Parameters: ~
73+
{opts} (table) Configuration options:
74+
- workspace (string): Required. Path to notes directory.
75+
76+
Basic setup: >
77+
require('archive').setup({
78+
workspace = '~/notes' -- Required: path to your notes directory
79+
})
80+
<
81+
82+
With nvim-cmp integration: >
83+
-- Setup archive.nvim
84+
require('archive').setup({
85+
workspace = '~/notes'
86+
})
87+
88+
-- Add to your nvim-cmp sources
89+
require('cmp').setup({
90+
sources = {
91+
{ name = 'archive_wikilink' },
92+
-- your other sources...
93+
}
94+
})
95+
<
96+
97+
==============================================================================
98+
5. COMMANDS *archive-commands*
99+
100+
:Archive {subcommand} *:Archive*
101+
102+
Available subcommands:
103+
104+
:Archive new *:Archive-new*
105+
Create a new note with user input title.
106+
107+
:Archive go_to_link *:Archive-go_to_link*
108+
Navigate to link under cursor.
109+
110+
==============================================================================
111+
6. FUNCTIONS *archive-functions*
112+
113+
archive.new() *archive.new()*
114+
Creates a new note with user input for the title.
115+
116+
archive.go_to_link() *archive.go_to_link()*
117+
Navigates to the link under the cursor.
118+
119+
archive.get_cmp_source() *archive.get_cmp_source()*
120+
Returns the nvim-cmp completion source for wikilink autocomplete.
121+
122+
archive.setup({opts}) *archive.setup()*
123+
Initializes the plugin with the given configuration options.
124+
See |archive-configuration| for details.
125+
126+
==============================================================================
127+
7. USAGE *archive-usage*
128+
129+
Available Commands: ~
130+
:Archive new - Create a new note with user input title
131+
:Archive go_to_link - Navigate to link under cursor
132+
133+
Keybindings: ~
134+
Add these to your Neovim configuration: >
135+
136+
-- Create new note
137+
vim.keymap.set('n', '<leader>an', ':Archive new<CR>',
138+
{ desc = 'Create new note' })
139+
140+
-- Navigate to link under cursor
141+
vim.keymap.set('n', '<leader>ag', ':Archive go_to_link<CR>',
142+
{ desc = 'Go to link under cursor' })
143+
<
144+
145+
==============================================================================
146+
8. TROUBLESHOOTING *archive-troubleshooting*
147+
148+
No autocomplete suggestions: ~
149+
- Ensure ripgrep is installed and in PATH
150+
- Verify nvim-cmp is configured with archive_wikilink source
151+
- Check workspace path exists and contains .md files
152+
153+
"No link found under cursor": ~
154+
- Position cursor on link text, not brackets
155+
- Verify link syntax is correct
156+
157+
File not found when following wikilinks: ~
158+
- Verify workspace path is correct
159+
- Ensure markdown files exist in workspace
160+
161+
==============================================================================
162+
vim:tw=78:ts=8:ft=help:norl:

0 commit comments

Comments
 (0)