Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim.exe can disable ctrl+v to paste in conhost, but not in Windows Terminal #11267

Open
kasajian opened this issue Sep 17, 2021 · 5 comments
Open
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Conpty For console issues specifically related to conpty Product-Terminal The new Windows Terminal.
Milestone

Comments

@kasajian
Copy link

I map the Ctrl+V to Paste in Windows Terminal:
{
"command": "paste",
"keys": "ctrl+v"
},
to simulate what I can do in cmd.exe.

However, when I use the command-line version of vim, from cmd.exe, in Normal mode, if I hit "Ctrl+V", it correctly puts it into "Visual mode".
When I'm in cmd.exe outside of vim, just typing at the console, Ctrl+V will paste to the console as it's supposed to.

In Windows Terminal, with the above setting, Ctrl+V works from the console window, but in vim doesn't see the key-combination.

It would be good for Windows Terminal key bindings to only be in effect when it's typed at the console.

@kasajian kasajian added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Sep 17, 2021
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Sep 17, 2021
@elsaco
Copy link

elsaco commented Sep 17, 2021

@kasajian please use "crtl+alt+v" to enter visual mode when using vim and wt.

@WSLUser
Copy link
Contributor

WSLUser commented Sep 17, 2021

WT has a keybindings for both ctrl+shift+v and ctrl+v to paste. The latter is in the user settings so it can be removed easily by anybody having issues with something like using vim. I typically use ctrl+shift+v for muscle memory now to prevent issues with linux apps and works just fine with vim, just be sure you enter edit mode first as it can act alittle weird otherwise.

Agree with elsaco for entering vim visual mode.

@kasajian
Copy link
Author

I appreciate the workarounds. But I think this is something that should be address in Windows Terminal. It can work since it does work in cmd.exe. One possible feature that can be a workaround is to allow mappings to be app specific, or console specific. In this case, the "ctr+v" i could to the console window only. Or alternatively, I could say that for ctrl+v, "exclude it for vim". That way, the user is free to create exclusions as the please.

@kasajian
Copy link
Author

kasajian commented Nov 7, 2021

Does anyone have any thoughts on if this can ever be fixed? It's possible someone may be willing to work on it (maybe me), if there's agreement that this is worth fixing.

The issue to me is that I don't really feel like I, or others, should have to compromise when something very basic works under cmd.exe, but will not work in Windows Terminal. Maybe the solution is within vim. I don't know. But the current response is only talking about what can be done now -- there's no acknowledgment that this is in fact a problem.

Under cmd.exe, Ctrl+V works in the console window to paste text from the clipboard. I don't want to give that up.
But if I were to enable that in Windows Terminal, it takes that over for all apps, including vim. So then in vim, if I type Ctrl+V, Windows Terminal won't actually send that command to vim to do what vim is supposed to do. So effectively, if you map a key in Windows Terminal, no other console app running in Windows Terminal can ever use it.

If cmd.exe can do it -- so should Windows Terminal. One simpler feature is to allow the user map key bindings in Windows Terminal that are "app specific". So I can map Ctrl+V to copy globally, but locally for VIM, I can say "don't use the setting, but use 'default'" which causes Windows Terminal to ignore the default mapping in VIM's case.

@zadjii-msft
Copy link
Member

I suppose in the fullness of time, this is maybe something that could get implemented. If we were being incredibly bold:

  • We could have ConPTY tell the Terminal when QuickEdit was enabled/disabled by a client application
  • We could have context-sensitive keybindings, that only apply in certain scenarios. I'm thinking different that profile-specific keybindings, more like "this is only active in the alt buffer"
  • One of those pieces of context could be "This is only active when in QuickEdit mode".

It would be a lot of work. It's probably not impossible, but I'd reckon it's pretty far down the backlog.

The workarounds today would be limited to:

  • Don't use Ctrl+v as a keybinding, only Ctrl+shift+v. Your muscle memory will have to change a little, but the actions would be consistent.
  • Disable Ctrl+v as a keybinding, and use PowerShell as the shell. PowerShell itself actually listens for ^V itself, and manually pastes when it sees that. The muscle memory would obviously need to change a lot more, for using an entirely new shell.

@zadjii-msft zadjii-msft added Product-Conpty For console issues specifically related to conpty Area-Input Related to input processing (key presses, mouse, etc.) Product-Terminal The new Windows Terminal. labels May 16, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 16, 2022
@zadjii-msft zadjii-msft added this to the Icebox ❄ milestone May 16, 2022
@carlos-zamora carlos-zamora removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Mar 16, 2023
@carlos-zamora carlos-zamora changed the title Useful feature from cmd.exe that's missing in Windows Terminal Vim.exe can disable ctrl+v to paste in conhost, but not in Windows Terminal Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Conpty For console issues specifically related to conpty Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

5 participants