-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Mapping capslock to esc has issues #854
Comments
Interestingly, I don't see the |
Actually, I just noticed even in Windows this usually requires some system changes via the registry or a utility to work correctly - so maybe it wasn't as simple as I hoped :-/ See http://vim.wikia.com/wiki/VimTip75 |
Yeah, Vim does not support caps lock mapping. People generally map it with some sort of broader keymapping program. |
for Mac OS X I personally use Seil + Karabiner or Karabiner-Elements (if you are on Sierra). |
On Linux Gnome desktops, Tweak Tool, under the "Typing" menu, will let you set your cap lock behavior. Setting it to "Make Caps Lock an additional ESC" works well for me. |
Doing
on Linux swaps the Might be a problem with code itself: microsoft/vscode/issues/23991 |
Would probably be good to test with other parts of VSCode that use an ESC key to trigger something. We don't really have anything to do with capslock binding, unfortunately! |
It's definitely an issue with VS Code itself. Going back to 1.10 brings back the expected behavior, so it's something in the 1.11 update that's broken it. |
@areyoureddy In that case, definitely go open up an issue on their repository then. :) |
microsoft/vscode#23991 Already done 👍 |
Issue resolved? Ubuntu 16.04, VS Code 12.2.2 |
@Fr4nks This works for me just well under Linux. |
@Fr4nks solution worked for me to, thank. |
@Fr4nks Thanks! |
@Fr4nks thank you! |
@Fr4nks Thanks! |
I put this in keybinds.json // Place your key bindings in this file to overwrite the defaults
[
{
"key": "capslock",
"command": "extension.vim_escape",
"when": "editorTextFocus && vim.active && !inDebugRepl"
}
] And toggle this in User Settings
Now I can use caps lock as esc in vim insert mode. But |
@Ding-Fan I suggest using some kind of external caps lock to escape rebinding program. I use caps2esc on Arch Linux. |
@Chillee I'm using Karabiner-Elements on macOS now, it's amazing. 😃 |
In case it is of use to anyone, on macOS, I had set capslock to be escape, and it was previously working fine, but after using setting sync to import my settings, I stopped being able to get out of insert mode. It turned out that |
On mac you can also map caps lock natively: https://stackoverflow.com/questions/127591/using-caps-lock-as-esc-in-mac-os-x/40254864#40254864 |
On Fedora 29 I just needed to change an option in the Settings (File > Preference > Settings). Keyboard: Dispatch "keyCode" |
I'm also using caps2esc and it works fine everywhere but in code. Sometimes it works for a couple of minutes, then pressing capslock does not trigger esc anymore. EDIT: Adding |
works on ubuntu |
If anyone's wondering, as I had a problem finding keybindings.json through the vscode UI, it's in And you can find some docs about it in VSCode's Docs |
@seanwarman In vscode you can get to the keyboard shortcuts using: |
For Windows users, after realizing how difficult it would be to implement with VS code settings, I found just changing the registry to be much easier and less finnicky. This same guide shows how to do it with various tools like AHK too. https://vim.fandom.com/wiki/Map_caps_lock_to_escape_in_Windows
Double-clicked that file from explorer, then restarted my computer and it works like a charm. Of course, if you use the CAPS lock outside VS code, this solution isn't for you. |
Win10 I had a similar issue as others by having to 2nd press the cap lock to turn the cap lock back off. So I decided to just map CapLock + CapLock. So a double caps |
ctrl + { Activates the normal; also ctrl + c |
I found a perfect way to map caps lock to ESC on Windows 10 ("keyboard.dispatch": "keyCode" doesn't take effect), and only works in VS Code, has no effect on other programs like games Using AutoHotkey #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 2
#IfWinActive, Visual Studio Code
CapsLock::Escape
ScrollLock::CapsLock |
It works in my Ubuntu! |
How to do changing twice to one? |
Please thumbs-up 👍 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.
What did you do?
Attempted to map the caps lock key to the escape key, via the below in keybindings.json
Note: I also tried via the below, using "capslock" and "", but this had no effect, as it appears from the codebase
<CapsLock>
isn't recognized notation.What did you expect to happen?
This should allow me to exit insert mode via the close-by caplock key.
What happened instead?
It does kinda work via the first form above, however if also toggles caps lock on/off, which makes it impossible to use (as every key press is then a capital after exiting insert mode). Preferably the "vim.insertModeKeyBindings" would work, and recognize the capslock key and intercept it - preventing it from toggling caps-lock.
Technical details:
The text was updated successfully, but these errors were encountered: