Sublime Forum

Different character spacing?

#1

Hi !

When I code something, I leave some (no needed) spaces for more readability, like that :

if(true) { //useless space before bracket int i = 0; //useless before and after = }
So I’m wondering if there are a way to say him :
“hey ST2, I would before and after operator like == you increase the character spacing, like that, I don’t need to type useless space anywhere”

0 Likes

#2

No one can tell me if it’s possible or not ?

0 Likes

#3

There are a ton of ways to do this. One way would be to make custom keybindings. For example: { "keys": "=","="], "command": "insert_snippet", "args": {"contents": " == "} }, If you add that to your User Keybindings (Preferences > Keybindings - User), ST will automatically add spaces before and after == as you type. You could also write a plugin that searches the current file for all instances of == and add spaces before and after, then binding that command to a key.

0 Likes

#4

Yes, thanks for our answer, but I don’t want use snippets.
Because if I use spaces instead, I cannot choose a different spacing depending on which symbol is. (I don’t want the same spacing if it’s == than : by example)

0 Likes