33

I use WSL Ubuntu and Vim inside the new Windows Terminal, but if I have to enter the visual-block mode with C-v, I can't since it acts as paste.

I am okay with rebinding it to something else but I don't happen to have found the command that I have to add to .vimrc, I think it has something to do with inoremap.

Any advice?

Manik
  • 573
  • 1
  • 9
  • 28
lnk3
  • 513
  • 1
  • 4
  • 6

4 Answers4

51

CTRL+v is bound to paste in Windows Terminal by default. As of now, the only thing that's working is to disable that behaviour in the settings.json. You can do that by pressing CTRL+SHIFT+,.

From version 1.4

  "actions": [
    ...
    // { "command": {"action": "paste", ...}, "keys": "ctrl+v" }, <------ THIS LINE

Pre version 1.4

  "keybindings": [
    ...
    // { "command": "paste", "keys": "ctrl+v" }, <------ THIS LINE

After doing this, you can switch to visual block mode as usual and paste with CTRL+SHIFT+v.

I've found these issues on the project's GitHub about this problem:

https://github.com/microsoft/terminal/issues/5790

https://github.com/microsoft/terminal/issues/5641

Info about the keybindings/actions change: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions

As of Windows Terminal version 1.4, the keybindings array has been renamed to actions inside the settings.json file. Support for the keybindings array still exists for backward compatibility, however the terminal will not automatically rename keybindings to actions inside your settings.json file.

Andras Hegedus
  • 740
  • 6
  • 13
5

You can just change the default "settings.json"

Orignal :

{
    "command": 
    {
        "action": "copy",
        "singleLine": false
    },
    "keys": "ctrl+c" 
},
{
    "command": "paste",
    "keys": "ctrl+v"
},

Modified :

{
    "command": 
    {
        "action": "copy",
        "singleLine": false
    },
    "keys": "ctrl+shift+c"
},
{
    "command": "paste",
    "keys": "ctrl+shift+v"
},
kalopseeia
  • 73
  • 2
  • 7
  • works for me. If you do not want the `ctrl-c` and `Ctrl-v` behavior, you can also delete these two. – jdhao Sep 01 '22 at 09:24
  • settings.json is in `%LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState` by the way. – user2023370 Jun 22 '23 at 13:24
3

try Ctrl-q in VISUAL BLOCK mode.

0

ctrl+v is also important for ":g/pattern/norm". You don't need to change settings.json in order to delete the "ctrl+v" binding, now you can also click on "Actions", scroll to the "paste" binding and delete it (shift+insert will still be available)

uriya
  • 1