microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
107.05k stars 6.32k forks source link

[KBM] Add a global emacs / Vim like short cut #7468

Open shuowpro opened 3 years ago

shuowpro commented 3 years ago

📝 Provide a description of the new feature

What is the expected behavior of the proposed feature? What is the scenario this would be used?

I expect to have a global emacs like shortcut like Mac. which is goes to home of the line, goes to the end of the line. this could be done via shortcut remapping. But some other shortcut like , which is delete the content after the cursor, is hard to accomplished.

Is there any plan to emacs or vim shortcut set or add the command for text editing? Thanks


If you'd like to see this feature implemented, add a 👍 reaction to this post.

crutkas commented 3 years ago

@leuction, pardon my ignorance here as i don't think i've used vim / emacs since college (long time ago) but isn't "delete content after cursor" would be control-delete in Windows which deletes the word after the cursor?

crutkas commented 3 years ago

Can you send me the screenshots on how to do this for Mac? I would love to check this out. @craigloewen-msft showed me a which demo which is far more chord like.

I also think a lot of these are more action based.

shuowpro commented 3 years ago

Hello, @crutkas Thank you for the reply. To be more clear, in Mac OS, in any text editing scenario, these shortcuts would work.

The "delete content after the cursor" more like to be delete the line after the cursor;

Eg.

This is one| line of the code

after I hit the ctrl +k, it should be like

This is one|

You can check this via this link Mac OS X shortcut

Because we don't have "Command" key in windows, I think we may could use CapsLock to replace the "control" key in MacOS. So that the shortcut would be look like:

CapsLock + a
CapsLock + e
CapsLock + k
...

I know a lot of people miss the Mac because of this shortcut. if we provide a easy way to set the shortcut set. We can encourage more and more people to switch back to Windows.

Or we can provide a way to map the key into some command for text editing, just like what the vscode did. Something similar to this:

{
  "key": "ctrl+tab",
  "command": "-workbench.action.openNextRecentlyUsedEditorInGroup"
},
trevoreyre commented 3 years ago

I'm not sure if this is the correct issue, but I was looking for similar functionality in Keyboard Manager, although not emacs specific.

In macOS you can use Option+Delete to delete a word to the left, which is equivalent to Control+Backspace on Windows. But you can also use Command+Delete to delete the entire line to the left of the cursor, or Command+Shift+Delete to delete the line to the right of the cursor (this is similar to @leuction's example above with Control+K). There's currently no way to achieve this with Keyboard Manager that I can find.

I'm currently using AutoHotkey to achieve this functionality by mapping Control+Backspace to Shift+Home Delete, so it's the equivalent of highlighting the line with Shift+Home, then releasing those and pressing the Delete key. There's no way to do this in Keyboard Manager because the shortcut can only be 1+ modifier combined with 1 non-modifier key. It's the only functionality I'm using in AutoHotkey that I can't recreate in Keyboard Manager.

Here's a link to other macOS shortcuts for text editing. https://support.apple.com/en-us/HT201236#text

enricogior commented 3 years ago

Part of this issue is a duplicate of https://github.com/microsoft/PowerToys/issues/3326

sunhs commented 11 months ago

Moving from MacOS, I've been missing its keybindings. On MacOS, I could use <Cmd + some key> to do normal operations like copy paste, and use <Ctrl + come key> to perform Emacs-like text navigation/operation, even outside Emacs. In this situation, both Cmd and Ctrl are frequently used. In comparison, on Windows, most functionalities are bound to Ctrl, leaving Win seldom used (maybe that's only me).

This means, on MacOS, Cmd and Ctrl together could create much more usage than on Windows.

Thanks to PowerToys KBM, I can map <Win+ some key> on Windows to mimic <Cmd + some key> on MacOS. But this is done by, for example, mapping <Win + c> to <Ctrl + c> for copying. And this doesn't make <Ctrl+c> available for other functionalities.

So what I'm asking is, is it possible in KBM to "leave some key as is, and let the application that receives it decides what to do". For example, I would like to map <Win + v> to paste, and leaving <Ctrl + v> unset. When using <Ctrl + v> in Emacs, it works as "scroll down page". I tried None, disable, undefined in KBM, but didn't seem to work the that way.

GitMurf commented 6 months ago

Would this be the same request as a Vim emulator mode for Windows? I could not find one in this repo which was surprising. Thanks!