• Stars
    star
    1,829
  • Rank 25,381 (Top 0.6 %)
  • Language
    Go
  • Created almost 2 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code snippets in your terminal

Nap

Nap

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.



Text-based User Interface

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

Command Line Interface

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)

Installation

Install with Go:

go install github.com/maaslalani/nap@main

Or download a binary from the releases.

Customization

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"

image

License

MIT

Feedback

I'd love to hear your feedback on improving nap.

Feel free to reach out via:


zzz

More Repositories

1

slides

Terminal based presentation tool
Go
9,675
star
2

invoice

Command line invoice generator
Go
1,832
star
3

gambit

Play chess in your terminal
Go
811
star
4

typer

Typing test in your terminal
Go
472
star
5

draw

Draw in your terminal
Go
460
star
6

confetty

Confetti in your TTY
Go
401
star
7

crow

Run commands when files change.
Go
148
star
8

pom

Pomodoro timer in your terminal
Go
88
star
9

glyphs

Unicode symbols on the command line
Go
83
star
10

_

dotfiles
Nix
45
star
11

notion-todo

Command Line Interface for adding notion todo tasks
Python
36
star
12

cue

Cue cards in your terminal
Go
28
star
13

quote

Generate aesthetic quote images
Elm
23
star
14

Dungeon

A text-based adventure game coded in Java.
Java
21
star
15

maaslalani.github.io

My personal website.
HTML
12
star
16

vangogh

CLI for artistic image manipulation.
Go
12
star
17

twttr

Twitter in the terminal
Go
9
star
18

ntbk

CLI for managing notes
Rust
9
star
19

gitscrape

A tool that allows you to to enter a repository or organization and retrieve information on all contributors, stargazers, and forkers.
JavaScript
8
star
20

JustFocus

Website blocker.
HTML
8
star
21

startup-cli

CLI for startup ideas.
JavaScript
6
star
22

CookieDB

NoSQL-like structured data in the browser.
JavaScript
6
star
23

reminders

CLI for Reminders.app
Rust
6
star
24

vim.world

A collaborative space for VIM users
JavaScript
5
star
25

Pomodoro

A pomodoro timer.
JavaScript
3
star
26

Codev

Coding tutorials for everyone.
HTML
3
star
27

MafiaList

Companies founded by X-Company employees
JavaScript
3
star
28

PicturePerfect

Analyzing social media profiles to discover potential mental illnesses.
Python
3
star
29

awkward.nvim

Evaluate AWK expressions within neovim
Lua
3
star
30

counter

A simple counter.
CSS
3
star
31

scribble

Better writing.
Swift
2
star
32

zmk

Configuration for keyboard
2
star
33

Dorsbon

A computer assistant to improve your posture.
Python
2
star
34

ProjectFolded

Origami as a service.
HTML
2
star
35

Euley

CLI for using projecteuler.net offline.
JavaScript
2
star
36

OffsetList

Companies that have committed to offsetting their carbon emissions.
JavaScript
2
star
37

FounderRewind

Old interviews of famous people, showing their beginnings.
HTML
2
star
38

UnicornFarmer

Cookie Clicker with shopify and unicorns
JavaScript
1
star
39

dotfiles

~
Shell
1
star