From 2ff1247b2b205a33c9995558ca5d13bbc9a57f9c Mon Sep 17 00:00:00 2001 From: The Mist Date: Tue, 23 Apr 2024 00:18:45 +0800 Subject: [PATCH] [Update] add keymappings examples & add lua version commands --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 571dfa8..efcad16 100644 --- a/README.md +++ b/README.md @@ -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 = { + { "cc", "CodeSnap", mode = "x", desc = "Save selected code snapshot into clipboard" }, + { "cs", "CodeSnapSave", 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 @@ -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 = 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