tnotes
纯Markdown文件的AI原生笔记。
tnotes 是一个带有MCP服务器和Neovim/Telescope插件的小型Go CLI。 笔记正常运行 .md 使用YAML frontmatter的文件,而 .tnotes/ 存储导出的搜索索引。
特性
- 带YAML frontmatter的普通Markdown注释
- 基于时间戳的笔记ID
- 对标题和内容进行快速索引搜索
- 自动的
project:和path:笔记创建标签 - 用于AI助手的MCP服务器
- 带望远镜拾取器的Neovim插件
安装
命令行界面
go install github.com/toshism/tnotes@latest尼奥夫
要求:
tnotes在你的$PATHtelescope.nvimplenary.nvim
{
"toshism/tnotes",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim",
},
config = function()
require("tnotes").setup()
end,
}快速启动
# initialize the notes directory (default: ~/tnotes)
tnotes init
# create a note
tnotes add "My first note"
# create a note with tags
tnotes add "Search ideas" --tags search,bleve
# list notes
tnotes list
# search notes
tnotes search "query"
tnotes search --tag meeting
tnotes search --project toshism/tnotes "index rebuild"
# show a note by ID
tnotes show 20260219143022
# rebuild indexes after manual edits
tnotes index所有命令支持 --json.
存储和配置
默认情况下,笔记存储在 ~/tnotes.
您可以按优先级顺序覆盖notes目录:
--dirTNOTES_DIR~/.config/tnotes/config.toml
配置示例:
notes_dir = "~/notes/tnotes"每个笔记目录包含:
- 你的
*.md笔记文件 .tnotes/index.json元数据索引.tnotes/bleve/全文搜索索引
项目标记
当创建笔记时, tnotes 按以下顺序解析项目名称:
.tnotes-project向上行走时发现的文件- git遥控器
origin,标准化为org/repo - 当前目录基名
新笔记会自动获得:
project:path:
您还可以使用以下命令显式设置项目 tnotes add --project .
搜索
tnotes search 搜索索引笔记标题和内容。
示例:
tnotes search "roadmap"
tnotes search --tag meeting
tnotes search --project toshism/tnotes "bleve"
tnotes search --snippet "index"Neovim望远镜选择器还支持提示前缀,如:
tag:meetingproject:toshism/tnotestag:meeting project:toshism/tnotes roadmap
MCP服务器
使用以下命令运行stdio MCP服务器:
tnotes mcp克劳德代码/克劳德桌面配置:
{
"mcpServers": {
"tnotes": {
"command": "tnotes",
"args": ["mcp"]
}
}
}自定义笔记目录:
{
"mcpServers": {
"tnotes": {
"command": "tnotes",
"args": ["mcp", "--dir", "/path/to/notes"]
}
}
}可用的MCP工具:
tnotes_inittnotes_listtnotes_searchtnotes_showtnotes_addtnotes_index
尼奥夫
默认映射:
| 关键 | 行动 |
|---|---|
gf | 跟随 [[wiki links]] 在Markdown中,否则正常 gf |
nn | 创建新笔记 |
ns | 打开主索引笔记选择器 |
nt | 浏览标签 |
用户命令:
:TnotesNew [title]:TnotesRefresh:Telescope tnotes notes:Telescope tnotes notes_all:Telescope tnotes tags:Telescope tnotes search
配置示例:
require("tnotes").setup({
bin = "tnotes",
mappings = {
follow_link = "gf",
new_note = "nn",
search = "ns",
tags = "nt",
},
telescope = {
theme = nil, -- or "dropdown", "ivy", "cursor"
},
})CLI参考
| 命令 | 描述 |
|---|---|
tnotes init | 初始化笔记目录 |
tnotes add | 创建注释 |
tnotes list | 列出注释 |
tnotes show | 打印备注 |
tnotes search [query] | 搜索笔记 |
tnotes index | 重建元数据和搜索索引 |
tnotes mcp | 通过stdio运行MCP服务器 |
许可证
麻省理工学院
