The Hyphen Hijack
Google Docs utilizes a typographical autocorrect system designed to make documents look professionally typeset. One of its default behaviors involves punctuation: if you type two hyphens consecutively (–) and press the spacebar, Google Docs automatically intercepts those characters and merges them into a single, longer “em dash” (—). While this is the correct grammatical formatting for an aside in a novel or formal essay, it is incredibly frustrating for coders typing out specific command-line flags (like --help), or anyone trying to draw ASCII art or use double hyphens as a specific visual separator.
Disabling the Dash Conversion
To retain exact control over your punctuation marks and stop Google Docs from automatically replacing double hyphens with an em dash, you must disable the specific typographical substitution rule.
Open the Google Doc where you are currently working. Navigate to the top menu bar, click on Tools, and select Preferences from the dropdown list. A new dialogue box will pop up on your screen. Click on the Substitutions tab located at the top of this box. You will see a long, two-column list of automatic replacements. Scroll through this list until you find the entry where two hyphens (–) on the left are set to replace with an em dash (—) on the right. Uncheck the box to the far left of this specific rule. Click the blue OK button to save your changes. You can now type double hyphens freely.