sublimetext2 - Sublime Text 2/3 - How to always have at least 10 lines under current line? -


is there way show @ least x number of lines below current line in st? cursor on line 55, want sublime display @ least 10 more lines below current line line 55 never @ bottom of screen. possible in sublime?

you can achieve simple plugin, listens cursor movement events.

from tools menu in sublime text, click new plugin. replace contents following:

import sublime, sublime_plugin  class showlinesunderselectionlistener(sublime_plugin.eventlistener):     def show_lines_under_selection(self, view, number_of_lines_to_show):         cursor_pos = view.sel()[0].end()         row, col = view.rowcol(cursor_pos)         desired_pos = view.text_point(row + number_of_lines_to_show, col)         if not view.visible_region().contains(desired_pos):             view.show(desired_pos, false)      def on_post_text_command(self, view, command_name, args):         if command_name in ('word_highlight_click', 'move', 'move_to', 'insert'):             self.show_lines_under_selection(view, 10)      def on_post_window_command(self, window, command_name, args): # vintageous support         if command_name in ('press_key'):             self.show_lines_under_selection(window.active_view(), 10) 

save folder suggests show_lines_under_cursor.py.

this ensure there 10 visible lines under cursor. note once reach bottom of file, won't scroll further show 10 non-existing-in-file lines. i'm not sure if possible via api.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -