nb是一条命令行,本地网络记录,书签,存档和知识库应用程序:
- 纯文本数据存储,
- 加密,
- 过滤,固定,#taging和搜索,
- git支持的版本控制和同步,
- 潘多克支持的转换,
- [[Wiki风格的链接]],
- 终端和GUI网络浏览,
- 内联图像,
- 带任务的戒酒,
- 全球和本地笔记本,
- 带有文件夹的组织
- 可自定义的颜色主题,
- 通过插件的可扩展性,
以及更多,在一个便携式脚本中。
nb以基于文本的格式创建注释,例如Markdown,Org,Latex和Asciidoc,可以使用任何格式的文件,可以将笔记导入和导出许多文档格式,并可以创建由密码保护的私有密码加密注释和书签。使用nb ,您可以使用VIM,Emacs,VS代码,崇高的文本以及您喜欢的任何其他文本编辑器以及终端和GUI Web浏览器编写注释。 nb在任何标准的Linux / UNIX环境中都可以使用,包括MACOS和Windows通过WSL,MSYS和Cygwin。可以安装可选的依赖性以增强功能,但是没有它们, nb效果很好。
nb也是一个有力的书签系统:
- 本地服务,以文本为中心的,无干扰的书签在终端和GUI网络浏览器中浏览,
- 局部对带有正则表达支持的缓存页面内容的全文搜索,
- 方便的过滤和清单,
- Internet存档Wayback Machine快照查找破裂的链接,
- 标记,固定,链接和与其他nb功能完全集成。
页面信息已下载,清理,结构化并保存到针对人类制作的普通标记文档中,因此书签易于查看和编辑,就像其他任何笔记一样。
nb在后台使用git自动记录更改并与远程存储库同步笔记本。 nb还可以使用通用同步实用程序(例如Dropbox)配置为同步笔记本,以便在任何设备上的其他应用程序中都可以编辑注释。
nb设计为便携式,注重未来的且独立的供应商,在高度可容纳的多模式以用户为中心的文本界面中提供了功能丰富且直观的体验。整个程序包含在一个经过良好测试的外壳脚本中,该脚本几乎可以在任何地方安装,复制或卷曲,并且使用受到渐进增强启发的策略,以在功能更强大的环境中进行各种经验改进。 nb无论您有一个笔记本,只有几张笔记还是数十本笔记本,其中包含数千个笔记,书签和其他物品。 nb使得合并其他工具,编写应用程序和工作流程变得容易。 nb可以偶尔使用一点,或者仅用于一部分功能。 nb是灵活的。
nb
安装
依赖性
必需的
- bash
- nb与ZSH,FISH和其他任何其他壳体作为主要登录外壳的完美配合,系统只需要在其上提供bash即可。
- git
- 具有命令行支持的文本编辑器,例如:
- vim,
- emacs,
- 视觉工作室代码,
- 崇高的文字,
- 螺旋,
- 微,
- 纳米,
- 原子,
- 文字人,
- MacDown,
- 其中一些,
- 其中许多。
选修的
nb利用标准命令行工具和在标准Linux / UNIX环境中工作。 nb还检查了一些其他可选工具的环境,并在可用时使用它们来增强体验。
受到推崇的:
- 蝙蝠
- NCAT或SOCAT
- 潘多克
- RG
- 提格
- W3M
还支持各种增强功能:
Ack, afplay, asciidoctor, The Silver Searcher (ag), catimg, Chafa, Chromium / Chrome, eza, ffplay, ImageMagick, glow, GnuPG, highlight, imgcat, joshuto, kitty's icat kitten, lowdown, lsd, Links, Lynx, mdcat, mdless, mdv, Midnight Commander (mc), mpg123, MPlayer, ncat, netcat, note-link-janitor (via plugin), pdftotext, Pygments, Ranger, readability-cli, rga / ripgrep-all, sc-im, socat, termvisage, termpdf.py, Tidy-Viewer (tv), timg, vifm, viu, VisiData
MacOS / Homebrew
brew install xwmx/taps/ nb与自制的nb安装NB还安装了上述建议的依赖项,并为bash,ZSH和FISH安装了填写脚本。
从存储库中安装最新的开发版本:
brew install xwmx/taps/ nb --headnb也可以在Homebrew-Core中使用。建议将其与Bash公式一起安装:
brew install nb bashUbuntu,Windows等
NPM
npm install -g nb .shNPM安装完成后,运行sudo“ $( nb )”完成安装以安装bash和zsh完成脚本(建议)。
在Ubuntu和WSL上,您可以运行sudo“ $( nb )” INV安装以安装可选依赖项。
当nb安装在Windows上时,建议使用Socat(MSYS,Cygwin)。
nb也可在其原始软件包名称Notes.sh下找到,该名称带有额外的笔记可执行包装nb 。
下载并安装
要作为管理员安装,请复制并粘贴以下多行命令之一:
# install using wget
sudo wget https://raw.*git*h*ub.com/xwmx/nb/master/ nb -O /usr/local/bin/ nb &&
sudo chmod +x /usr/local/bin/ nb &&
sudo nb completions install
# install using curl
sudo curl -L https://raw.*git*h*ub.com/xwmx/nb/master/ nb -o /usr/local/bin/ nb &&
sudo chmod +x /usr/local/bin/ nb &&
sudo nb completions install
在Ubuntu和WSL上,您可以运行sudo nb env安装以安装可选依赖项。
仅用户安装
要仅使用用户权限安装,只需将nb脚本添加到您的$路径中即可。例如,如果您已经有一个〜/bin目录,则可以使用以下命令之一:
# download with wget
wget https://raw.*git*h*ub.com/xwmx/nb/master/ nb -O ~ /bin/ nb && chmod +x ~ /bin/ nb
# download with curl
curl -L https://raw.*git*h*ub.com/xwmx/nb/master/ nb -o ~ /bin/ nb && chmod +x ~ /bin/ nb
仅使用用户权限安装不包括可选的依赖项或完成,但是nb Core功能在没有它们的情况下起作用。如果您具有sudo访问并想要安装完成脚本和依赖项,请运行以下命令:
sudo nb env install制作
要使用Make安装,请克隆此存储库,导航到克隆的根目录,然后运行:
sudo make install这还将在所有系统以及Ubuntu和WSL上的建议依赖项上安装完成脚本。
BPKG
使用BPKG安装:
bpkg install xwmx/ nb Basher
与Basher一起安装:
basher install xwmx/ nb 选项卡完成
假设您具有适当的系统权限或使用sudo安装,则应在使用上面的方法安装nb时启用Bash,Fish和ZSH选项卡的完成。如果在安装nb后完成完成,请参见“完成安装说明”。
更新
使用NPM或Homebrew等软件包管理器安装nb时,请使用软件包管理器的升级功能将nb更新为最新版本。通过其他方法安装时,可以使用nb Update子命令将nb更新到最新版本。
概述
要开始,只需运行:
nbnb首次运行时,将设置您的初始笔记本。
默认情况下,笔记本和注释是全局(〜/ nb ),因此无论当前的工作目录如何,NB始终可供nb使用。 nb还支持本地笔记本。
笔记
添加
↑· nb添加, nb浏览添加
使用nb add(快捷方式: nb a, nb +)创建新注释:
# create a new note in your text editor
nb add
# create a new note with the filename "example.md"
nb add example.md
# create a new note containing "This is a note."
nb add " This is a note. "
# create a new note with piped content
echo " Note content. " | nb add
# create a new password-protected, encrypted note titled "Secret Document"
nb add --title " Secret Document " --encrypt
# create a new note in the notebook named "example"
nb example:add " This is a note. "
# create a new note in the folder named "sample"
nb add sample/
nb添加没有参数或输入将打开环境首选文本编辑器中的新的空白说明。您可以使用$编辑器环境变量或nb集编辑器更改编辑器。
nb文件默认情况下是降级文件。默认文件类型可以更改为您喜欢使用nb SET DEFAULT_EXTENSION的任何内容。
nb Add具有明智的论点解析,并且根据其收到的参数类型的方式行为不同。指定带有扩展名的文件名时,编辑器中打开了带有该文件名的新注释:
nb add example.md指定字符串时,立即将其作为内容创建新的注释,而无需打开编辑器:
❯ nb add " This is a note. "
Added: [1] 20200101000000.md
nb添加
当未指定文件名时, nb添加使用当前的DateTime作为文件名。
nb Add还可以接收管道内容,其行为与nb Add
# create a new note containing "Note content."
❯ echo " Note content. " | nb add
Added: [6] 20200101000100.md
# create a new note containing the clipboard contents on macOS
❯ pbpaste | nb add
Added: [7] 20200101000200.md
# create a new note containing the clipboard contents using xclip
❯ xclip -o | nb add
Added: [8] 20200101000300.md
内容可以使用-Content
nb add --content " Note content. "当内容被管道,用-content
标题,文件名和内容也可以用长和简短的选项指定:
❯ nb add --filename " example.md " -t " Example Title " -c " Example content. "
Added: [9] example.md " Example Title "
-t
❯ nb add --title " Example Title " " Example content. "
Added: [10] example_title.md " Example Title "
可以使用-TAGS
❯ nb add " Example content. " --title " Tagged Example " --tags tag1,tag2
Added: [11] tagged_example.md " Tagged Example "
❯ nb show 11 --print
# Tagged Example
# tag1 #tag2
Example content.
使用nb搜索 / nb搜索标记的项目Q:
# search for items tagged with "#tag1"
nb search --tag tag1
# search for items tagged with "#tag1" AND "#tag2", short options
nb q -t tag1 -t tag2
# search for items tagged with "#tag1" OR "#tag2", arguments
nb q # tag1 --or # tag2
可以通过指定文件名(示例.md),扩展名(.md)或通过-Type
# open a new Org file in the editor
nb add example.org
# open a new reStructuredText file in the editor
nb add --type rst
# open a new JavaScript file in the editor
nb add .js
将类型的参数与管道剪贴板内容相结合,提供了一种非常方便的方法,可以使用剪贴板实用程序(例如PBPASTE,XCLIP或PB)保存代码片段:
# save the clipboard contents as a JavaScript file in the current notebook
pb | nb add .js
# save the clipboard contents as a Rust file in the "rust" notebook
# using the shortcut alias ` nb a`
pb | nb a rust: .rs
# save the clipboard contents as a Haskell file named "example.hs" in the
# "snippets" notebook using the shortcut alias ` nb +`
pb | nb + snippets: example.hs
使用nb Show和nb浏览来查看具有自动语法突出显示的代码段,并使用nb编辑在编辑器中打开。
剪辑插件也可用于从剪贴板内容中创建笔记。
管道, - title
❯ pb | nb add " Argument content. "
--title " Sample Title "
--tags tag1,tag2
--content " Option content. "
Added: [12] sample_title.md " Sample Title "
❯ nb show 12 --print
# Sample Title
# tag1 #tag2
Argument content.
Option content.
Clipboard content.
有关nb Add的选项的完整列表,请运行nb帮助添加。
受密码保护的加密笔记和书签
用-e / -encrypt标志创建了受密码保护的注释和书签,并使用openssl默认使用AES-256加密。还支持GPG,可以使用nb Set Encryption_Tool配置。
每个受保护的笔记和书签都用自己的密码单独加密。当查看,编辑或打开加密项目时, nb将在继续之前,只需提示该项目的密码即可。编辑项目后, nb会自动重新加入它并保存新版本。
可以直接使用OPENSL和GPG命令行工具来解密加密的注释,因此您不依赖nb来解密文件。
模板
通过将模板字符串或路径分配给模板文件,以添加-template ::
# create a new note based on a template specified by path
nb add --template /path/to/example/template
# create a new note based on a template defined as a string
nb add --template " {{title}} • {{content}} "
nb模板标签包含在双卷发括号中。支持的标签包括:
- {{标题}}
- 注释标题,如add -title
所指定 - {{tags}}
- 主题标签的列表,如add -tags
, - {{内容}}
- 注释内容,如添加
,add -content 和管道内容。 - {{日期}}
- 系统的日期命令的OUPUT。使用日期命令选项控制格式,例如{{date +“%y-%m-%d”}}。
一个示例完整的降价模板看起来如下:
# {{title}}
{{date +"%Y-%m-%d"}}
{{tags}}
{{content}}
模板是使用eval处理的bash字符串,因此您可以使用命令替换($(echo“示例命令”))来包括命令行工具和壳代码的输出。
可以通过将字符串或路径分配给〜/中的$ nb _default_template变量来配置默认模板。 nb RC文件:
# set the default template to a path
export nb _DEFAULT_TEMPLATE= " /path/to/example/template "
# set the default template with a string
export nb _DEFAULT_TEMPLATE= " {{title}} • {{content}} "
分配一个模板时,请使用nb add-no-template使用模板跳过。
快捷方式别名: nb A, nb +
nb包括许多命令的快捷方式,包括nb A和nb + nb添加:
# create a new note in your text editor
nb a
# create a new note with the filename "example.md"
nb a example.md
# create a new note containing "This is a note."
nb + " This is a note. "
# create a new note containing the clipboard contents with xclip
xclip -o | nb +
# create a new note in the notebook named "example"
nb example:a
其他别名: nb创建, nb新
为了方便起见,也可以使用nb Create和nb New调用nb Add:
# create a new note containing "Example note content."
nb new " Example note content. "
# create a new note with the title "Example Note Title"
nb create --title " Example Note Title "
加上nb浏览
也可以使用nb浏览 / nb BA中的终端和GUI Web浏览器中添加项目:
❯ nb browse add
❯ nb · home : +
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[add]
通过文件名,相对路径和 /或笔记本名称,以在该位置创建新的注释:
# open the add form in the browser to create the file "file.md" in the folder "example"
nb browse add " example/file.md "nb浏览添加包含的选项可以快速预先填充具有内容的新笔记:
❯ nb browse add --title " Example Title " --content " Example content. " --tags tag1,tag2
❯ nb · home : +
[ # Example Title ]
[ ]
[ # tag1 #tag2 ]
[ ]
[Example content. ]
[ ]
[ ]
[ ]
[ ]
[ ]
[add]
nb浏览添加也可以使用nb add -browse / nb a -b打开。
有关更多信息,请参见浏览。
清单和过滤
↑· nb LS, nb列表, nb浏览
要列出笔记和笔记本,请运行nb LS(快捷方式别名: nb ):
笔记本电脑在行上方列出,当前笔记本电脑突出显示和/或下划线,具体取决于终端功能。 nb LS还包括一个带有示例命令的页脚,以便引用。笔记本电脑标题和命令页脚可以使用nb Set标头和nb设置页脚进行配置或隐藏。
❯ nb ls
home
----
[3] example.md · " Example content. "
[2] sample.md · " Sample content. "
[1] demo.md · " - Demo list item one. "
当前笔记本中的注释是按照上次修改的顺序列出的。默认情况下,每个注释都列出了注释第一行的ID,文件名和摘录。当音符具有标题时,显示标题而不是文件名和第一行。
可以使用Markdown H1样式或YAML Front Matter在注释中定义标题:
# Example Title Sample Title
============ ---
title : Demo Title
---.org,.latex和.asciidoc / .adoc文件中识别org,latex和asciidoc标题:
#+title: Example Org Title
title {Example LaTeX Title} = Example AsciiDoc Title定义后,将显示标题代替nb LS输出中的文件名和第一行:
❯ nb ls
home
----
[3] Example Title
[2] Sample Title
[1] Demo Title
传递ID,文件名或标题以查看该注释的清单:
❯ nb ls Sample Title
[2] Sample Title
❯ nb ls 3
[3] Example Title
如果没有确切的匹配, nb将列出具有标题和文件名的项目,这些项目模糊匹配查询:
❯ nb ls exa
[3] Example Title
❯ nb ls ample
[3] Example Title
[2] Sample Title
多个单词的作用为或过滤器,列出了与任何单词匹配的所有标题或文件名:
❯ nb ls example demo
[3] Example Title
[1] Demo Title
当引用多个单词时,该短语的过滤标题和文件名:
❯ nb ls " example title "
[3] Example Title
有关全文搜索,请参见搜索。
要查看注释摘录,请使用-excerpt或-e选项,该选项可选地接受长度:
❯ nb ls 3 --excerpt
[3] Example Title
-----------------
# Example Title
This is an example excerpt.
❯ nb ls 3 -e 8
[3] Example Title
-----------------
# Example Title
This is an example excerpt.
More example content:
- one
- two
用表情符号指标表示几类文件类型,以使其在列表中易于识别。例如,书签和加密注释列出了?和:
❯ nb ls
home
----
[4] Example Note
[3] encrypted-note.md.enc
[2] ? Example Bookmark (example.com)
[1] ? encrypted.bookmark.md.enc
文件类型包括:
Audio
Book
? Bookmark
Encrypted
Folder
? Image
? PDF, Word, or Open Office document
? Video
默认情况下,从最近修改开始列出了项目。要扭转订单,请使用-r或 - 反向标志:
❯ nb ls
home
----
[2] Todos
[3] Example Title
[1] Ideas
❯ nb ls --reverse
[1] Ideas
[3] Example Title
[2] Todos
笔记可以用-s / -sort标志对其进行排序,可以将其与-r / - reverse组合:
❯ nb ls
home
----
[2] Sample Title
[3] Example Title
[1] Demo Title
❯ nb ls --sort
[1] Demo Title
[2] Sample Title
[3] Example Title
❯ nb ls --sort --reverse
[3] Example Title
[2] Sample Title
[1] Demo Title
没有子命令的nb的行为就像是nb LS的别名,因此可以在没有LS的情况下运行上面的示例:
❯ nb
home
----
[2] Sample Title
[3] Example Title
[1] Demo Title
❯ nb example
[3] Example Title
❯ nb 3 --excerpt
[3] Example Title
-----------------
# Example Title
This is an example excerpt.
❯ nb 3 -e 8
[3] Example Title
-----------------
# Example Title
This is an example excerpt.
More example content:
- one
- two
❯ nb --sort
[1] Demo Title
[2] Sample Title
[3] Example Title
❯ nb --sort --reverse
[3] Example Title
[2] Sample Title
[1] Demo Title
简短的选项可以简洁合并:
# equivalent to ` nb --sort --reverse --excerpt 2` and ` nb -s -r -e 2`:
❯ nb -sre 2
[3] Example Title
-----------------
# Example Title
[2] Sample Title
----------------
Sample Title
============
[1] Demo Title
--------------
---
title: Demo Title
nb和nb LS显示了15个最近修改的项目。默认限制可以使用nb集限制<数字>更改。要按命令列出不同数量的项目,请使用-n
❯ nb -n 1
home
----
[5] Example Five
4 omitted. 5 total.
❯ nb --limit 2
home
----
[5] Example Five
[4] Example Four
3 omitted. 5 total.
❯ nb --3
home
----
[5] Example Five
[4] Example Four
[3] Example Three
2 omitted. 5 total.
❯ nb --all
home
----
[5] Example Five
[4] Example Four
[3] Example Three
[2] Example Two
[1] Example One
列表可以用-p <数字> / -page <数字>分页,默认情况下按nb设置限制的值或-n
❯ nb
home
----
[6] Example Six
[5] Example Five
[4] Example Four
[3] Example Three
[2] Example Two
[1] Example One
❯ nb set limit 3
nb _LIMIT set to 3
❯ nb --page 1
[6] Example Six
[5] Example Five
[4] Example Four
❯ nb -p 2
[3] Example Three
[2] Example Two
[1] Example One
❯ nb -p 2 --limit 2
[4] Example Four
[3] Example Three
❯ nb -p 3 --2
[2] Example Two
[1] Example One
列表#Tagged项目通过传递 #escapated或“#Quoted”标签或标签 - 标签选项。多个标签执行和查询:
# list items in the current notebook tagged with "#tag1", escaped
nb # tag1
# list items in the "example" notebook tagged with "#tag2", quoted
nb example: " #tag2 "
# list items in all notebooks tagged with "#tag1", long option
nb # tag1 --all
# list items in the current notebook tagged with "#tag1" AND "#tag2"
nb # tag1 " #tag2 "
# list items in all notebooks tagged with "#tag2" AND "#tag3", short option
nb --tags tag2,tag3 -a
nb LS是一个视图中nb笔记本和nb列表的组合,并且接受与nb列表相同的参数,该参数仅列出没有笔记本列表的笔记,并且默认情况下没有限制:
❯ nb list
[100] Example One Hundred
[99] Example Ninety-Nine
[98] Example Ninety-Eight
... lists all notes ...
[2] Example Two
[1] Example One
有关列出注释选项的更多信息,请运行nb帮助LS和nb帮助列表。
浏览列表
可以使用nb浏览 / nb B在终端和GUI Web浏览器中列出项目:
❯ nb browse example:sample/demo/
❯ nb · example : sample / demo / +
search: [ ]
[example:sample/demo/7] Title Seven
[example:sample/demo/6] Title Six
[example:sample/demo/5] Title Five
[example:sample/demo/4] Title Four
[example:sample/demo/3] Title Three
next ❯
有关更多信息,请参见浏览。
编辑
↑· nb编辑, nb浏览编辑
您可以使用nb Edit(快捷方式: nb E)在编辑器中编辑项目:
# edit note by id
nb edit 3
# edit note by filename
nb edit example.md
# edit note by title
nb edit " A Document Title "
# edit note 12 in the notebook named "example"
nb edit example:12
# edit note 12 in the notebook named "example", alternative
nb example:12 edit
# edit note 12 in the notebook named "example", alternative
nb example:edit 12
可以使用标识符和子命令名称逆转来调用使用标识符的编辑和其他子命令:
# edit note by id
nb 3 editnb Edit也可以接收管道内容,并在未打开编辑器的情况下将其附加到指定的注释上:
echo " Content to append. " | nb edit 1内容可以使用-Content
nb edit 1 --content " Content to append. "使用-OverWrite选项覆盖现有的文件内容和 - 启用选项,以在现有内容之前预先预订新内容。
当内容被管道或用-content
编辑加密注释
在加密注释后, nb编辑会提示您获取Note密码,在编辑器中打开未加密的内容,然后在您完成编辑后自动重新加密注释。
快捷方式别名: nb E
nb编辑可以由快捷方式别名nb e:
# edit note by id
nb e 3
# edit note by filename
nb e example.md
# edit note by title
nb e " A Document Title "
# edit note by id, alternative
nb 3 e
# edit note 12 in the notebook named "example"
nb e example:12
# edit note 12 in the notebook named "example", alternative
nb example:12 e
# edit note 12 in the notebook named "example", alternative
nb example:e 12
对于nb编辑帮助信息,请运行nb帮助编辑。
与浏览编辑
可以使用nb浏览编辑 / nb在终端和GUI Web浏览器中进行编辑项目:
❯ nb browse edit text:formats/markdown/123 ❯ nb · text : formats / markdown / 123 · ↓ · editing · - | + [ # Daring Fireball: Markdown (daringfireball.net) ] [ ] [ < https://**daring*fireball.net/projects/markdown/ > ] [ ] [ # # Related ] [ ] [- < https://en.**wikip*edia.org/wiki/Markdown > ] [ ] [ # # Comments ] [ ] [See also: ] [ ] [- [[text:formats/org]] ] [- [[cli:apps/ nb ]] ] [ ] [ # # Tags ] [ ] [save] · last: 2021-01-01 01:00:00
有关更多信息,请参见浏览编辑和浏览。
观看
↑· nb Show, nb浏览, nb Open, nb Peek
可以使用nb Show(快捷方式: nb S)查看注释和其他项目:
# show note by id
nb show 3
# show note by filename
nb show example.md
# show note by title
nb show " A Document Title "
# show note by id, alternative
nb 3 show
# show note 12 in the notebook named "example"
nb show exa
通过命令行克隆项目: