Ask HN: Does anyone use keyboard/mouse extra buttons for coding?

107 points by matt_s ↗ HN
Usually gaming mice have a few extra buttons that can be mapped and some gaming keyboards have extra keys for mapping/chaining functions to them in games. Of course there is also the world of people that build custom keyboards. Has anyone used these extra buttons/keys for programming uses? Is it helpful and what are the details?

159 comments

[ 4.6 ms ] story [ 226 ms ] thread
Sometimes I get frustrated with the button combinations that I have to press over and over again.

I don't do it every day, but creating a macro can help a lot in that situation.

I have a lot of Razer gear and also a few pieces of Cooler Master gear.

The real frustrations I have though involve disabling or changing buttons in deeper ways. For instance, I love the alacritty terminal, but it uses ctrl+shift+c and ctrl+shift+v to cut-and-paste. One of those buttons opens the dev tools on my browser, which I could tolerate if it didn't also scroll the browser to the top, losing my place. So disabling keys or remapping them in applications helps.

Another pet peeve is that I fat finger the "insert" button on a laptop keyboard about once per minute so it is a candidate for disabling. Tools from the likes of Razer and Cooler Master only work with their gear, even Alienware's tools only work on the extra buttons and not on your existing buttons. So you need something like

https://github.com/microsoft/PowerToys

As for the mouse the value of remapping buttons is more limited IMHO since the act of pressing a button will usually cause a little bit of motion and screw up the alignment of what you were doing.

I have an Ergodox Moonlander on which I have a few of the macro keys mapped to specific functions within PyCharm like auto-formatting, linting and type checking.

It’s helpful because I don’t have to remember key combinations and it means much faster feedback (and fewer broken builds).

It's nearly perfect. Just wish Ergodox would support Bluetooth.
I have a Dygma Raise which is a ~60% keyboard and uses layers. My layer 2 is full of useful macros. I need macros even for the keyboard arrows because my Keyboard doesn't have arrows (arrows are layer2+hjkl or layer2+esdf). I also make heavy use of custom mappings in Vim and Bash aliases.

I have a macro for ctrl+shift+v on my Keyboard since it's the Evolution (Linux mail app) shortcut for moving emails. I also have macros for ctrl+alt+left and ctrl+alt+right to switch desktops more easily.

I have a vim macro "<leader>ji" that does "<esc>:e src/dir/i-always/go/to/prefix_" and "<leader>jv" that does "<esc>:e src/other/common/dir/filename_prefix_". Also "<leader>r" types "Reviewed-by: dyingkneepad <dyingkneepad@domain.invalid>".

I also sometimes think about implementing a keyboard macro that does a BnB combo in Skullgirls :). Maybe one day lol, but that's cheating and I wouldn't do it online (also I'd get screwed on whiff or block). Maybe I could use just Xautomation for that (that uses libXtest).

But the most useful of all, by far: alias s='cd ..'

That seems like a pretty neat keyboard, thanks for the tip.

> I also have macros for ctrl+alt+left and ctrl+alt+right to switch desktops more easily.

This is done by Super+h and Super+l over here. To bring the active window along with, add Ctrl...

I kept mistaking one of my shortcuts so I made the wrong version play a sound file of John Denver yodeling. It still gets me sometimes :-)

> I also sometimes think about implementing a keyboard macro that does a BnB combo in Skullgirls :). Maybe one day lol, but that's cheating and I wouldn't do it online (also I'd get screwed on whiff or block).

I must be getting old because I have no idea what you are saying.

How about other QMK users share their mappings in this thread? Here's mine[0]

I've been on a minimally mapped POK3R (60%) for years (pretty much CL=l2mod, l2mod+hjkl=arrows). It's been OK but still can't touch-type properly and even after years as daily driver still prefer low-profile laptop style keys.

Just switched this week to a self-built Lily58proc Choc[1] for better ergonomics and forcing myself to touch-type. My layout is still a work in progress, I still type very slowly, and would love to see other coders' mappings for inspiration :)

[0] https://gist.github.com/3nprob/41bfaca6dd712de673a140b2b3be3...

[1] https://github.com/kata0510/Lily58

I picked up similar cd aliases alias 1='cd ..' ; alias 2='cd ../..' and etc...
I’ve really taken to hyper key idea on the Mac. It’s basically a shift-Control-command-option combo bound to caps lock, together with the escape key. Tapping on caps lock generates esc for all your Vim/evil needs, while holding caps and another key results in a pretty unique key combo that I’ve never had clash with anything else.

Super handy.

https://brettterpstra.com/2016/09/29/a-better-hyper-key-hack...

I’ve been doing this lately too. I’m still on a regular keyboard but preparing for a 60% mechanical by getting used to hyper+hjkl for cursor movement.

I found another project, which also uses Karabiner Elements, to be a good starting point for customization. I especially like moving system-wide type shortcuts like 1password to it so I have fewer conflicts with editor plugin shortcuts.

https://github.com/Vonng/Capslock

I map the forward/back buttons to "Go Back" and "Go Forward" in Visual Studio Code. If I cmd+click a method or variable, I can press back to go back to where I was.

Technically I used the logictech software to map those buttons to "ctrl+-" and "ctrl+shift+-" which are the keybindings for those actions.

I have three extra buttons on my mouse. One is set to Alt+Tab, another to Alt+Tab+Tab, and the last to push-to-talk. I get by fine with one monitor now.
I tried using those for next-word-selected, but long term nothing sticks.
I'm doing web development on a Mac. Here are some tools I've found useful.

----

1. Universal keyboard shortcuts

I was using an application called ControllerMate with my Microsoft Natural Ergonomic Keyboard 4000.

I set up a bunch of hotkeys and such, and basically used the software as a translation layer. My best example follows. When I pushed the 'calculator' button on the keyboard, it would check which application was running (Chrome, Safari, Firefox, Vivaldi, etc, or Visual Studio Code) and send the appropriate keyboard shortcut to it to open the JavaScript console (or the Terminal in VS Code). I might've even set it up to start an actual Terminal and switch to it if none of those applications were running.

Likewise, I had a button to go directly to Search in relevant applications, and used the 'Zoom' keys to zoom in or out (again, ControllerMate would intercept the special key, and then change it to the appropriate shortcut for the running application).

This was great. I gladly paid for it. It doesn't work with the most recent versions of macOS :-(

----

2. Switching between applications

I use an application called Contexts to let me switch between applications quickly. For example, I'll set one browser window up as being accessible using Command-1, and an editor window that can be brought up using Command-2.

I often have dozens of windows up, and when I start doing this, I'll usually use about four shortcuts for different applications, and it can be darn handy.

----

3. Window management

I use an application called BetterSnapTool. I've got it set up so that if I press the left Command key and a number or symbol on my numeric keypad, that it'll move and size windows. This lets me put two windows side-by-side almost instantly, for example, or, indeed, four windows in different quadrants of the screen, or one taking up one third of the display and another taking up two thirds.

(I am usually using multiple monitors, where this is less useful, but I do usually remember that I love it if I'm screen sharing and limited to one display).

I use a mouse with 3 extra buttons.

2 are for copying and pasting, and 1 is for activating a programmable tooltip.

Here are the apps to achieve above (I built them):

1. Mouse config tool for Mac https://github.com/tanin47/noo

2. Programmable tooltip for Mac https://github.com/tanin47/tip

This makes me very productive mechanically.

Mouse buttons on Atheris to go back & forth folders/pages

Keyboard shortcut for typing, creating builds etc

If you are crazy like me, here is what you could do with your mouse: https://www.reddit.com/r/KeyboardLayouts/comments/kpklnq/my_...

It's a layout to avoid switching constantly from mouse to keyboard and remain most of the time with one hand on each devices.

(comment deleted)
I use IntelliJ, the forward/backward button on mx master 3s is extremely helpful navigating code
No.

1. I change platforms too frequently, so I cannot have a custom setup; and

2. when I try to run distributed with VNC or MSRemoteDesktop, there are too many conflicts when configuration, so it makes a mess.

If you only ever work on one computer, it is a great idea, but you will find it challenging to acclimate to another computer.

This is my problem. I did find a programmable keyboard at one point that actually stores config within the hardware, so you could store hotkeys and move between OS's, but most of these sorts of things require installations and some kind of platform-specific config. I gave up using my macro keyboard professionally after taking on a client that uses Macs, with which it isn't compatible. Agreed with your last point though. If your environment is stable it can definitely help.
I had a fancy ergo keyboard + left handed mouse + nostromo pad that I used in the ... 2000's maybe? loved it. had macros for all kinds of stuff for VisualStudio, I was an automation god among myself. Then my next job was like: different PC every day. Feh.
I have a Moonlander from ZSA. Flippin' sweet keyboard.

I have a layer for mouse movement with wasd. On the same layer, I've bound hjkl to the arrow keys, so I can get vimish movement wherever. Below these keys on the same layer I have some browser navigation shortcuts.

I use evil-mode in Emacs. The key below my left thumb is control on hold, escape on tap, and it works beautifully. On my left thumb cluster, I have a key that's option (meta in Emacs land) on hold, and option-x on tap (so I can easily hit M-x in Emacs).

On another layer I have hotkeys to manage window tiling. I use Magnet for macOS; works fine for my needs. One thing I wanted that Magnet didn't have was a half-width-but-centered hotkey; I was able to build that into a macro on my keyboard.

Keyboard macros are a beautiful thing. QMK firmware is the best!

My layout: https://configure.zsa.io/moonlander/layouts/xK7zR/latest/0

The Moonlander is great.

I have Cmd+Shift+R (Refresh) and Cmd+Alt+I (Dev tools) on the two big red keys. On my navigation layer I have distinct keys for emacs navigation: C-x [, C-x ] (page forward/backward) and ESC f, ESC b (word forward/backward).

And I have Ctrl+Cmd+Space (MacOS emoji picker) on a single key.

My layout: https://configure.zsa.io/moonlander/layouts/4DrXo/XxmmW/0

Oooh, the emoji picker is a great idea! I just added that to one of my layers. Thanks for the tip!
I also have a moon lander and use Emacs. Thank you for the ideas!
Do you ever turn on chip-tunes mode? The first time I did I couldn't remember how I turned it on. That was a fun few minutes
I had that on for a minute to play with. There's a keycode called "Music Toggle" in the Oryx configurator. I don't think I have that on any of my keys right now.
My mouse has built in back/forward buttons, which I use extensively to go back and forth through files. Occasionally use middle click for paste.
I have a dedicated macro pad (a duckypad https://www.tindie.com/products/dekuNukem/duckypad-do-it-all... ) and I use it extensively. I have macros for lots of IDE commands, window management, launchers etc. I'm not so great at remembering keyboard shortcuts, so having the macro pad, especially one with a screen that can tell you what each button is, is a boost. I use every key on my pad frequently.

I have a programmable keyboard that I could use to achieve the same thing, but I really like having a dedicated device and find that I use it more than if it was just a function layer in QMK. IMO this is also one of the legit uses of individual key RGB on a keyboard beyond just bling-- you can color code keys.

I don’t, but if I did, I’d configure them to 1) go to definition and 2) find all references in VSCode.
I actually use a joystick for shortcuts. I have a few commands triggered by certain joystick sequences, such as Right-Down-Diagonal-Button deletes the remainder of the line to the right the cursor. This is accompanied by a sound effect.
I use the “recon” side button on my Corsair M65 mouse to activate “Mission Control” (or the Gnome 3 equivalent thereof). I’ve also remapped the sensitivity up/down buttons to switch virtual desktops. Not coding-related exactly but I use it as a productivity boost when I’m working with code.
I use a Corsair M95 mouse. I've programmed the side buttons for copy and paste, select all, refresh, and the activitation of my drop-down Tilix terminal. There are also the default forward/back and dpi buttons. It's more for productivity as opposed to programming though, as I use Vim for programming and all the commands are already easily accessible from the keyboard. The browser controls and copy and paste buttons are great for cases when I have a hand on my mouse but the other is not on my keyboard.

The downside of this is that I oftentimes tap the side of the mouse when using a different computer (and realizing that there's no button to press) thanks to muscle memory.

Not keyboard shortcut but I’ve found a trackball which you can rotate the ball for scrolling super comfortable. Way better than the spin wheel on a mouse. And given how much scrolling happens on webpages it gets used a lot
I have an Expert mouse and like this more than I thought I would.
I work all day on a command line. I just have a bunch of two character aliases which are about as easy to type as a a keyboard shortcut at least.
I’ll just say that I know I’m old because I’d get made fun of for using a mouse at all for dev work back in 2008.