Hi, I’ve made a simple plugin that replaces all spaces with tabs whenever the file is saved, which is great… except for if you do ctrl-z for a while and save the file in order to test an older version of your file, because as it replaces the spaces it gets rid of all the undo history so you’re stuck with your old version >_<
I thought maybe instead it could be activated whenever the return key is pressed but couldn’t figure out how to use the on_query_context function. Here is my plugin code:
import sublime, sublime_plugin
class mykeIndent(sublime_plugin.EventListener):
def on_pre_save(self, view):
edit = view.begin_edit()
view.run_command('unexpand_tabs', {"set_translate_tabs": True})
view.end_edit(edit)
Thanks!