From db54e6c15c7544b800d89efeb042eb76f970a6c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Harnes?= Date: Thu, 9 May 2024 17:33:07 +0200 Subject: [PATCH 1/2] feat: support vimwiki --- lua/img-clip/config.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/img-clip/config.lua b/lua/img-clip/config.lua index 05f1fa0..0b72b66 100644 --- a/lua/img-clip/config.lua +++ b/lua/img-clip/config.lua @@ -51,6 +51,12 @@ local defaults = { download_images = false, ---@type boolean }, + vimwiki = { + url_encode_path = true, ---@type boolean + template = "![$CURSOR]($FILE_PATH)", ---@type string + download_images = false, ---@type boolean + }, + html = { template = '$CURSOR', ---@type string }, From e1680ec5995f2eec02dc8a8ec8f6a8dd96536fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Harnes?= Date: Thu, 9 May 2024 17:35:03 +0200 Subject: [PATCH 2/2] docs: add vimwiki --- README.md | 20 ++++++++++++-------- vimdoc.md | 6 ++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 04e9a05..f94029a 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,6 @@ require("img-clip").paste_image({ use_absolute_path = false, file_name = "image. - ## ⚙️ Configuration ### Setup @@ -127,13 +126,19 @@ The plugin is highly configurable. Please refer to the default configuration bel download_images = false, ---@type boolean }, + vimwiki = { + url_encode_path = true, ---@type boolean + template = "![$CURSOR]($FILE_PATH)", ---@type string + download_images = false, ---@type boolean + }, + html = { template = '$CURSOR', ---@type string }, tex = { relative_template_path = false, ---@type boolean - template = [[ + template = [[ \begin{figure}[h] \centering \includegraphics[width=0.8\textwidth]{$FILE_PATH} @@ -360,7 +365,7 @@ For available placeholders, see the following table and the [demonstration](#dem | `$LABEL` | Figure label, generated from the file name, converted to lower-case and with spaces replaced by dashes. | `the-image` (from `the image.png`) | | `$CURSOR` | Indicates where the cursor will be placed after insertion if `use_cursor_in_template` is true. | | -Templates can also be defined using functions with the above placeholders available as function parameters. +Templates can also be defined using functions with the above placeholders available as function parameters.
Example @@ -372,7 +377,6 @@ end
- ## 🖱️ Drag and drop The drag and drop feature enables users to drag images from the web browser or file explorer into the terminal to automatically embed them, in normal mode. @@ -557,12 +561,12 @@ A list of terminal emulators and their capabilities is given below. > [!WARNING] > MacOS URLs only work in Safari. - + ## 🔌 Integrations ### Telescope.nvim -The plugin can be integrated with [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) to provide a seamless way to select and embed images using Telescope's powerful fuzzy finding capabilities. +The plugin can be integrated with [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) to provide a seamless way to select and embed images using Telescope's powerful fuzzy finding capabilities.
Example configuration @@ -596,8 +600,7 @@ The above function should be bound to a keymap, e.g. through lazy.nvim.
- -### Oil.nvim +### Oil.nvim The plugin also integrates with [oil.nvim](https://github.com/stevearc/oil.nvim), providing a convenient way to browse and select images using Oil's file explorer. @@ -636,6 +639,7 @@ keymaps = { end, } ``` + ## 🙌 Contributing diff --git a/vimdoc.md b/vimdoc.md index 39eb7b0..5a1135f 100644 --- a/vimdoc.md +++ b/vimdoc.md @@ -126,6 +126,12 @@ The plugin is highly configurable. Please refer to the default configuration bel download_images = false, ---@type boolean }, + vimwiki = { + url_encode_path = true, ---@type boolean + template = "![$CURSOR]($FILE_PATH)", ---@type string + download_images = false, ---@type boolean + }, + html = { template = '$CURSOR', ---@type string },