Sublime Forum

Jumping to bookmarks always centers the screen, how to change?

#1

Whenever I f2 and jump to a bookmark the screen always displays the bookmark in the middle of itself. I don’t find this behaviour useful, I’d rather it display the bookmark at the top of the screen. How can I set this up? Tossing some potentially useful code below, not sure how to change it though:

   { "keys": ["f2"], "command": "chain","args":{
      "commands": [
         ["next_bookmark"],
         ["some_plugin"]
   ]
   }},

#some_plugin:
import sublime, sublime_plugin

class some_plugin(sublime_plugin.TextCommand):
def run(self, edit):
    screenful = self.view.visible_region()

    col = self.view.rowcol(self.view.sel()[0].begin())[1]
    row = self.view.rowcol(screenful.a)[0] + 1
    target = self.view.text_point(row+28, col)

    self.view.sel().clear()
    self.view.sel().add(sublime.Region(target))
0 Likes