vscode-default-keys-windows
vscode-default-keys-windows copied to clipboard
Home + End button in macOS
For those us that are using VS Code on macOS with a keyboard that has Home + End keys, the Ctrl+E command that the extension has mapped to workbench.action.quickOpen interferes with the workflow as Ctrl+E in macOS has the same function as the End key in Windows.
I have disabled this shortcut in my setup, though I feel that for developers that use keyboards with an End key it is way too common for the Ctrl+E shortcut to cause such discruption. Perhaps you could add some conditions when it activates, if you feel that the Ctrl+E must be preserved in the extension for the workbench.action.quickOpen.
I would also like to ask you to include the following snippet that maps the Home+End keys to Ctrl+A and Ctrl+E in Terminal respectively. If you decide to keep it out of the extension perhaps you could include it in macOS instructions. The following applies for zsh which is the default Terminal Shell in macOS since Catalina.
If a developer still uses bash on macOS, you could include in the instructions for macOS that the codes for the Home/End keys are \033[H and \033[F respectively as mentioned here
{
"key": "home",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0001"
},
"when": "terminalFocus"
},
{
"key": "end",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0005"
},
"when": "terminalFocus"
}
Regarding the first issue, are you saying that pressing the End key normally moves the cursor to the end of the line, but because of my extension, it instead activates the quick open menu?
Regarding the second issue, what happens in Terminal when my extension is not installed?
Regarding the first issue, it seems that the problem is on my end. No, pressing the End key does not activate the quick open menu. I had a macOS extension (karabiner) that mapped the End key on the keyboard to Ctrl+E, when I deactivated it, the End key behaves as it should with your extension installed, it moves the cursor to the end of line. I apologize for the confusion, there is no issue with the extension.
Regarding the second issue, with or without your extension installed, Home+End key do nothing on VS Code Terminal (I made sure that no other macOS stuff intefer with it). I think it can be nice addition or tip in your macOS instructions.
Regarding the second issue, I would also like to add that Home+End key also do nothing on macOS Terminal, in fact in order to have Home+End key working, one must do the same settings in the macOS Terminal app. Here is a post that describes it.
Thanks for the update and clarifications. I propose to add a Readme section about the second issue; see below. Do you think this would adequately address the issue?
Home and End in Terminal on Mac
On Windows, the Home and End keys move to the start and end of line in a Terminal window. This behavior isn't due to a normal VSCode binding (it probably comes from the underlying GUI library), so this extension doesn't replicate that behavior (since it just copies all normal bindings), and consequently those keys do nothing in the VSCode Terminal window on Mac. In order to bind those keys, you can add to your keybindings.json
file:
{
"key": "home",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0001"
},
"when": "terminalFocus"
},
{
"key": "end",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0005"
},
"when": "terminalFocus"
}
The above assumes you are using zsh
, the default shell. If you are using another shell (such as bash
), the text to send may need adjustment. See Can home and end keys be mapped when using Terminal? for more information.
Yes, I think it would be very helpful, it would certainly have saved me an hour or so 😊
I've just pushed a change to README.md
with the new section. However, testing and publishing an updated extension on the marketplace is a bit of a hassle so I'll wait on that a bit to hopefully include other changes too. I'll leave this issue open until the change is included in a release. Thanks for the report!