Skip to content

Commit

Permalink
feat: support vimwiki (#68)
Browse files Browse the repository at this point in the history
* feat: support vimwiki

* docs: add vimwiki
  • Loading branch information
HakonHarnes authored May 9, 2024
1 parent 2c2b72a commit 3ece6aa
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ require("img-clip").paste_image({ use_absolute_path = false, file_name = "image.

</details>


## ⚙️ Configuration

### Setup
Expand Down Expand Up @@ -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 = '<img src="$FILE_PATH" alt="$CURSOR">', ---@type string
},

tex = {
relative_template_path = false, ---@type boolean
template = [[
template = [[
\begin{figure}[h]
\centering
\includegraphics[width=0.8\textwidth]{$FILE_PATH}
Expand Down Expand Up @@ -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.

<details> <summary>Example</summary>

Expand All @@ -372,7 +377,6 @@ end

</details>


## 🖱️ 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.
Expand Down Expand Up @@ -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.

<details> <summary>Example configuration</summary>

Expand Down Expand Up @@ -596,8 +600,7 @@ The above function should be bound to a keymap, e.g. through lazy.nvim.

</details>


### 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.

Expand Down Expand Up @@ -636,6 +639,7 @@ keymaps = {
end,
}
```

</details>

## 🙌 Contributing
Expand Down
6 changes: 6 additions & 0 deletions lua/img-clip/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<img src="$FILE_PATH" alt="$CURSOR">', ---@type string
},
Expand Down
6 changes: 6 additions & 0 deletions vimdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<img src="$FILE_PATH" alt="$CURSOR">', ---@type string
},
Expand Down

0 comments on commit 3ece6aa

Please sign in to comment.