Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Default.sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
},

{ "keys": ["z", "z"], "command" : "center_on_cursor", "context": [{"key": "setting.command_mode"}] },
{ "keys": ["z", "t"], "command" : "scroll_cursor_line_to_top", "context": [{"key": "setting.command_mode"}] },
{ "keys": ["z", "b"], "command" : "scroll_cursor_line_to_bottom", "context": [{"key": "setting.command_mode"}] },
{ "keys": ["z", "t"], "command" : "scroll_cursor_line", "args": {"to": "top"}, "context": [{"key": "setting.command_mode"}] },
{ "keys": ["z", "b"], "command" : "scroll_cursor_line", "args": {"to": "bottom"}, "context": [{"key": "setting.command_mode"}] },

{ "keys": ["Z", "Z"], "command" : "vi_save_and_exit", "context": [{"key": "setting.command_mode"}] },

Expand Down
30 changes: 21 additions & 9 deletions vintage.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,15 +975,27 @@ class CenterOnCursor(sublime_plugin.TextCommand):
def run(self, edit):
self.view.show_at_center(self.view.sel()[0])

class ScrollCursorLineToTop(sublime_plugin.TextCommand):
def run(self, edit):
self.view.set_viewport_position((self.view.viewport_position()[0], self.view.layout_extent()[1]))
self.view.show(self.view.sel()[0], False)

class ScrollCursorLineToBottom(sublime_plugin.TextCommand):
def run(self, edit):
self.view.set_viewport_position((self.view.viewport_position()[0], 0.0))
self.view.show(self.view.sel()[0], False)
class ScrollCursorLineCallback(sublime_plugin.TextCommand):
def run(self, edit, region_set, motion_mode):
for region in region_set:
self.view.sel().add(sublime.Region(long(region[0]), long(region[1])))
set_motion_mode(self.view, int(motion_mode))

class ScrollCursorLine(sublime_plugin.TextCommand):
def run(self, edit, to):
if to == 'top':
self.view.set_viewport_position((self.view.viewport_position()[0], self.view.layout_extent()[1]))
self.view.show(self.view.sel()[0], False)
elif to == 'bottom':
self.view.set_viewport_position((self.view.viewport_position()[0], 0))
self.view.show(self.view.sel()[-1], False)
region_set = []
for region in self.view.sel():
region_set.append([region.a, region.b])
motion_mode = g_input_state.motion_mode
self.view.sel().clear()
sublime.set_timeout(lambda: self.view.run_command('scroll_cursor_line_callback',
{'region_set': region_set, 'motion_mode': motion_mode}), 0)

class ViScrollLines(ViPrefixableCommand):
def run(self, edit, forward = True, repeat = None):
Expand Down