1
0
Fork 0
📸 Snapshot plugin with rich features that can make pretty code snapshots for Neovim
 
 
 
 
 
 
Go to file
Mist 123e6fb2f2 [Perf] remove dead_code warning from from_value of margin 2024-03-17 14:09:01 +08:00
.cargo [Release] v1.0.0 (#43) 2024-03-17 01:07:12 +08:00
.github/workflows [Release] v1.0.1 2024-03-17 01:55:44 +08:00
assets [Release] v1.0.0 (#43) 2024-03-17 01:07:12 +08:00
doc [Update] files based on generated files by template generator 2024-03-16 18:02:13 +00:00
generator [Perf] remove dead_code warning from from_value of margin 2024-03-17 14:09:01 +08:00
lua [Feat] update apply generator script 2024-03-17 14:09:01 +08:00
plugin [Release] v1.0.0 (#43) 2024-03-17 01:07:12 +08:00
scripts [Feat] update apply generator script 2024-03-17 14:09:01 +08:00
template/doc Initial commit 2024-02-13 14:05:36 +08:00
.gitignore [Release] v1.0.0 (#43) 2024-03-17 01:07:12 +08:00
LICENSE [Add] Create LICENSE 2024-02-21 21:03:43 +08:00
README.md [Update] change the name of video 2024-03-17 12:46:52 +08:00
commitlint.config.js Initial commit 2024-02-13 14:05:36 +08:00
makefile [Feat] update apply generator script 2024-03-17 14:09:01 +08:00
project.toml [Release] v1.0.1 2024-03-17 01:59:37 +08:00
stylua.toml Initial commit 2024-02-13 14:05:36 +08:00

README.md

image

Neovim made with lua release action status release action status

CodeSnap.nvim

📸 Snapshot plugin that can make pretty code snapshots with real-time previews for Neovim

[!WARNING]
v1.0.0 will bring some break changes

  • The CodeSnapPreviewOn command is not supported, if you prefer live-preview, you can pin CodeSnap.nvim version to v0.0.11 to continue using this command.
  • The opacity and preview_title config has been removed from v1.0.0
  • The editor_font_family was renamed to code_font_family

Features

  • 🤩 Beautiful code snap template
  • 😎 Custom watermark and window style
  • 💻 Beautiful Mac-style title bar
  • 🤖 Generate snapshots using only a single command
  • 👏 [WIP] Custom template background
  • 🔢 [WIP] Column number
  • 🍞 [WIP] Breadcrumbs

Prerequirements

  • Neovim 9.0+

Install

Recommend using Lazy.nvim for installation, but you can still use another plugin manager you prefer.

Lazy.nvim

{ "mistricky/codesnap.nvim", build = "make", version = "^1" },

Build manually

Since v0.0.1 was released, the CodeSnap.nvim will cross-compile for the following three targets, then the CodeSnap.nvim will automatically determine which package to use based on your system, you no longer need to have Rust environment if everything goes smoothly.

  • x86_64-unknown-linux-gnu
  • x86_64-apple-darwin
  • aarch64-apple-darwin

If CodeSnap.nvim on your system still not works fine, there are a lot of reasons depending on your system arch or OS version, well you can try to build CodeSnap manually using the following config:

{ "mistricky/codesnap.nvim", build = "make build_generator", version = "^1" },

Usage

CodeSnap.nvim provides the following two ways to take snapshots of currently selected code

Copy into the clipboard

To take a beautiful snapshot use CodeSnap.nvim, you can just use CodeSnap command to generate a snapshot of the current selected code, then the CodeSnap.nvim will write the snapshot into the clipboard, and you can paste it anywhere you want.

https://github.com/mistricky/codesnap.nvim/assets/22574136/99be72db-57d7-4839-91d0-2a9dfb1901ac

Save the snapshot

Of course, you can use CodeSnapSave command to save the snapshot to path where you defined it in config.save_path

require("codesnap").setup({
  -- ...
  save_path: ...
})

https://github.com/mistricky/codesnap.nvim/assets/22574136/69b27e77-3dce-4bc3-8516-89ce636fe02d

Watermark

Watermark is something that makes screenshots more personalized, but if you don't like watermark just set it as empty string to hide it.

require("codesnap").setup({
  -- ...
  watermark: ""
})

Commands

CodeSnap # Take a snapshot of the currently selected code and copy the snapshot into the clipboard

CodeSnapSave # Save the snapshot of the currently selected code and save it on the disk

Configuration

Define your custom config using setup function

require("codesnap").setup({...})

There is a default config:

{
    mac_window_bar = true,
    title = "CodeSnap.nvim",
    code_font_family = "CaskaydiaCove Nerd Font",
    watermark_font_family = "Pacifico",
    watermark = "CodeSnap.nvim",
}

License

MIT.