gnachman / iterm2-website

Website for iTerm2
http://iterm2.com/
GNU General Public License v2.0
81 stars 65 forks source link

Yank from nvim into clipboard #81

Open orifmilod opened 3 years ago

orifmilod commented 3 years ago

I am trying to yank text from nvim but I cannot do it using it2copy. Anyone successful with configuring g:clipboard with it2copy. So I should be able to pipe yanked text into it2copy

My clipboard config:

 let g:clipboard = {
   \   'name': 'it2copy',
   \   'copy': {
   \      '+': ['it2copy'],
   \      '*': ['it2copy'],
   \   },
   \   'paste': {
   \      '+': ['it2copy'],
   \      '*': ['it2copy'],
   \   },
   \   'cache_enabled': 1,
   \ }

I also tried runnig :w !it2copy and it spits out this output, notice that it actually copies the file but in base64 format: Here is the screen shot Screenshot 2021-04-06 at 11 53 46

Here is the text version (

^[]1337;Copy=:c291cmNlIH4vLnZpbS9memYudmltCnNvdXJjZSB+Ly52aW0vY29jLnZpbQpzb3VyY2Ugfi8udmlt
L21hcHBpbmdzLnZpbQpzb3VyY2Ugfi8udmltL3NldHRpbmdzLnZpbQpzb3VyY2Ugfi8udmltL2Nv
bW1lbnQudmltCnNvdXJjZSB+Ly52aW0vZ2l0LnZpbQoiIHNvdXJjZSB+Ly52aW0vcHl0aG9uLnZp
bQpzb3VyY2Ugfi8udmltL2NwcC52aW0Kc291cmNlIH4vLnZpbS9haXJsaW5lLnZpbSAKc291cmNl
IH4vLnZpbS9zdGFydGlmeS52aW0KIApjYWxsIHBsdWcjYmVnaW4oJ34vLnZpbS9wbHVnZ2VkJykK
ICBQbHVnICdwcmVzZXJ2aW0vbmVyZHRyZWUnCiAgUGx1ZyAnbmVvY2xpZGUvY29jLm52aW0nLCB7
J2JyYW5jaCc6ICdyZWxlYXNlJ30KICBQbHVnICdqdW5lZ3Vubi9memYnLCB7ICdkbyc6IHsgLT4g
ZnpmI2luc3RhbGwoKSB9IH0KICBQbHVnICdqdW5lZ3Vubi9memYudmltJwogIFBsdWcgJ3ZpbS1h
aXJsaW5lL3ZpbS1haXJsaW5lJwogIFBsdWcgJ3Zpb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bnN0YWxsJy5zZXR1cCgpIAoKbG9jYWwgc2VydmVycyA9
IHJlcXVpcmUnbHNwaW5zdGFsbCcuaW5zdGFsbGVkX3NlcnZlcnMoKQpmb3IgXywgc2VydmVyIGlu
IHBhaXJzKHNlcnZlcnMpIGRvCiAgcmVxdWlyZSdsc3Bjb25maWcnW3NlcnZlcl0uc2V0dXB7fQpl
bmQKRU9GCnNldCBjbGlwYm9hcmQ9dW5uYW1lZAoKbGV0IGc6Y2xpcGJvYXJkID0gewogIFwgICAn
bmFtZSc6ICdpdDJjb3B5JywKICBcICAgJ2NvcHknOiB7CiAgXCAgICAgICcrJzogWydpdDJjb3B5
J10sCiAgXCAgICAgICcqJzogWydpdDJjb3B5J10sCiAgXCAgIH0sCiAgXCAgICdwYXN0ZSc6IHsK
ICBcICAgICAgJysnOiBbJ2l0MmNvcHknXSwKICBcICAgICAgJyonOiBbJ2l0MmNvcHknXSwKICBc
ICAgfSwKICBcICAgJ2NhY2hlX2VuYWJsZWQnOiAxLAogIFwgfQo=
gnachman commented 3 years ago

Make sure you have access to clipboard enabled here:

image

orifmilod commented 3 years ago

@gnachman I already had checked this box :)

orifmilod commented 3 years ago

@gnachman Any help please, Thanks

gnachman commented 3 years ago

Please file an issue at https://iterm2.com/bugs and include a debug log as described in the new issue template. I'll try to get to it quickly since you've been waiting so long!

4volodin commented 3 years ago

I have the same issue with neovim v0.4.4, Vi(v8.1.1401) is okay. nvim and vi don't have any plugins and settings

gnachman commented 3 years ago

@4volodin Please see my comment from Apr 22

4volodin commented 3 years ago

@4volodin Please see my comment from Apr 22

I created an issue here https://gitlab.com/gnachman/iterm2/-/issues/9816

seraph98 commented 3 years ago

@gnachman Any help please, Thanks

hi, I just found it2copy can work good in vim but not in nvim, so I would like to use vim , althought I have used nvim for a not short time, :), hope some one can fix the bug

gnachman commented 3 years ago

I can't even git it to run the custom copy command, but based on the issue that @4volodin filed it seems like nvim doesn't pass the output from the command through to the terminal emulator. Instead, it escapes it for human consumption. Can someone who can actually get nvim to run the custom copy command file a bug against nvim for this?

wangweixuan commented 1 year ago

Nvim is messing up the output from it2copy instead of sending it directly to terminal. See https://github.com/neovim/neovim/issues/1496.

I managed to redirect the output:

:w !it2copy>$SSH_TTY

Lua config:

vim.g.clipboard = {
    name = 'iTerm2 copy',
    copy = {
        ['+'] = {'bash', '-c', 'it2copy>$SSH_TTY'},
        ['*'] = {'bash', '-c', 'it2copy>$SSH_TTY'}
    },
    paste = {['+'] = 'true', ['*'] = 'true'}
}
AlJohri commented 7 months ago

@wangweixuan solution works for me if I directly SSH into a host. If I am using tmux -CC tmux integration then I get the following error:

** tmux mode started **

Command Menu
----------------------------
esc    Detach cleanly.
  X    Force-quit tmux mode.
  L    Toggle logging.
  C    Run tmux command.
Unrecognized command from tmux. Did your ssh session die? The command was:
Ptmux;]1337;Copy=:dmltLmcubG9hZGVkX25ldHJ3ID0gMQo=�\%extended-output %12 0 : \033[54;69H    \033]112\007\033[2 q\033[5;7H\033[34h\033[?25h
Detached
%exit