macvim icon indicating copy to clipboard operation
macvim copied to clipboard

Copy [CMD]+[C] from command/status bar doesn't copy selected characters into the clipboard.

Open markovanderpuil opened this issue 7 years ago • 4 comments

Steps to reproduce:

  1. Start mac vim with empty or no file [mvim]
  2. Press i and type some letters f.i.: Strange Issue
  3. Escape out of insert mode.
  4. Double click on the word Strange to select it.
  5. Press CMD+C (Strange is now in the clipboard)
  6. Search for some random characters [/nothing]
  7. mvim will display in bottom most status/message bar: E486: Pattern not found: nothing
  8. Double click on the word Pattern in the status/error bar at the bottom of the screen.
  9. Press CMD+C (Note that the Edit menu flashes)
  10. Press i for insert mode.
  11. Press CMD+V
  12. Note that mvim pastes "Strange" and not "Pattern"

Expected Behaviour: It should paste Pattern or better yet, if something is selected on the status bar and the Copy command is given to Mac Os x, the selected characters should be copied to the OS clipboard.

markovanderpuil avatar Feb 15 '19 14:02 markovanderpuil

Copying status messages and command-line texts are currently not supported, because Vim itself doesn't really let you do that. It's possible to try to make that work for MacVim but this could be one of those things that is harder than it looks to implement, so probably not in the near term.

ychin avatar Feb 18 '19 10:02 ychin

Actually, I lied. You can copy those texts using modeless selection (:h modeless-selection). I think it should be theoretically possible to get Cmd-C to automatically use modeless-selection's yank when it makes sense but I will need to look into it.

ychin avatar Feb 19 '19 07:02 ychin

Also, just in case it isn't clear, you can press Ctrl-Y (instead of Cmd-C) to copy that selection to system clipboard as it's a modeless selection. This works in all versions of GVim, not just MacVim.

Edit: Ok this isn't true. I misunderstood what this issue is about. This is an odd case where the message showed in command-line actually is covered by modeless selection, but Ctrl-Y doesn't work since it only works in cmdline mode. Using :messages is probably the easiest workaround.

ychin avatar Feb 20 '19 06:02 ychin

As a workaround for :messages one can use :Messages from vim-scriptease.

kiryph avatar Jul 22 '19 19:07 kiryph