Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wl-copy copies literal string < [filename].png #18

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

chenrry666
Copy link
Contributor

@chenrry666 chenrry666 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 }`.
@chenrry666 chenrry666 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