def run(self, edit): blocks = list_blocks(self.view) this_block = region_at(blocks, cursor_pos(self.view)) if not this_block: return next_block = region_f(blocks, this_block.end()) if not next_block: return swap_regions(self.view, edit, this_block, next_block) self.view.show(next_block)
def run(self, edit): blocks = list_blocks(self.view) this_block = region_at(blocks, cursor_pos(self.view)) if not this_block: return prev_block = region_b(blocks, this_block.begin() - 1) if not prev_block: return swap_regions(self.view, edit, prev_block, this_block) self.view.show(prev_block)
def run(self, edit): for pos in list_cursors(self.view): word1 = word_at(self.view, pos) word2 = word_b(self.view, word1.begin()) swap_regions(self.view, edit, word2, word1)
def run(self, edit): # We go from right to left to correctly handle overlapping regions for pos in reversed(list_cursors(self.view)): word1 = word_at(self.view, pos) word2 = word_f(self.view, pos) swap_regions(self.view, edit, word1, word2)