Exemplo n.º 1
0
 def backwards_find_char(self, num=1, num_str=''):
     """Find characters forwards."""
     executor_sub = self.executor_search_char
     executor_sub.set_search_method("ch_backwards")
     executor_sub.n_input_required = num
     executor_sub.set_func_list_deferred(self.func_list_deferred)
     return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 2
0
    def closesquarebracket(self, num=1, num_str=''):
        """Start [ submode."""
        executor_sub = self.executor_sub_closesquarebracekt

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 3
0
 def set_position_result_to_vim_status(self, positions, motion_type):
     """Set positions to vim status for easymotion."""
     executor_sub = self.executor_select_maker
     if positions:
         executor_sub.set_func_list_deferred(self.func_list_deferred)
         self.vim_status.set_marker_for_easymotion(positions, motion_type)
         return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 4
0
    def slash(self, num=1, num_str=''):
        """Find text position."""
        executor_sub = self.executor_sub_search
        self.set_parent_info_to_submode(executor_sub, num, num_str)
        executor_sub.set_func_list_deferred(self.func_list_deferred)

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, False)
Exemplo n.º 5
0
    def g(self, num=1, num_str=''):
        """Execute submode of g."""
        executor_sub = self.executor_sub_sub_g
        self.set_parent_info_to_submode(executor_sub, num, num_str)
        executor_sub.set_func_list_deferred(self.func_list_deferred)

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 6
0
    def T(self, num=1, num_str=''):
        """Go to the next occurrence of a character."""
        executor_sub = self.executor_sub_f_t

        self.set_parent_info_to_submode(executor_sub, num, num_str)
        executor_sub.set_func_list_deferred(self.func_list_deferred)

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 7
0
    def run_easymotion(self, num=1, num_str=''):
        """Run easymotion."""
        executor_sub = self.executor_sub_easymotion

        self.set_parent_info_to_submode(executor_sub, num, num_str)
        executor_sub.set_func_list_deferred(self.func_list_deferred)

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 8
0
    def g(self, num=1, num_str=''):
        """Start g submode."""
        executor_sub = self.executor_sub_g

        self.set_parent_info_to_submode(executor_sub, num, num_str)
        executor_sub.set_func_list_deferred(
            [FUNC_INFO(self.apply_motion_info_in_visual, True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 9
0
    def quote(self, num=1, num_str=''):
        """Set the name of register."""
        executor_sub = self.executor_sub_register

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred([])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 10
0
    def a(self, num=1, num_str=''):
        """Select block inclusively."""
        executor_sub = self.executor_sub_motion_a

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred(self.func_list_deferred)

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 11
0
    def Z(self, num=1, num_str=''):
        """Start Z submode."""
        executor_sub = self.executor_sub_Z

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred([])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 12
0
    def less(self, num=1, num_str=''):
        """Shift lines leftwards."""
        executor_sub = self.executor_sub_motion

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred(
            [FUNC_INFO(self.helper_action.unindent, True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 13
0
    def t(self, num=1, num_str=''):
        """Go to the next occurrence of a character."""
        executor_sub = self.executor_sub_f_t

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred(
            [FUNC_INFO(self.apply_motion_info_in_visual, True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 14
0
    def i(self, num=1, num_str=''):
        """Select block exclusively."""
        executor_sub = self.executor_sub_motion_i

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred(
            [FUNC_INFO(self.set_block_selection_in_visual, True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 15
0
    def slash(self, num=1, num_str=''):
        """Go to the next searched text."""
        self.vim_status.set_message("")
        executor_sub = self.executor_sub_search

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred(
            [FUNC_INFO(self.apply_motion_info_in_visual, True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, False)
Exemplo n.º 16
0
    def d(self, num=1, num_str=''):
        """Delete text."""
        executor_sub = self.executor_sub_motion_d

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred(
            [FUNC_INFO(self.helper_action.yank, True),
             FUNC_INFO(lambda x: self.helper_action.delete(x, is_insert=False),
                       True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 17
0
    def c(self, num=1, num_str=''):
        """Toggle comment."""
        if self.vim_status.is_normal():
            executor_sub = self.executor_sub_motion
            self.set_parent_info_to_submode(executor_sub, num, num_str)
            executor_sub.set_func_list_deferred([
                FUNC_INFO(lambda x: self.helper_action.toggle_comment(x), True)
            ])

            return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
        else:
            self.helper_action.toggle_comment(None)
Exemplo n.º 18
0
    def y(self, num=1, num_str=''):
        """Yank {motion} text into register."""
        executor_sub = self.executor_sub_motion_d

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred(
            [FUNC_INFO(lambda x:self.helper_action.yank(x, is_explicit=True),
                       True),
             FUNC_INFO(self.apply_motion_info_in_yank, True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 19
0
    def U(self, num=1, num_str=''):
        """Make txt uppercase and move the cursor to the start of selection."""
        if self.vim_status.is_normal():
            executor_sub = self.executor_sub_motion
            self.set_parent_info_to_submode(executor_sub, num, num_str)
            executor_sub.set_func_list_deferred([
                FUNC_INFO(lambda x: self.helper_action.handle_case(x, 'upper'),
                          True)
            ])

            return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
        else:
            self.helper_action.handle_case(None, 'upper')
Exemplo n.º 20
0
    def r(self, num=1, num_str=''):
        """Replace the selected text under the cursor with input."""
        executor_sub = self.executor_sub_r
        executor_sub.pos_start = self.get_pos_start_in_selection()
        executor_sub.pos_end = self.get_pos_end_in_selection()

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        executor_sub.set_func_list_deferred([
            FUNC_INFO(self.vim_status.to_normal, False),
            FUNC_INFO(lambda: self.set_cursor_pos(executor_sub.pos_start),
                      False)
        ])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 21
0
    def at(self, num=1, num_str=''):
        """Execute contents of register."""
        if self.vim_status.is_recording_macro():
            self.vim_status.manager_macro.remove_last_key('@')
            return

        executor_sub = self.executor_sub_alnum

        manager_macro = self.vim_status.manager_macro
        self.set_parent_info_to_submode(executor_sub, num, num_str)
        executor_sub.set_func_list_deferred([
            FUNC_INFO(lambda x:manager_macro.set_info_for_execute(x, num),
                      True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 22
0
    def q(self, num=1, num_str=''):
        """Record typed characters into register."""
        if self.vim_status.is_recording_macro():
            self.vim_status.stop_recoding_macro()
            self.vim_status.set_message("")
        else:
            executor_sub = self.executor_sub_alnum

            self.set_parent_info_to_submode(executor_sub, num, num_str)

            executor_sub.set_func_list_deferred([
                FUNC_INFO(self.vim_status.start_recording_macro, True),
                FUNC_INFO(lambda: self.vim_status.set_message(""), False)])

            return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 23
0
    def tilde(self, num=1, num_str=''):
        """Switch case of the character under the cursor.

        Move the cursor to the start of selection.
        """
        if self.vim_status.is_normal():
            executor_sub = self.executor_sub_motion
            self.set_parent_info_to_submode(executor_sub, num, num_str)
            executor_sub.set_func_list_deferred([
                FUNC_INFO(lambda x: self.helper_action.handle_case(x, 'swap'),
                          True)
            ])

            return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
        else:
            self.helper_action.handle_case(None, 'swap')
Exemplo n.º 24
0
    def r(self, num=1, num_str=''):
        """Replace the ch under the cursor with input."""
        cursor = self.get_cursor()
        pos_start = cursor.position()
        cursor.movePosition(QTextCursor.EndOfBlock)
        pos_block_end = cursor.position()
        if pos_block_end - pos_start < num:
            pos_end = pos_start
        else:
            pos_end = pos_start + num

        executor_sub = self.executor_sub_r
        executor_sub.pos_start = pos_start
        executor_sub.pos_end = pos_end

        self.set_parent_info_to_submode(executor_sub, num, num_str)

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
Exemplo n.º 25
0
 def colon(self, num=1, num_str=''):
     """Execute submode for ;."""
     self.vim_status.set_message("")
     return RETURN_EXECUTOR_METHOD_INFO(self.executor_colon, False)