Skip to content

Commit

Permalink
[Update] add keymappings examples & add lua version commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mistricky authored Apr 22, 2024
1 parent ac73f9e commit 2ff1247
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ sudo dnf install libuv libuv-devel # On RHEL based systems
sudo apt-get install libtool libuv1-dev # On Debian based systems
```

### Keymappings
If you use `Lazy.nvim` as your package manager, here are some examples show you how to configure keymappings for CodeSnap:
```lua
{
"mistricky/codesnap.nvim",
build = "make build_generator",
keys = {
{ "<leader>cc", "<cmd>CodeSnap<cr>", mode = "x", desc = "Save selected code snapshot into clipboard" },
{ "<leader>cs", "<cmd>CodeSnapSave<cr>", mode = "x", desc = "Save selected code snapshot in ~/Pictures" },
},
opts = {
save_path = "~/Pictures",
has_breadcrumbs = true,
bg_theme = "bamboo",
},
}
```

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

Expand Down Expand Up @@ -236,6 +254,16 @@ CodeSnap # Take a snapshot of the currently selected code and copy the snapshot

CodeSnapSave # Save the snapshot of the currently selected code and save it on the disk
```
**Lua**
```lua
local codesnap <const> = require("codesnap")

-- Take a snapshot of the currently selected code and copy the snapshot into the clipboard
codesnap.copy_into_clipboard()

-- Save the snapshot of the currently selected code and save it on the disk
codesnap.save_snapshot()
```

## Configuration
Define your custom config using `setup` function
Expand Down

0 comments on commit 2ff1247

Please sign in to comment.