Skip to content

Commit

Permalink
[Update] README
Browse files Browse the repository at this point in the history
  • Loading branch information
mistricky committed Mar 14, 2024
1 parent 2c41654 commit fc730bb
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
![image](https://github.com/mistricky/codesnap.nvim/assets/22574136/c8982b8c-c273-4257-9fef-f0f9134fd9a1)
![image](https://github.com/mistricky/codesnap.nvim/assets/22574136/6e54fea2-4d88-45df-9a7b-1d90a4bb0ea7)

<p align="center">

<img src="https://img.shields.io/badge/Neovim-57A143?logo=neovim&logoColor=fff&style=for-the-badge" alt="Neovim" />
Expand All @@ -14,38 +15,50 @@
<h1 align="center">CodeSnap.nvim</h1>
<p align="center">📸 Snapshot plugin that can make pretty code snapshots with real-time previews for Neovim</p>

> [!NOTE]
> This plugin is currently in its early stages and may have some bugs, please feel free to submit issues and PRs.
## ✨Features
- 🔥 Real-time preview
- 🤩 Beautiful code snap template
- 😎 Custom watermark and window style
- 💻 Mac style title bar
- 🤖 Generate snapshot just one command
- 👏 [WIP] Custom template background
- 🤖 [WIP] Generate snapshot just one command
- 🔢 [WIP] Column number
- 🍞 [WIP] Breadcrumbs


## Prerequirements
- Rust environment required for compiling codesnap.nvim plugin server source code, visit [Install Rust](https://www.rust-lang.org/tools/install) for more detail.
- NPM required for build preview source code, visit [Install Nodejs](https://nodejs.org/en) for more detail.
- Neovim 9.0+

## Install
Recommend using [Lazy.nvim](https://github.com/folke/lazy.nvim) for installation, but you can still use other plugin manager you prefer to install it.

**Lazy.nvim**
```lua
{ "mistricky/codesnap.nvim", build = "make" },
{ "mistricky/codesnap.nvim", build = "make"},
```

## Usage
For take a screenshot, the `codesnap.nvim` provides a command named `CodeSnapPreviewOn` to open the preview page, and then you can switch to visual mode and select code you want, and finally just click the copy button on the preview page, that's all :)
`CodeSnap.nvim` provide the following two ways to take snapshot of current selected code

### Copy into clipboard

https://github.com/mistricky/codesnap.nvim/assets/22574136/5e1a023e-142f-49e8-b24f-707da3728fd5
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 clipboard, and you can paste it anywhere you want.

### 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: ...
})
```

## Commands
```shell
CodeSnapPreviewOn # Open preview page
CodeSnap # Take snapshot of current selected code and copy the snapshot into clipboard

-- The following commands are planned but not implemented yet. (welcome PR :))
CodeSnap # Take a code snap and copy it into the clipboard
CodeSnapSave # Save the snapshot of current selected code and save it on disk
```

## Configuration
Expand All @@ -57,12 +70,11 @@ require("codesnap").setup({...})
There is a default config:
```lua
{
mac_window_bar = true,-- (Optional) MacOS style title bar switch
opacity = true, -- (Optional) The code snap has some opacity by default, set it to false for 100% opacity
watermark = "CodeSnap.nvim", -- (Optional) you can custom your own watermark, but if you don't like it, just set it to ""
preview_title = "CodeSnap.nvim", -- (Optional) preview page title
editor_font_family = "CaskaydiaCove Nerd Font", -- (Optional) preview code font family
watermark_font_family = "Pacifico", -- (Optional) watermark font family
mac_window_bar = true,
watermark = "CodeSnap.nvim",
title = "CodeSnap.nvim",
code_font_family = "CaskaydiaCove Nerd Font",
watermark_font_family = "Pacifico",
}
```

Expand Down

0 comments on commit fc730bb

Please sign in to comment.