<s> import sublime_plugin <EOL> import re <EOL> class IndentListItemCommand ( sublime_plugin . TextCommand ) : <EOL> def run ( self , edit , reverse = False ) : <EOL> for region in self . view . sel ( ) : <EOL> line = self . view . line ( region ) <EOL> line_content = self . view . substr ( line ) <EOL> bullet_pattern = "<STR_LIT>" <EOL> new_line = line_content <EOL> if self . view . settings ( ) . get ( "<STR_LIT>" , True ) : <EOL> bullets = self . view . settings ( ) . get ( "<STR_LIT>" , [ "<STR_LIT:*>" , "<STR_LIT:->" , "<STR_LIT:+>" ] ) <EOL> for key , bullet in enumerate ( bullets ) : <EOL> if bullet in new_line : <EOL> if reverse and new_line . startswith ( bullet ) and key is <NUM_LIT:0> : <EOL> continue <EOL> new_line = new_line . replace ( bullet , bullets [ ( key + ( <NUM_LIT:1> if not reverse else - <NUM_LIT:1> ) ) % len ( bullets ) ] ) <EOL> break <EOL> if self . view . settings ( ) . get ( "<STR_LIT>" ) : <EOL> tab_str = self . view . settings ( ) . get ( "<STR_LIT>" , <NUM_LIT:4> ) * "<STR_LIT:U+0020>" <EOL> else : <EOL> tab_str = "<STR_LIT:\t>" <EOL> if not reverse : <EOL> new_line = re . sub ( bullet_pattern , tab_str + "<STR_LIT>" , new_line ) <EOL> else : <EOL> new_line = re . sub ( tab_str + bullet_pattern , "<STR_LIT>" , new_line ) <EOL> self . view . replace ( edit , line , new_line ) <EOL> def is_enabled ( self ) : <EOL> return bool ( self . view . score_selector ( self . view . sel ( ) [ <NUM_LIT:0> ] . a , "<STR_LIT>" ) ) </s>
