Add wl-paste support (#168)

* Add wl-paste support

* Apply stylua

* Update README
This commit is contained in:
Anatolii Kurotych
2022-10-04 10:31:25 +02:00
committed by GitHub
parent 0f53c256da
commit 04a4ecb0de
2 changed files with 8 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ of being able to edit it.
- [0.0 Prerequisites](#00-prerequisites) - [0.0 Prerequisites](#00-prerequisites)
- [0.0.1 Telescope](#001-telescope) - [0.0.1 Telescope](#001-telescope)
- [0.0.2 calendar-vim Plugin (optional)](#002-calendar-vim-plugin-optional) - [0.0.2 calendar-vim Plugin (optional)](#002-calendar-vim-plugin-optional)
- [0.0.3 For pasting images: xclip (optional)](#003-for-pasting-images-xclip-optional) - [0.0.3 For pasting images: xclip (optional), wl-clipboard (optional)](#003-for-pasting-images-xclip-optional-wl-clipboard-optional)
- [0.0.4 For image previews: telescope-media-files.nvim (optional)](#004-for-image-previews-telescope-media-filesnvim-optional) - [0.0.4 For image previews: telescope-media-files.nvim (optional)](#004-for-image-previews-telescope-media-filesnvim-optional)
- [catimg](#catimg) - [catimg](#catimg)
- [viu](#viu) - [viu](#viu)
@@ -164,7 +164,7 @@ See below for installing and using it.
--- ---
#### 0.0.3 For pasting images: xclip (optional) #### 0.0.3 For pasting images: xclip (optional), wl-clipboard (optional)
Telekasten.nvim supports pasting images from the clipboard. Currently, this is implemented for systems that have Telekasten.nvim supports pasting images from the clipboard. Currently, this is implemented for systems that have
the `xclip` utility installed or on macs. the `xclip` utility installed or on macs.
@@ -175,6 +175,8 @@ On Ubuntu/Debian like systems:
sudo apt-get install xclip sudo apt-get install xclip
``` ```
On [Wayland](https://wayland.freedesktop.org/) systems you can install [wl-clipboard](https://github.com/bugaevc/wl-clipboard)
On Macs, you should not install a separate tool. Installing xclip will prevent this feature from working properly. On Macs, you should not install a separate tool. Installing xclip will prevent this feature from working properly.
--- ---

View File

@@ -413,6 +413,10 @@ local function imgFromClipboard()
.. "/" .. "/"
.. filename .. filename
end end
elseif vim.fn.executable("wl-paste") == 1 then
get_paste_command = function(dir, filename)
return "wl-paste -n -t image/png > " .. dir .. "/" .. filename
end
elseif vim.fn.executable("osascript") == 1 then elseif vim.fn.executable("osascript") == 1 then
get_paste_command = function(dir, filename) get_paste_command = function(dir, filename)
return string.format( return string.format(