oni icon indicating copy to clipboard operation
oni copied to clipboard

ctrl+v doesn't work

Open SpaceWhite opened this issue 8 years ago • 11 comments

How to reproduce

  1. Copy some text to clipboard
  2. open terminal / browser in oni
  3. Paste copied text to terminal / browser with ctrl+v or ctrl+shift+v

oni 0.32, linux mint

SpaceWhite avatar Apr 12 '18 09:04 SpaceWhite

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

oni-bot avatar Apr 12 '18 09:04 oni-bot

In Vim (and thus in Neovim and Oni), Ctrl+v is column-selection. Pasting is done using p or P. Do you have some special configs to change this behaviour?

BTW, I like setting set clipboard+=unnamedplus in my init.vim to make Vim use the clipboard.

TalAmuyal avatar Apr 12 '18 18:04 TalAmuyal

Yes, the vim way should be:

Visual mode: "+p or "*p Insert mode: <C-r>+ or <C-r>*

I don't think we should have a C-v mapping.

@SpaceWhite's issue is a bit different though, it's copying, in this case you select the text in visual mode and use "*y or "+y.

In Linux * is the X selection clipboard and + is the normal clipboard. Not sure of other OSs.

badosu avatar Apr 12 '18 19:04 badosu

Not sure if this is related to Oni though, seems like an issue using the normal clipboard.

If your terminal is gnome-terminal use Ctrl-Shift-v to paste from the clipboard.

Let us know if you find an issue with Oni and we'll reopen the issue.

badosu avatar Apr 12 '18 19:04 badosu

Actually, we do already have this by default in Oni so it should work.

The bindings are as follows (and a mac version that I've left out):

if (config.getValue("editor.clipboard.enabled")) {
    input.bind("<c-c>", "editor.clipboard.yank", isVisualMode)
    input.bind("<c-v>", "editor.clipboard.paste", isInsertOrCommandMode)
}

So c-v should work in both Insert mode and in the command line, which it apparently is not. That said, we could be having an issue with interfacing with the system clipboard on Linux or possibly Mint specifically. I'll test it out on my Arch/Ubuntu VMs and see how they fair.

EDIT: I'm not able to reproduce this on Ubuntu at least, so it may not be a linux issue. It could be related to either your keyboard (though its unlikely since its only c-v), or as said before a clipboard issue.

CrossR avatar Apr 12 '18 19:04 CrossR

@CrossR Were you able to reproduce the issue?

badosu avatar Apr 12 '18 19:04 badosu

@badosu Actually oni has paste from clipboard feature that can be triggered with ctrl+v key. Although this only works in editor mode, not in terminal mode and browser mode. It would be great if there is ctrl+v mode too in terminal and browser mode.

SpaceWhite avatar Apr 13 '18 00:04 SpaceWhite

@CrossR I think ctrl+v key binding only works in vim insert mode. As @TalAmuyal mentioned ctrl+v in normal mode is column selection. But in browser and terminal, one can't use insert mode. Probably that's why the paste from clipboard didn't work.

SpaceWhite avatar Apr 13 '18 00:04 SpaceWhite

But in browser and terminal, one can't use insert mode. Probably that's why the paste from clipboard didn't work.

Whoops, I somehow mentally corrected that to the command line, not the terminal. Yep, I can reproduce this now.

The paste is gated with this check:

    const isInsertOrCommandMode = () =>
        editors.activeEditor.mode === "insert" || editors.activeEditor.mode === "cmdline_normal"

I guess the terminal isn't working since the mode never swaps to insert and its not the cmdline....That could be a bit more awkward to fix though.

Browser should be a bit easier at least, and I think is a bug? (Or more likely just wasn't added yet!)

CrossR avatar Apr 13 '18 00:04 CrossR

Oh, I got it now. I never used the terminal functionality, sorry about that. I thought you were having issues pasting to a different application.

badosu avatar Apr 13 '18 01:04 badosu

You can append your init.vim with runtime mswin.vim, and you can copy/paste contents by ctrl+c/v

scienceasdf avatar Apr 15 '18 12:04 scienceasdf