1

I use GoSublime inside sublime text for Golang development. Pressing Ctrl + B gives me the build pane, then I need to type a command e.g., go run main.go and press Enter. When I want to execute a command using numpad Enter it doesn't work. How to make it work with numpad Enter too?

I checked the default keymap in sublime text it provides only the following key bindings for build tool

    { "keys": ["f7"], "command": "build" },
    { "keys": ["ctrl+b"], "command": "build" },
    { "keys": ["ctrl+shift+b"], "command": "build", "args": {"select": true} },
    { "keys": ["ctrl+break"], "command": "exec", "args": {"kill": true} },

Thank You!

MattDMo
  • 100,794
  • 21
  • 241
  • 231
Cute Tom
  • 111
  • 3
  • 9

1 Answers1

3

The only suggestion I can give is to try using numpad_enter both with NumLock on and off, and see if it makes a difference. I'm running OS X and using the standard wired Apple keyboard with a numpad, and I'm also running Linux in a virtual machine. When I open up the console (Ctrl`) and run the command

sublime.log_input(True)

then refocus the file I'm working on, pressing Return (the Enter equivalent on the main keyboard) yields

key evt: enter

in the console, whereas hitting Enter on the keypad yields

key evt: keypad_enter

This behavior does not change in OS X or Linux (I haven't tried in my Windows VM yet) regardless of how NumLock is set. If you're on Windows or Linux with a Windows keyboard, it may change, but I doubt it.


The reason Sublime does this is because numpad_enter and Enter/Return send different keycodes to the program. Sublime is looking for a certain keycode (the one sent by Enter) to submit the contents of popup menus and whatnot, and ignores the code sent by numpad_enter. Unfortunately, because this is built-in behavior, there is no setting or key binding that can be set to override it.

The only other possibility I can think of is to use a utility for your OS to reprogram you numpad_enter to send the same keycode as Enter. I'm not terribly familiar with it, but for Windows I've heard that AutoHotKey is a pretty useful utility, and as far as I can tell is free. You can remap keys with it rather easily. You'll have to google for other utilities if you're on OS X or Linux.

Good luck!

MattDMo
  • 100,794
  • 21
  • 241
  • 231