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)
    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)
    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)
    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)
    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)
    def a(self, num=1, num_str=''):
        """Select block exclusively."""
        executor_sub = self.executor_sub_motion_a

        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)
    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)
    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(
            [FUNC_INFO(self.apply_motion_info_in_normal, True)])

        return RETURN_EXECUTOR_METHOD_INFO(executor_sub, True)
    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)
    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)
Exemple #11
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)
Exemple #12
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')
    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)
Exemple #14
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')