I recently bought a gaming keyboard that was expensive. The keyboard looked great and everyone who sees my keyboard starts loving my keyboard. In spite of the cosmetic looks and features of the keyboard, the keyboard had a weird bug where it inserts two spaces automatically instead of one when I type a document or an email or a blog post. Every time I type any paragraph faster, my keyboard sometimes automatically inserts two spaces. If Grammarly support is available for a website or a document, then Grammarly shows up double space as error and I had to manually go and correct it to one space. I was in need of something to replace two spaces with one space as a keyboard fix. I do not believe replacing with the new keyboard will fix it as I could see many user reviews with the same problem for that keyboard. A software fix for the keyboard would be great and thus I started to search for ways to fix this weird issue so I can replace two spaces with one space. I came across an automation tool called, AutoHotKey. This tool is helpful in automating several tasks at a small Windows shortcut. To fix my keyboard, I had to install this tool and write few code to fix my keyboard's hardware issue. Here are the things I did:

  1. Download AutoHotKey Installer from official website.

  2. Install the software.

  3. Now press Win Key + R and type  "shell:startup"

  4. Right click on a blank area and go to New > AutoHotKey Script Replace Two spaces with One Space

  5. Give a name to your script, say KeyboardHotFix.ahk

  6. Right click on your file and click Edit Script.

  7. Notepad should open up and show you with few codes. We do not need them, so erase everything.

  8. Copy and paste the below script in the notepad.

    ~Space:: If (A_PriorHotkey="~Space" && A_TimeSincePriorHotkey<100) SendInput {BS} Return

  9. Save the file and close Notepad

  10. Right click the .ahk file and click on Compile Script.

  11. Now a .exe version fo the script gets generated. Let this file stay in your Start-up folder.

  12. You may delete the .ahk file.

  13. You are done.

The instance of AutoHotKey script will run along with the Windows processes. Since we are creating the script in the startup folder, next time while you boot the computer, the script automatically runs and it will be available everywhere. To test this, you may open up a Notepad and start typing a few paragraph. AutoHotKey is an open-source custom scripting software that allows you to do automated tasks on few keyboard shortcuts. You can read their documentation to build other custom tools. If you are concerned about the privacy, kindly read their privacy policy. Are you on a Mac? The macOS and iOS have a built-in feature called, "Text Replacement". You can go to your System Preferences > Keyboard to replace words. Here shortcut will be the two spaces and phrase will be the single space. Every time your keyboard gives out two spaces, the operating system is responsible to replace the appropriate word that you have added. If you have any queries, please discuss in the comments below. Let me also know if you have found some other best solution.