![image](https://github.com/mistricky/codesnap.nvim/assets/22574136/9fc40afc-cff8-4e18-a04f-e931d32a1fb7)
πΈ Snapshot plugin with rich features that can make pretty code snapshots 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](https://github.com/folke/lazy.nvim) for installation, but you can still use another plugin manager you prefer. **Lazy.nvim** ```lua { "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: ```lua { "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` ```lua require("codesnap").setup({ -- ... save_path = ... }) ``` https://github.com/mistricky/codesnap.nvim/assets/22574136/69b27e77-3dce-4bc3-8516-89ce636fe02d ## Breadcrumbs Breadcrumbs are something to display the current snapshot file path, you can open it through config `has_breadcrumbs`: ```lua require("codesnap").setup({ -- ... has_breadcrumbs = true }) ``` The breadcrumbs look like: ![image](https://github.com/mistricky/codesnap.nvim/assets/22574136/23274faa-36a9-4d41-88a5-e48c44b4d5bf) ### Custom path separator The CodeSnap.nvim uses `/` as the separator of the file path by default, of course, you can specify any symbol you prefer as the custom separator: ```lua require("codesnap").setup({ -- ... has_breadcrumbs = true breadcrumbs_separator = "π" }) ``` ![image](https://github.com/mistricky/codesnap.nvim/assets/22574136/84b80d0f-1467-4bdf-9cbd-aede868f93aa) ## Custom background The `CodeSnap.nvim` comes with many beautiful backgrounds preset, you can set any background you like by setting `bg_theme` to its name, just like: ```lua require("codesnap").setup({ -- The "default" background is one you see at the beginning of the README bg_theme = "default" }) ```bamboo | sea |
---|---|
peach | grape |
dusk | summer |