zzz
Nap is a code snippet manager for your terminal. Create and access new snippets quickly with the command-line interface or browse, manage, and organize them with the text-user interface. Keep your code snippets safe, sound, and well-rested in your terminal.
Launch the interactive interface:
nap
Key Bindings
Action | Key |
---|---|
Create a new snippet | n |
Edit selected snippet (in $EDITOR ) |
e |
Copy selected snippet to clipboard | c |
Paste clipboard to selected snippet | p |
Delete selected snippet | x |
Rename selected snippet | r |
Set folder of selected snippet | f |
Set language of selected snippet | L |
Move to next pane | tab |
Move to previous pane | shift+tab |
Search for snippets | / |
Toggle help | ? |
Quit application | q ctrl+c |
Create new snippets:
# Quick save an untitled snippet.
nap < main.go
# From a file, specify Notes/ folder and Go language.
nap Notes/FizzBuzz.go < main.go
# Save some code from the internet for later.
curl https://example.com/main.go | nap Notes/FizzBuzz.go
# Works great with GitHub gists
gh gist view 4ff8a6472247e6dd2315fd4038926522 | nap
Output saved snippets:
# Fuzzy find snippet.
nap fuzzy
# Write snippet to a file.
nap go/boilerplate > main.go
# Copy snippet to clipboard.
nap foobar | pbcopy
nap foobar | xclip
List snippets:
nap list
Fuzzy find a snippet (with Gum).
nap $(nap list | gum filter)
Install with Go:
go install github.com/maaslalani/nap@main
Or download a binary from the releases.
Nap is customized through a configuration file located at NAP_CONFIG
($XDG_CONFIG_HOME/nap/config.yaml
).
# Configuration
home: ~/.nap
default_language: go
theme: nord
# Colors
background: "0"
foreground: "7"
primary_color: "#AFBEE1"
primary_color_subdued: "#64708D"
green: "#527251"
bright_green: "#BCE1AF"
bright_red: "#E49393"
red: "#A46060"
black: "#373B41"
gray: "240"
white: "#FFFFFF"
The configuration file can be overridden through environment variables:
# Configuration
export NAP_CONFIG="~/.nap/config.yaml"
export NAP_HOME="~/.nap"
export NAP_DEFAULT_LANGUAGE="go"
export NAP_THEME="nord"
# Colors
export NAP_PRIMARY_COLOR="#AFBEE1"
export NAP_RED="#A46060"
export NAP_GREEN="#527251"
export NAP_FOREGROUND="7"
export NAP_BACKGROUND="0"
export NAP_BLACK="#373B41"
export NAP_GRAY="240"
export NAP_WHITE="#FFFFFF"
I'd love to hear your feedback on improving nap
.
Feel free to reach out via:
zzz