diff options
author | Tim Morgan <tim@timmorgan.org> | 2019-03-15 22:16:57 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-03-16 22:55:24 +0100 |
commit | d8316f2a1b0d7886aabcd0f96e917129b4ae74c8 (patch) | |
tree | 29e07a0bbc881a3bd60037636c423022b3275d50 | |
parent | 5c836d2ef8b6b2a8ad1ea7e4d7e1bf8dd9b1b93d (diff) | |
download | rneovim-d8316f2a1b0d7886aabcd0f96e917129b4ae74c8.tar.gz rneovim-d8316f2a1b0d7886aabcd0f96e917129b4ae74c8.tar.bz2 rneovim-d8316f2a1b0d7886aabcd0f96e917129b4ae74c8.zip |
clipboard: Always copy as plain text in Wayland #9737
`wl-copy` by default tries to determine the mime type of a copied bit of
text. From the [readme](https://github.com/bugaevc/wl-clipboard):
> wl-copy automatically infers the type of the copied content by running
> xdg-mime(1) on it.
So copying a Ruby script from Nvim may store it in the Wayland clipboard
as mime-type `application/x-ruby`.
This is a small reproduction without Nvim:
$ cat test.rb
#!/usr/bin/env ruby
puts 'hello world'
$ cat test.rb | wl-copy
$ wl-paste --list-types
application/x-ruby
This commit fixes that by telling wl-copy that all text copied from
Nvim has the mime type `text/plain`.
$ cat test.rb | wl-copy --type text/plain
$ wl-paste --list-types
text/plain;charset=utf-8
-rw-r--r-- | runtime/autoload/provider/clipboard.vim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 2fb9d74d8d..2b06ee8c48 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -73,9 +73,9 @@ function! provider#clipboard#Executable() abort let s:cache_enabled = 0 return 'pbcopy' elseif exists('$WAYLAND_DISPLAY') && executable('wl-copy') && executable('wl-paste') - let s:copy['+'] = 'wl-copy --foreground' + let s:copy['+'] = 'wl-copy --foreground --type text/plain' let s:paste['+'] = 'wl-paste --no-newline' - let s:copy['*'] = 'wl-copy --foreground --primary' + let s:copy['*'] = 'wl-copy --foreground --primary --type text/plain' let s:paste['*'] = 'wl-paste --no-newline --primary' return 'wl-copy' elseif exists('$DISPLAY') && executable('xclip') |