Sublime Forum

Scroll to the top and bottom of all opened docs


I’m trying to write a .py file that will automatically scroll all open docs to the bottom or top with the code below.

import sublime, sublime_plugin

class ScrollAllOpenFiles(sublime_plugin.TextCommand):
  def run(self, edit, **kwargs):
    window = sublime.active_window()
    views = window.views()
    for view in views:
      view.run_command("move_to", kwargs)

Along with this in the .sublime-menu file.

  { "caption": "-" },
  { "caption": "Scroll All Open Files to the Top", "command": "scroll_all_open_files", "args": {"to": "bof" }, "mnemonic": "T" },
  { "caption": "Scroll All Open Files to the Bottom", "command": "scroll_all_open_files", "args": {"to": "eof" }, "mnemonic": "B" },
  { "caption": "-" }

It doesn’t work when I have around 100 or so files open, is there any way to fix this? Thanks.