In TextEdit, if I type two `-` it is converted to one longer `-`
Go to Edit → Substitutions and disable Smart Dashes.



You can disable this globally in System Preferences: Keyboard → Text. Disable ‘Use smart quotes and dashes’.



To only disable the dash substitution globally whilst leaving smart quotes enabled by adding the substitution to System Preferences: Keyboard → Text. Add a new entry set to -- for both ‘replace’ and ‘with’ to disable the substitution. This works because entries here override the OS regardless of whether substitutions are enabled.



To disable the dash substitution globally without this workaround, you can disable NSAutomaticDashSubstitutionEnabled:

defaults write -g NSAutomaticDashSubstitutionEnabled 0