Skip to content

Conversation

chemio9
Copy link
Contributor

@chemio9 chemio9 commented Aug 30, 2024

Description

Under wayland, vim.fn.system({"wl-copy", "<", "foobar.png"}) would copy literal string < foobar.png.

Solution

wrap it by vim.fn.system("sh", "-c", "wl-copy < " .. filename)

Fixes (no related issues were found)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list relevant details about your configuration

After the change, I could successfully copy the image and paste it elsewhere.

Configuration:

  • Neovim version (nvim --version):
NVIM v0.11.0-dev-672+g3085c9d9da                                                                                                                                         
Build type: Release                                                                                                                                                      
LuaJIT 2.1.1723675123                                                                                                                                                    
Run ":verbose version" for more info  
  • Operating system and version:
$ uname -a
Linux arc 6.10.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 19 Aug 2024 17:02:39 +0000 x86_64 GNU/Linux

Arch Linux x86_64, kernel linux-zen, kitty 0.36.1, Hyprland (wayland)

Checklist

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
    rather simple change, so no comment :)
  • I have made corresponding changes to the documentation
    no documentation change is needed
  • I did read the CODE OF CONDUCT
    and I agree to follow it.

@AlejandroSuero AlejandroSuero merged commit 5a79b22 into AlejandroSuero:main Sep 27, 2024
3 of 10 checks passed
AlejandroSuero added a commit that referenced this pull request Sep 27, 2024
As @chhatbarhiren commented on #18,
redirections don't work with `vim.fn.system`
unless passsed as string using
`{ "sh", "-c", command }`.
@chemio9 chemio9 deleted the fix/wayland_copy branch September 29, 2024 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants