<s> import vim <EOL> import vimp <EOL> def get_syntax_group ( position = None ) : <EOL> """<STR_LIT>""" <EOL> line = position . line + <NUM_LIT:1> if position else '<STR_LIT>' <EOL> col = position . col + <NUM_LIT:1> if position else '<STR_LIT>' <EOL> return vim . eval ( '<STR_LIT>' . format ( line , col ) ) <EOL> def get_entire_syntax_region ( position = None ) : <EOL> """<STR_LIT>""" <EOL> seed = position or vimp . buf . cursor <EOL> group = get_syntax_group ( seed ) <EOL> start , end = seed , seed <EOL> for p , c in vimp . buf . items ( start = seed , reversed = False ) : <EOL> if not group == get_syntax_group ( p ) : <EOL> break <EOL> end = p <EOL> for p , c in vimp . buf . items ( start = seed , reversed = True ) : <EOL> if not group == get_syntax_group ( p ) : <EOL> break <EOL> start = p <EOL> return ( vimp . buf [ start : end ] , group , start , end ) </s>
