In order to insert something to the view, we need to get the edit variable. In ST2, this can be achieved by begin_edit. But in ST3, this method is no longer viable. The edit command can be achieved using TextCommand. But I find it hard to get it within a WindowCommand class. By reading other people’s code, I noticed them using two walkarounds:
- we can use the append command: new_view.run_command(‘append’, { ‘characters’: string, ‘force’: True, ‘scroll_to_end’: False })
- we can define a TextCommand and call that command.
But both ways are a little bit awkward. Does Sublime provide a smoother way in doing this?