Skip to content

Commit

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

![image](https://github.com/mistricky/codesnap.nvim/assets/22574136/c8982b8c-c273-4257-9fef-f0f9134fd9a1)
<p align="center">

<img src="https://img.shields.io/badge/Neovim-57A143?logo=neovim&logoColor=fff&style=for-the-badge" alt="Neovim" />
Expand All @@ -15,50 +14,38 @@
<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] Column number
- 🍞 [WIP] Breadcrumbs
- 🤖 [WIP] Generate snapshot just one command


## Prerequirements
- Neovim 0.9+
- 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.

## 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", version = "^1"},
{ "mistricky/codesnap.nvim", build = "make" },
```

## Usage
`CodeSnap.nvim` provide the following two ways to take snapshot of current selected code

### Copy into clipboard
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 :)

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: ...
})
```
https://github.com/mistricky/codesnap.nvim/assets/22574136/5e1a023e-142f-49e8-b24f-707da3728fd5

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

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

## Configuration
Expand All @@ -70,11 +57,12 @@ require("codesnap").setup({...})
There is a default config:
```lua
{
mac_window_bar = true,
watermark = "CodeSnap.nvim",
title = "CodeSnap.nvim",
code_font_family = "CaskaydiaCove Nerd Font",
watermark_font_family = "Pacifico",
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
}
```

Expand Down

0 comments on commit 4d5ff0f

Please sign in to comment.