Keybinding Collision Between Mac Keyboard Shortcuts for OpenPGP & IntelliJ IDEs — RubyMine, PyCharm, WebStorm, etc

Aron Filbert
Nov 18, 2018 · 5 min read

Adventures with “Find in Path” in IntelliJ IDEA.

TL;DR: Mac OS Shortcuts” keybindings for “OpenPGP: Insert My Fingerprint” collide with RubyMine’s default Find in Path shortcut and auto-paste feature. This creates a frustrating experience where every time ⇧⌘F is used to open Find in Path, your OpenPGP fingerprint gets automatically pasted into the input as your search query string.


So I’ve been neck deep in a multi-day struggle to understand and fix a strange issue where opening Find in Path to do a project-wide search in RubyMine (and every other IntelliJ-flavored IDE, as it turns out) resulted in what appeared to be a random value from some ghost clipboard of my development past.

Part of my workflow involves routinely using the following key binding combo:

⇧⌘F

Which opens the “Find in Path” dialog:

Using this feature is helped along by the ability to detect selected text in the editor and apply it automatically as the search query string:

Strings of text highlighted in the editor before hitting ⇧⌘F should show up as the search query in Find in Path. — Credit to one of my coworkers for the “footguns” ref.
Find in Place working normally after being invoked on selected text. It populates the selected text into the input as the search query.

About a month ago, that all changed. Instead of showing up and allowing me to type my search query into the input, or auto-populating the search query from whatever I had selected in the editor, it instead loaded a rando looking string of grouped alphanumeric characters:

Grouped hex pairs. Every. Single. Damn. Time. 😳

Of course I took a stab at figuring out why this was happening, and got back to work after 5 minutes of failure. That was all my sprint commitments allowed for at the time. So I was able to kinda ignore it while at first being mildly amused, and then increasingly frustrated by it.

Being mildly frustrated but repeating the “quick” ⌘C, ⇧⌘F, ⌘A/⌘V dance around the problem ad nauseam worked until I became embroiled in a larger refactoring project. That’s when I got to the breaking point. I needed to NOT have to keep selecting the random string, deleting it or pasting in whatever it was that I actually wanted to search.

So I started looking everywhere. First thing I stumbled on was this intellij-support post titled That was a red herring. So I started tweaking with the project config in .idea and then futzing with virtually all of any saved anything related to RubyMine anywhere in my OS.

It didn’t help that I had recently worked on a project creating and copying randomly generated groups of hexadecimal pairs to the clipboard. Those groups of pairs looked almost identical to the random string. So, I mistakenly believed for days that the string was some part of some ghost clipboard history stored in some arcane setting or configuration somewhere.

helped me find all the config locations, and helped me with clearing Find in Place history of stored search queries. Armed with all that, I:

  • Nuked my entire search history for my project.
  • Sploded all my config and settings.
  • Replaced RubyMine with the last three versions in succession.
  • Updated my OS.
  • Restarted my laptop.
  • Eradicated any reference to any IntelliJ products.
  • Reinstalled a fresh copy of RubyMine and went through the initial setup.
  • Exported settings.
  • Imported settings.
  • Fully powered down my laptop in utter desperation.
  • Installed PyCharm. Got SAME behavior. Aha! A light in the fog.

Now I was onto something!

I knew this had to do with something involving keybindings. I opened up the preferences in PyCharm to start searching the existing key mappings. I thought maybe the defaults were colliding with something. So, I tried hitting the magic key combo — ⇧⌘F — while in another input. Sure enough! There was that damn rando string again!

💥

I cleared the field and hit ⇧⌘F again. This time, I paid attention to what the menu was doing with the key combo. I saw it highlight as if applying something while my favorite string popped into the Keymap input again. So, I opened the menu and started scouring each menu for that magical combination. I went through all of them and they were almost all grayed out, except the root PyCharm menu.

I hovered over it. Didn’t see anything exciting. So I hovered over Services submenu. OMG. There it was!

“OpenPGP: Insert My Fingerprint” was bound to ⇧⌘F, the same default that launches “Find in Path” in IntelliJ IDEs.

For real, dude?

Clicked to Services Preferences… annnnnnnnd:

Whelp.

Unchecking that global shortcut got me back to my merry refactoring.

This was a problem that had been lying in wait for months, and didn’t present itself until I had created a public key for myself in GPG Keychain.

I hesitated posting this, because it’s kinda embarrassing how long it took me to resolve this issue. I’ve never personally been sabotaged by global shortcuts like this, before, and… what’s more, this issue didn’t show up in Visual Studio Code; which I use often side-by-side with RubyMine, and which uses the same ⇧⌘F shortcut for opening Find in Files.

Hopefully this helps someone somewhere save some time!

All that said, I’ll leave you with this gif:

Aron Filbert

Written by

Software Engineer at Flywheel. Co-founder, Lyconic. Father. Recovering perfectionist. Useful idiot. Aspiring greater fool.