terrychou / iVim

A vim port to iOS.
596 stars 35 forks source link

How to copy/paste from/to the system clipboard for other applications #253

Closed JohnWilliston closed 1 year ago

JohnWilliston commented 1 year ago

I feel like I must be missing the obvious, but so far I’ve had zero success trying to copy/paste from/to the system clipboard on my iPad Pro with other applications. I haven’t been able to find anything in the help as to what special register I should use for yank/put or whatever. Could somebody help me out and explain how I might do simple things such as:

  1. Copy text from the iPad Pro notes application and paste it into iVim.
  2. Copy text from some file open in iVim and paste it into the iPad Pro notes application

Thanks in advance!

terrychou commented 1 year ago

You can communicate with the system clipboard via the * or + registers. For example, "*p pastes text from the system clipboard into iVim. "+yy yanks the current line from iVim into the system clipboard. You may receive errors if the clipboard is empty.

JohnWilliston commented 1 year ago

Yeah, when I try to paste using *p I always get “E749: empty buffer”. I copy in the notes app, switch to iVim, hit ‘:’ to invoke the ex command line, then enter the command and it fails. Any suggestions?

terrychou commented 1 year ago

The examples given above are all commands in the Normal mode. See ":h :put" or ":h :yank" for the Ex counterparts.

JohnWilliston commented 1 year ago

Trying it in normal mode gives me “E348: no string under cursor”. I’m glad the instructions you are giving me are exactly what I thought should work. But no matter what I do, it doesn’t seem to work.

JohnWilliston commented 1 year ago

Aha! Finally got it. The viewer I was using for this issue was stripping your leading quote. Thanks for the help!