Nap: A Handy Code Snippet Manager for Your Terminal
Nap is a user-friendly code snippet manager tailored for terminal enthusiasts. It provides an efficient way to create, store, and organize code snippets, ensuring that users can easily access their frequently used pieces of code whenever needed. Whether through a command-line interface or a text-user interface, Nap simplifies the way users handle their code snippets.
Text-Based User Interface
Nap's interactive, text-based interface can be launched by simply typing the command nap
in the terminal. This interface allows users to manage snippets through intuitive key bindings:
- Create a new snippet: Press
n
- Edit selected snippet: Press
e
- Copy snippet to clipboard: Press
c
- Paste from clipboard: Press
p
- Delete selected snippet: Press
x
- Rename snippet: Press
r
- Organize snippets: Assign them to folders and set their language
Navigating within the interface is straightforward with keys like tab
and shift + tab
to move between panes, while /
enables quick searching of snippets. To exit, users can press q
or ctrl + c
.
Command Line Interface
Nap's functionality shines with its command-line interface, offering commands that fit seamlessly into a developer's workflow:
- Quickly save snippets:
nap < main.go
- Organize snippets: Save snippets into folders and specify the language, for example,
nap Notes/FizzBuzz.go < main.go
- Save remote code: Retrieve and save snippets directly from URLs or GitHub gists
Managing and retrieving saved snippets is also a breeze:
- Fuzzy find snippets:
nap fuzzy
- Export snippets: Output them to files or copy them to the clipboard
- List snippets: Simply run
nap list
Installation
Nap is accessible to users via different methods, notably through package managers on macOS, Arch, and Nix systems, or by using Go with the command:
go install github.com/maaslalani/nap@main
Pre-compiled binaries are also available for those who prefer direct downloads from the releases page.
Customization
Nap allows users to tailor the experience to their liking through a configuration file located at NAP_CONFIG
, usually found at ~/.nap/config.yaml
. This file lets users specify settings such as the home directory, default language, and theme, while also customizing visual aspects like colors.
These settings can be overridden using environment variables, providing additional flexibility in personalization.
Feedback and License
Nap operates under the MIT License, reflecting an open-source philosophy that encourages community involvement and feedback. Users are encouraged to provide their thoughts and improvements through email, Twitter, or GitHub issues, fostering a collaborative environment that powers Nap's continual evolution.
Nap is more than just a snippet manager; it is a comprehensive tool that integrates smoothly into a developer's workflow, offering robust management capabilities, easy customization, and a supportive community for feedback and continual improvement.