def run_zencoding_action(action): file_types = ('HTML', 'PHP', 'XML', 'CSS') cur_file_type = geany.document.get_current().file_type.name if cur_file_type in file_types: doc = geany.document.get_current() zen_editor = ZenEditor(doc) zencoding.run_action(action, editor=zen_editor)
def run(self, view, contexter, kw): matches = [] for i, selection in enumerate(contexter): args = kw.copy() if self.last_matches and not i >= len(self.last_matches): last_match.update(self.last_matches[i]) zencoding.run_action(args.pop('action'), editor, **args) matches.append(last_match.copy()) self.last_matches = matches
def wrap(self, context, abbr): # Set up the config variables if abbr: editor = ZenEditor(context) return zencoding.run_action('wrap_with_abbreviation', editor, abbr) else: return False
#!/usr/bin/env python # -*- coding: utf-8 -*- import zencoding import sys from zen_editor import ZenEditor import reflect editor = ZenEditor() try: args = sys.argv[2:] except: args = [] try: zencoding.run_action(sys.argv[1], editor, *args) except zencoding.utils.ZenError: print(sys.exc_info()[1])
def update_image_size(): zencoding.run_action('update_image_size', _npp_editor)
def increment_number(step): zencoding.run_action('increment_number', _npp_editor, step)
def evaluate_math_expression(): zencoding.run_action('evaluate_math_expression', _npp_editor)
def reflect_css_value(): zencoding.run_action('reflect_css_value', _npp_editor)
def remove_tag(): zencoding.run_action('remove_tag', _npp_editor)
def next_edit_point(): zencoding.run_action('next_edit_point', _npp_editor)
def toggle_comment(): zencoding.run_action('toggle_comment', _npp_editor)
def match_pair_outward(): zencoding.run_action('match_pair_outward', _npp_editor)
def go_to_matching_pair(): zencoding.run_action('go_to_matching_pair', _npp_editor)
def select_previous_item(): zencoding.run_action('select_previous_item', _npp_editor)
def select_next_item(): zencoding.run_action('select_next_item', _npp_editor)
def prev_edit_point(): zencoding.run_action('prev_edit_point', _npp_editor)
def expand_abbreviation(isTab): global _profile result = zencoding.run_action('expand_abbreviation', _npp_editor, None, _profile) if isTab and result == False: Npp.editor.tab()
def split_join_tag(): zencoding.run_action('split_join_tag', _npp_editor)
def merge_lines(): zencoding.run_action('merge_lines', _npp_editor)
def wrap_with_abbreviation(): global _profile abbr = Npp.notepad.prompt("Wrap with abbreviation:", "Zen Coding - Python") if abbr is not None: zencoding.run_action('wrap_with_abbreviation', _npp_editor, abbr, None, _profile)