Example #1
0
def is_processing_notation(view) -> bool:
    # Indicate whether _nv_process_notation is running.
    #
    # Indicates whether _nv_process_notation is running a command and is
    # grouping all edits in one single undo step. That is, we are running a non-
    # interactive sequence of commands.
    #
    # This property is *VOLATILE*; it shouldn't be persisted between sessions.
    return get_session_view_value(view, 'processing_notation', False)
Example #2
0
def _create_definition(view, name: str):
    cmd = get_session_view_value(view, name)
    if cmd:
        cls = getattr(cmd_defs, cmd['name'], None)

        if cls is None:
            cls = plugin.classes.get(cmd['name'], None)

        if cls is None:
            ValueError('unknown %s: %s' % (name, cmd))

        return cls.from_json(cmd['data'])
Example #3
0
def get_action_count(view) -> str:
    return get_session_view_value(view, 'action_count', '')
Example #4
0
def get_glue_until_normal_mode(view) -> bool:
    # Indicate that editing commands should be grouped together. They should be
    # grouped together in a single undo step after the user requested
    # `_enter_normal_mode` next. This property is *VOLATILE*; it shouldn't be
    # persisted between sessions.
    return get_session_view_value(view, 'glue_until_normal_mode', False)
Example #5
0
def get_sequence(view) -> str:
    return get_session_view_value(view, 'sequence', '')
Example #6
0
def get_repeat_data(view):
    return get_session_view_value(view, 'repeat_data')
Example #7
0
def is_must_capture_register_name(view) -> bool:
    return get_session_view_value(view, 'must_capture_register_name', False)
Example #8
0
def get_xpos(view) -> int:
    return get_session_view_value(view, 'xpos', 0)
Example #9
0
def get_register(view) -> str:
    return get_session_view_value(view, 'register', '"')
Example #10
0
def get_partial_sequence(view) -> str:
    # Sometimes we need to store a partial sequence to obtain the commands' full
    # name. Such is the case of `gD`, for example.
    return get_session_view_value(view, 'partial_sequence', '')
Example #11
0
def is_interactive(view) -> bool:
    # See set_interactive().
    return get_session_view_value(view, 'interactive', True)
Example #12
0
def get_normal_insert_count(view) -> int:
    # Count issued to 'i' or 'a', etc. These commands enter insert mode. If
    # passed a count, they must repeat the commands run while in insert mode.
    return int(get_session_view_value(view, 'normal_insert_count', 1))
Example #13
0
def get_mode(view) -> str:
    # State of current mode. It isn't guaranteed that the underlying view's
    # .sel() will be in a consistent state (for example, that it will at least
    # have one non- empty region in visual mode.
    return get_session_view_value(view, 'mode', UNKNOWN)