Comments (7)
Numpad support is still a thing - I realize I can type numbers with it. The issue is titled "Numeric keypad bindings no longer work" (as I imagine they once did in that tutorial post). I'm not saying I can't type numbers on the keypad. I'm saying I can't bind functions to the num keypad without remapping all numbers on the keyboard (and we all still need to type numbers)
If you use the Keybinding Resolver, while pressing one of the numpad keys, you will see that these keys are being registered as numpad0
, numpad1
, and so on. Therefore, you should be able to map to these keys specifically.
from atom-keymap.
This is not something new; the issue you're referring to (#42) was closed over 3 years ago when #44 was merged. If you're seeing a recent regression somehow, please let us know and re-open this issue and provide the necessary level of detail needed to reproduce the regression.
Numpad support is still a thing, but only when used as a numeric keypad; we support Num Lock.
Given the reasons this was removed (see original issues), and the fact we do support the numpad when it is actually a numeric keypad, I'm going to close this issue. If someone wants to work on PR for making the proposed opt-in support for "non-numpad numpad", feel free to do so 🙇♂️
from atom-keymap.
Whether numlock is on or off, numpad keys return different scan codes and all programming editors I've used before allow them to be mapped uniquely. Even Atom used to do so. I realize #42 is quite old, but I am a new user to Atom and was surprised to find numpad keys un-configurable, especially after reading an internet tutorial on how to configure them in Atom (https://blog.wislon.io/posts/2014/07/14/atom-editor-bind-number-keypad). I was suggesting perhaps the feature be re-introduced in a way that wouldn't trip up anyone who expects numlock to be forever locked in the 'on' position.
Numpad support is still a thing - I realize I can type numbers with it. The issue is titled "Numeric keypad bindings no longer work" (as I imagine they once did in that tutorial post). I'm not saying I can't type numbers on the keypad. I'm saying I can't bind functions to the num keypad without remapping all numbers on the keyboard (and we all still need to type numbers)
from atom-keymap.
I see. This appears to work for 0-9. When numlock is active, the keybinding resolver reports numpad0 through numpad9. With numlock inactive I get up/down/left/right/etc... So with numlock active I can uniquely identify numpad number keys, and with numlock inactive they are ambiguous with up/down/left/right/etc.
That might be workable for me (though not ideal, as I use all other applications with numlock off). However, whether numlock is on or off, the numkeys for slash/star/minus/plus/enter are ambiguous with their non-numpad counterparts according to the keybinding resolver. Also, num-delete is ambiguous with period with numlock on, and ambiguous with delete with numlock off.
I apologize for not being more thorough in my original post. Num-star is the first key I rebind in any editor (to 'undo' - a BRIEF-ism) and this was the source of my numpad issues in Atom. In particular, num-star, num-plus, num-minus, and num-insert are of high importance to me as BRIEF keys.
The tutorial at https://blog.wislon.io/posts/2014/07/14/atom-editor-bind-number-keypad looks like exactly what I'm looking for. I wish this capability were still accessible, but I respect that an editor can't always be everything to every one. I would be a grateful user if it could be replaced somehow.
from atom-keymap.
@eric-777 You can assign a custom keystroke resolver in your Atom init script to customize how Atom maps a given DOM keyboard event to a keystroke string.
There is probably some state in the event you could use to treat the numeric keypad keys specially. Logging the events to the console should give you a quick idea of whether what you're after is possible via DOM APIs.
from atom-keymap.
You can check the location of the event
To your init scipt:
atom.keymaps.addKeystrokeResolver ({event}) ->
if event.location is 3
return add-my-resolver-here
from atom-keymap.
@nathansobo Thankyou!!!!! I followed that link, researched how to add a keystroke resolver to init.coffee, and I have exactly what I'm looking for now. All numpad keys are now uniquely configurable, and behave identically whether numlock is on or off. I didn't realize you could hook the input any lower than the keymap.cson file.
In case anyone else is looking for the same thing, I've added the following to my init.coffee:
atom.keymaps.addKeystrokeResolver ({event}) ->
if event.type is 'keyup' or event.code[0] isnt 'N'
return ""
if event.code is "Numpad0"
return "num_0"
if event.code is "Numpad1"
return "num_1"
if event.code is "Numpad2"
return "num_2"
if event.code is "Numpad3"
return "num_3"
if event.code is "Numpad4"
return "num_4"
if event.code is "Numpad5"
return "num_5"
if event.code is "Numpad6"
return "num_6"
if event.code is "Numpad7"
return "num_7"
if event.code is "Numpad8"
return "num_8"
if event.code is "Numpad9"
return "num_9"
if event.code is "NumpadDivide"
return "num_slash"
if event.code is "NumpadMultiply"
return "num_star"
if event.code is "NumpadSubtract"
return "num_minus"
if event.code is "NumpadAdd"
return "num_plus"
if event.code is "NumpadEnter"
return "num_enter"
if event.code is "NumpadDecimal"
return "num_delete"
The event.code parameter was sufficient for distinguishing numpad keys from non-numpad keys. If this function returns a non-empty string, that string is preferentially used to index the keymap. I'm sure that's oversimplified, it's just my current understanding.
from atom-keymap.
Related Issues (20)
- Partial key mapping can get wrongly resolved HOT 1
- Some keybindings do not work using Greek keyboard on Linux HOT 17
- Uncaught TypeError: Cannot read property 'unmodified' of undefined (possible Mode_switch issue) HOT 2
- Polish letters - not work HOT 1
- Cmd+backslash isn't working yet in JIS keyboard on Mac. HOT 5
- Won't install on Windows HOT 5
- [windows] AltGr-characters collide with Ctrl+Alt hotkeys HOT 3
- On Linux, keymap does not work with Chinese input source enabled
- Question: Allowing simple keymaps to bubble up to native event as well. HOT 7
- Caps lock interferes with keybindings
- Keymap: Missing key binding for rendering Python graph with matplotlib in Atom HOT 1
- Don't use KeyboardEvent.code when resolving user keystrokes HOT 6
- Slovak QWERTZ does not resolve keys correctly on macOS HOT 16
- Support DVORAK-QWERTY custom keyboards in macOS HOT 2
- `npm install` reports numerous warnings
- Multiple modifiers are not recognized correctly with non-latin characters due to uppercase checking HOT 8
- it keymap error HOT 2
- Multiple command actions in key map
- Atom confused by non-default keyboard layout and hijacks system keybinding
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-keymap.