I am using Sublime Text 2 to write JavaScript code. When attempting to type a double dash to represent the auto decrement value of a variable, Sublime is substituting en_dash in my code.
How can I suppress this behavior in Sublime text?
I am using Sublime Text 2 to write JavaScript code. When attempting to type a double dash to represent the auto decrement value of a variable, Sublime is substituting en_dash in my code.
How can I suppress this behavior in Sublime text?
are you on a Mac? it isn’t standard ST behavior, so probably your OS is doing this…
also ST2? in 2020?
Thanks for your response.
Yes, I am on a Mac, and recently got my system updated from Sierra to Catalina. Now I know to look around in the Mac universe for my solution (although not every place is affected by this, as evidenced by the double dash entries below).
Yes – still on ST2 – have not yet seen enough reason to change – will review that question also.
Further reply with follow-up question: are there people using Mac Catalina with Sublime Text who do not have a problem with double dashes being replaced with the en_dash code?
It’s probably worth noting that ST2 is no longer actively supported and its dependence on a version of Python that ships with the system no longer being the same on more recent versions of MacOS may make its continued use problematic.
In any case, I would try going into the Sublime console with View > Show Console
and enter sublime.log_commands(True)
and sublime.log_input(True)
, then enter a double dash in a place where you normally see this problem.
The console output should look something like this:
>>> sublime.log_commands(True)
>>> sublime.log_input(True)
chr evt: - (0x2d)
chr evt: - (0x2d)
If you see any commands being interspersed in there, then possibly you have a package that’s interfering with this, such as through a key binding. If all you see is that input but the emdash appears, then I would suspect the OS of helping you out.
This would particularly be the case if this happens everywhere (like in the input widget of the console) and not just in certain types of files.
You can turn it off in System Preferences > Keyboard > Text > Use smart quotes and dashes.
Thanks for the tip on the Mac keyboard settings feature.
I did uncheck the “Use smart quotes and dashes” option. However, Sublime Text was not influenced by that change (I did quit and then restart Sublime text).
Thanks for your input. I will look into your comments more closely when I get past the current coding crunch that I am working through in the moment.