Remap keyboard combinations, not just single registry values - windows

I'm getting real tired of pressing shift every time I want to type $ or #. I've checked out key remapping programs like SharpKeys and a few others, but they don't support the SHIFT+[key] actions. The problem is they modify the registry value for a single key only (I think).
I want to flip over my number keys so when I type 4, it outputs $, similar to a French keyboard. (I tried physically rotating the key so it's upside down, but that's not working).
There must be a solution for this - can you help?

The registry hackers move virtual keys around. What you need is a custom keyboard layout. You can easily create your own with the Microsoft KeyBoard Layout Creator utility.

In addition to the answer from #HansPassant, if you find trouble with the ctrl+KEY functions etc you might need to edit the .klc file manually.
See https://superuser.com/questions/171307/how-can-i-restore-ctrlkey-functionality-in-microsoft-keyboard-layout-creator :
You need to modify the .klc file manually.
Basically you just modify the VK_ column to match the value in
column 1.
So for example if you want to bind L to N, you
would create the keyboard as you normally would in KLC. Then you would
open the KLC file in a text editor. Find the value L in the VK_
column, and switch it to an N.
For more information, I wrote the complete steps on my blog.

Related

Sublime 4/Vintage: repeat key on key down only in edit mode

On my mac, I need to be able to access special characters such as accents for editing purposes and for now I access this by holding a key down and then get the suggestions shortcut.
However, I would like to use the Vim mode in Sublime as well so moving around with h, j, k, l is quite tedious if I can't hold the key down to move faster.
Is there any way to only repeat a key when pressing it down in edit mode, or to have this behaviour only for h, j, k, l?
Thanks
Probably unsurprisingly, the press-and-hold-for-special-characters behavior is a macOS feature. It doesn't seem possible to change the behavior on the fly. You can adjust it per app like this:
defaults write com.sublimetext.4 ApplePressAndHoldEnabled -bool false
So the question becomes: how can you enter special characters in insert mode? In vanilla vim, you could use inoremap to replace, say, Option+l with "ł". However, NeoVintageous (which I hope you're using, not the deprecated Vintage mode) does not support remaps in insert mode. It claims to support digraphs, which would be another way of achieving this. However, the keyboard command to insert a digraph is Ctrl+k, which conflicts with one of the default Sublime Text key bindings on macOS. (The one to kill from the cursor to EOL, which is copied from Emacs and available in standard macOS text fields.) It's presumably possible to work around this, but I felt like Ctrl+k+l+/ was kind of wordy anyway.
Fortunately, there IS a fast, simple solution: a Sublime key remap. Open your user key bindings (Sublime Text > Preferences > Key Bindings) and add this one:
{ "keys": ["option+l"], "command": "insert", "args": {"characters": "ł"} }
Now Option+l will add the l-slash character to your document. If you need the special character this is replacing (the not sign "¬"), you can of course choose another binding.
I presume this is the one you want, since it's the only special character available for me when I press-and-hold any of the hjkl keys. But this approach will work equally well for any other characters you might want to insert.

How to stop using the arrow keys in Visual Studio Code

When I am using letter keys and move to arrow keys it's a waste of my time. For that, I use vim in vscode but problem is that I don't use h,j,k,l, etc letter when type. For example: when I type "j" my cursor down but I don't type the letter "j" ..how can I solve the problem?
you can give a try to touchcursor-linux. It basically provides arrow keys and other button functionalities by making space button work as shift. I think it's really intutive and easy....and you don't have to switch to vim keyboard layout as well.

Standard (no third-party) way to get numeric keypad working as arrow keys on macOS (Xcode? hidutil?)

I always use numeric keypad as arrows, as I find it more convenient than using an separate arrow pad. Until recently I used a tool Karabiner Elements, but it stopped functionning at Big Sur.
Yes, The Karabiner developer is working on that issue, but it will be better to solve it without relying on a third-party tool.
It will be enough for me to either remap Xcode, or (which is preferred) to change key bindings in the system, using a tool like hidutil.
Xcode's Preferences - Key Binding has a section Text - Section. When I try to modify the binding for say Move Down by pressing Down arrow on numeric keypad it comes up as '2'. Now whereever I press '2', on keyboard or numeric keypad, it always works as Move Down which is certainly not what I am after.
About hidutil. I couldn't find a good manual or any example of keyboard mapping.
Any help?
Had another look at this article. Here is the answer:
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x70000005A,"HIDKeyboardModifierMappingDst":0x700000051},
{"HIDKeyboardModifierMappingSrc":0x700000060,"HIDKeyboardModifierMappingDst":0x700000052},
{"HIDKeyboardModifierMappingSrc":0x70000005C,"HIDKeyboardModifierMappingDst":0x700000050},
{"HIDKeyboardModifierMappingSrc":0x70000005E,"HIDKeyboardModifierMappingDst":0x70000004F},
{"HIDKeyboardModifierMappingSrc":0x70000005F,"HIDKeyboardModifierMappingDst":0x70000004A},
{"HIDKeyboardModifierMappingSrc":0x700000061,"HIDKeyboardModifierMappingDst":0x70000004B},
{"HIDKeyboardModifierMappingSrc":0x700000059,"HIDKeyboardModifierMappingDst":0x70000004D},
{"HIDKeyboardModifierMappingSrc":0x70000005B,"HIDKeyboardModifierMappingDst":0x70000004E},
{"HIDKeyboardModifierMappingSrc":0x700000062,"HIDKeyboardModifierMappingDst":0x700000049},
{"HIDKeyboardModifierMappingSrc":0x700000063,"HIDKeyboardModifierMappingDst":0x70000004C}]}'
Still can't fugure out, how to do (if possible) complex mapping with modifier keys (eg Ctrl+PgUp to Home), but that's another topic.

Change meta and control keys in emacs for mac keyboard

There are several things I'd like to do:
leave the left control key as is
map the left command key so it's a meta key
map the right command key so it's a meta key
map the right up arrow so it's a control key
I know the three map commands need to be of the form:
(define-key KEYMAP KEY DEF)
Also I know my .emacs file located in my home directory. However, I'm not sure how to define these three values or if I have the right idea.
One other thing, I installed emacs 24, but I noticed that mac OSX seems to also come with emacs 22. I'd like both to function the same. Is there a way to make sure the key mappings match? Or even better replace emacs 22 with 24 in the terminal?
Emacs has a numbers of mac specific settings, including something similar what you ask for. They are included in the group 'Ns'.
use: M-x customize-group RET ns RET
I'm not really sure if left and right is treated separately. So maybe in addition you might want to install keyremap4macbook. This can do some remapping - even on application specific basis.
Personally I found it usefull to use the fn key as wildcard e.g. I remap left alt to fn and tell emacs to treat fn as meta.
Never figured this out. My solution was to switch out keyboards so now I have my command keys mapped to meta and my alt keys mapped to control.

Using Numpad with Modifier Keys exhibits curious behavior

I have a keyboard event listener, and I am listening for the number pad key codes (1 through 9) for when number lock is activated; this works fine. However, in my app I also want to allow usage of a modifier key (CTRL) along with the number pad keys. The strange thing is that when holding CTRL, pressing 1 or 3 does not generate any keyboard event whatsoever, whereas 2 and 4 - 9 do generate the expected events. I have seen other references to this issue after some Googling, so I do not believe this is necessarily Flash-specific, but I have yet to find any answers.
I tried using SHIFT as a modifier, but that just results in generating the key codes from the number pad as if number lock was off (eg, SHIFT+Numpad1 returns the End keycode, regardless of number lock state) - apparently this is intentional Windows behavior. ALT is not an option with the numpad due to altcodes.
Any ideas on how to get CTRL+Numpad1 and CTRL+Numpad3 to generate the keyboard events? Or any explanation as to why they don't?
Edit: I tried out using these key combinations in Firefox as enriquein suggests below, and all the key combinations work A-OK, leading me to believe that this is likely a Flash-specific issue, or at least not a hardware issue.
I have run into issues in the past with numpad keys on specific keyboards. Various key combinations fail to register on specific keyboards, and it is possible that the keyboard you are using may just not be generating any event in that case. It's not guaranteed to work, but I would recommend trying out a different keyboard (different vendor, etc) and see if that works. It also might be an issue with localized keyboards, if you are using a non-english keyboard.
I'm almost certain it's not Flash related because I had similar problems with a localized keyboard and could not get it to generate events at all for certain keys or key combinations.
Try enumerating all key events and searching trough what they're mapped to, or google evtest.c, compile it and run it and see what it has to say.
Indeed it looks like its keyboard specific. I tried the key combinations as I read this question in Firefox and they triggered the same event as pressing Ctrl+Number (which is switch to tab #Number).
This was using a standard US/101-key english keyboard (no extra media buttons or anything).
Some keyboards don't register certain key combinations. I think that this is down to how they are put together. For example some may register left hand Ctrl + key combination but not right Ctrl + same key!
A work around would be to detect the key down and key up events for the Ctrl key.
You could then raise a custom event for Ctrl + numpad key or work with a volatile flag to show the Ctrl key state.

Resources