Copy / paste in jupyterlab terminal

Currently in terminals I can paste using Ctrl-V, but in order to copy I need to use Shift-RightClick and choose the Copy menu item. I would like to be able to either Shift-Ctrl-C or if possible use Ctrl-C and have it do a Copy if text is selected or do an interrupt otherwise. I’ve read this discussion on github, particularly https://github.com/jupyterlab/jupyterlab/issues/1146#issuecomment-426436903 . But it is not clear to me how to incorporate that into my jupyterlab.

I tried to change the settings for Shift-Ctrl-C as per https://jupyterlab.readthedocs.io/en/stable/user/terminal.html
by putting this in my Settings Keyboard Shortcuts:

    { "shortcuts": [
    {
            "command": "apputils:activate-command-palette",
            "keys": [
                "Accel Shift Z"
            ],
            "selector": "body"
        }
    ]
}

but that didn’t work (the command palette still opens with Shift Ctrl C). Can someone explain how to make Ctrl-C or Shift Ctrl-C copy to the clipboard in a jupyterlab terminal?

Thanks,

Matt

What operating system and browser are you using? The copy/paste keyboard shortcuts seem to depend on your OS.

For me CMD-c/CMD-v works on OS X, on Linux I need to use something like CTRL-ins/SHIFT-ins

1 Like

Use the disabled flag to remove a shortcut:

    { "shortcuts": [
    {
            "command": "apputils:activate-command-palette",
            "keys": [
                "Accel Shift Z"
            ],
            "selector": "body",
            "disabled": true
        }
    ]
}
1 Like

Thanks @jasongrout that disabled the command palette. However, Shift-Ctrl-C now opens the web-dev-tools inspector. I am running Chrome in Windows, the jupyterlab terminal is running in Ubuntu if that matters.

Does anyone know how to get past Chrome stealing the shortcut?

My guess is that Chrome’s behavior is the default behavior, activated because nothing else is attached to that keybinding and preventing the Chrome default. I don’t think Chrome is stealing the shortcut.

I’m not sure how to help you beyond what is in the docs, that the shortcuts for the terminal appear to depend on the host OS.

Do you have any idea how to incorporate the customization of xterm.js hinted at in this issue:

That would let the terminal use Ctrl-C.

You probably don’t want to switch browsers but Firefox works with Ctrl+C / Ctrl+V in Windows and Linux for me.

1 Like