Sublime Forum

Api method to get indentation character of the buffer?

#1

I know sublime dynamically figures out what the indentation character for a buffer is and uses that for tabs. Is this exposed in the API? I would love to be able to just call and api method to get the indentation character for the current buffer. I don’t really care about setting it.

It looks like this might be on the Settings object returned by ‘view.settings’, but I cant find a list of keys anywhere.

Sorry if this is obvious in the documentation somewhere, apparently I suck at finding things in there.

0 Likes

#2

You can work it out by querying the settings translate_tabs_to_spaces and tab_size. However, if you’re just trying to insert indented text, then you can call view.insert with tab characters, and they’ll be translated to spaces if required.

0 Likes

#3

Thanks, forgot about those settings, haven’t had to mess with them in the more recent builds. This is for my javascript formatting plugin, I just need the indentation character (and size actually) to pass to jsbeautifier so people only have to manage indent characters in one place. The settings values should do it

0 Likes