Your comments

Exactly what I need! That works, thank you :)

Additional nugget: how can I bind toggling draw_white_space to a shortcut? Using some examples, I tried adding the following line to my keymap, but it doesn't toggle, it just toggles once, but re-pressing the shortcut doesn't produce anything:

{ "keys": ["alt+d"], "command": "toggle_setting", "args": {"setting": "draw_white_space"} },

Maybe I should specify to the toggle_setting commang the values to toggle between? But how can I do that? Also, how did you find the existence of the draw_white_space command? And how can I find the values accepted by the command?

Thanks for the help!