Setting up complex hotkeys is a nightmare - half-guide half-rant

Recently inspired by a certain Youtube video (link), I’ve decided to remap all of my usefull hotkeys to the left side of the keyboard. Unfortunately I’ve started to hit limits of KiCad itself.

Here’s a visual guide to the hotkeys I’ve set up:
New KiCad Hotkey Map.pdf (326.5 KB)
and here’s the user.hotkeys file for reference:
user.hotkeys (27.1 KB)
I’m using KiCad 8.0.0 on Windows 10, but most of these quirks are not new, I just haven’t bothered to set up all the hotkeys properly before.

Now one of the first quirks I’ve come across is that I cannot set any hotkeys involving ALT+ number or CTRL+ number. For example: trying to set ALT+1 in hotkey editor makes an error sound and fails to set anything, writing it directly into the user.hotkeys file also doesn’t work. KiCad itself uses these key combinations without any issues though. (Alt+1 is switch to fast grid 1, Alt+3 is 3D view)
The only one that works for me is CTRL+SHIFT+2, which I’ve used for creating a bus entry.

In the PCB editor there is a set of “Align to” tools, in the context menu


I love using these when placing components on finer grids, and you can thankfully assign hotkeys to them. These functions don’t exist in the schematic editor and in their place there are only those graphical indicators that symbols are aligned with each other. I’d love to have as much consistency for hotkeys between different programs as I can, but there are issues that need to be resolved first, before these functions could be impemented in the Schematic Editor, for example “distribute horizontally” and “distribute vertically” would often put components off-grid.
Also sometimes when I hit Shift+W (align to top) it aligns to the bottom instead. 90% of the time it’s the right-way around.

Speaking of different programs, the hotkey editor will prevent you from setting the same key to two different operations in the same program. With Symbol Editor being considered the same program as Schematic Editor, same with Footprint Editor being considered the same program as PCB Editor. There are certain actions specific to the Symbol and Footprint editors, such as add a pad or add a pin, that I would like to assign to a key that is used in the other program. For example I use the “2” key to draw a wire in the schematic editor, while simultanously use “2” to add a pin in the schematic editor. You cannot do that with the preferences → hotkeys window, because the software will prevent you. However there is a way to work around it by editing the user.hotkeys file directly. I’ve used it succesfully to have “add hierarchical sheet” and "draw polygon on key 3 and “draw wire” and “add pin” on key 2 simultaneously. When I tried to do the same with the “add a symbol” and “run symbol checks”, it no longer works properly. In symbol editor the “run symbol checks” on hotkey 1 works, but in the schematic editor pressing 1 yields no results. There is no possible scenario when “run symbol checks” is able to be used in the schematic editor - it’s only available in the symbol editor, yet it still blocks the symbol chooser from being opened if it’s on the same hotkey.

There are way too many ways to move a component, and they all require a different hotkey. In the schematic editor, there is a standard move, which disconnects all the traces, and drag, which moves components and keeps the traces connected. Similarily, in PCB editor there is the same move, and a 45 degree drag. I personally much prefer the drag over move, so I’ve set my main “move” hotkey (Z) to use these drag operations, with the classic move being relegated to Shift+Z. Now all is good in the Schematic and PCB Editors, but in Symbol and Footprint Editors these drag functions don’t exist, and I have to either move by dragging with the mouse or use the slower Shift+Z hotkey.

In Schematic Editor and Symbol Editor you can mirror selected objects either vertically or horizontally, and in the PCB Editor you should never mirror, and just flip objects to the other side of the PCB instead. Since those operations are related I’ve decided to use the same hotkey to mirror (C and Shift+C) in Symbol/Schematic editor, and flip (just C) in the PCB Editor. This works, because mirror V and mirror H in the Symbol/Schematic Editors is considered a different operation than mirror V and mirror H in the PCB Editor.
There is one small problem - Footprint Editor. There are mirror V and mirror H operations there, and they are very usefull, but I can’t assign the C and Shift+C hotkey to them, because they would override the C to flip in the PCB Editor. Flipping doesn’t work at all in the footprint editor, but if I were to assign C to both flip and mirror, it would mirror footprints in the PCB editor which is not what I want.

Now for something that can’t be assigned a hotkey at all: Rotating by 45 degrees.
In schematics rotating by anything else than 90 degrees is impossible, but I have made some of my symbols to have an alternate symbol body, where the component is rotated by 45 degrees, while still having pins on the 50 mil grid.


After assigning the “toggle deMorgan function” to the Shift+R hotkey, I’ve somewhat got the 45 degree rotation that I wanted.
In the PCB editor, you can manually enter the 45 degrees into the orientation text box, in properties of any component you want to rotate. Automating this, however is (as far as I know) impossible, there is no available function in the hotkey editor that does a 45 degree rotation.

This is just the stuff that I’ve discovered so far, there are certainly many more quirks, inconsistencies and straight up bugs in KiCad’s hotkey editor, but I’m satisfied with what I’ve got now.

I hope this information will help people with setting up their own hotkeys.

It seems to work for me . . . V7 Win 10

image

I can easily change this to . . .

image

and back again . . .

image

1 Like

I believe it might be related to the keyboard layout, I’m using a Polish keyboard layout in windows. There are certain special characters that use alt (for example alt+o = ó) and that’s probably interfering with the alt+ hotkey setting. I’m not sure if it’s something that KiCad can fix. Unless someone in V8 also has that problem on an US keyboard layout.

Update: This has nothing to do with the keyboard layout. I can set Alt+ hotkeys in V7 as well. Appears to be a V8 bug. Seems related to this issue that was “fixed”

1 Like

Yeah, internationalization/localization doesn’t work with hotkeys. There are characters and combinations which just don’t work with different keyboards. There are some years old issues for that, especially because some default hotkeys don’t work for everyone. I have given up and don’t use many hotkeys.

At first, there’s a fundamental problem: when a hotkey or shortcut is represented with a visible character, what does it mean? Does it mean the key where that character is supposed to “be”, or does it mean the key combination which should type that character in text editors/fields? Usually simple hotkeys are given as ‘A’, ‘Shift+A’ etc. but as a character ‘A’ is typed ‘Shift+A’ while typing ‘A’ gives ‘a’.

One difficult is the very common “highlight net”, backtick, which I can’t write at all with any simultaneously pressed key combination. It’s a “dead key” which produces the character with two consecutive key presses. Needless to say, as a character it’s useless as a hotkey, and as a key combination it doesn’t work either.

IMO any character which can’t be represented as simple ascii alphanumeric keys with all keyboard settings in the world shouldn’t be used in the default hotkeys.

This is of course a different problem that KiCad running out of useful key combinations. The only future proof solution is some kind of chained hotkey/shortcut system where one key combination enables certain consecutive hotkeys/shortcuts. For example emacs works this way. Ctrl+X stands for “extended” or something like that, and as simple and basic command as “Save file” isn’t Ctrl+S but Ctrl+X Ctrl+S. This gives practically limitless amount of key combinations.

I’ve opened an issue here:

If any other people find that some of my experiences while setting up hotkeys are results of bugs and not me pushing the software to it’s limit, let me know and I’ll open more issues.

This kind of “nested” approach to hotkeys could be a solution, but it needs to be implemented very carefully. I’ve already encountered unpredictable behavior when assigning multiple commands to the same key by editing the user.hotkeys file. Some commands work together flawlessly, some completely block any other command. KiCad devs slapped on a restriction, so the user can only set one key to do one command (even if KiCad by defauld has a couple of hotkeys that do different commands), specifically because it can cause problems for some commands.
Most commands would need to be rewritten to accomodate that new “nested” hotkey approach.