当前位置: 首页>>代码示例>>Python>>正文


Python InputMode.REPLACE属性代码示例

本文整理汇总了Python中prompt_toolkit.key_binding.vi_state.InputMode.REPLACE属性的典型用法代码示例。如果您正苦于以下问题:Python InputMode.REPLACE属性的具体用法?Python InputMode.REPLACE怎么用?Python InputMode.REPLACE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在prompt_toolkit.key_binding.vi_state.InputMode的用法示例。


在下文中一共展示了InputMode.REPLACE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_vi_mode

# 需要导入模块: from prompt_toolkit.key_binding.vi_state import InputMode [as 别名]
# 或者: from prompt_toolkit.key_binding.vi_state.InputMode import REPLACE [as 别名]
def _get_vi_mode():
    return {
        InputMode.INSERT: "I",
        InputMode.NAVIGATION: "N",
        InputMode.REPLACE: "R",
        InputMode.INSERT_MULTIPLE: "M",
    }[get_app().vi_state.input_mode] 
开发者ID:dbcli,项目名称:pgcli,代码行数:9,代码来源:pgtoolbar.py

示例2: _get_vi_mode

# 需要导入模块: from prompt_toolkit.key_binding.vi_state import InputMode [as 别名]
# 或者: from prompt_toolkit.key_binding.vi_state.InputMode import REPLACE [as 别名]
def _get_vi_mode():
    """Get the current vi mode for display."""
    return {
        InputMode.INSERT: "I",
        InputMode.NAVIGATION: "N",
        InputMode.REPLACE: "R",
        InputMode.INSERT_MULTIPLE: "M",
    }[get_app().vi_state.input_mode] 
开发者ID:dbcli,项目名称:litecli,代码行数:10,代码来源:clitoolbar.py

示例3: _get_vi_mode

# 需要导入模块: from prompt_toolkit.key_binding.vi_state import InputMode [as 别名]
# 或者: from prompt_toolkit.key_binding.vi_state.InputMode import REPLACE [as 别名]
def _get_vi_mode():
    """Get the current vi mode for display."""
    return {
        InputMode.INSERT: 'I',
        InputMode.NAVIGATION: 'N',
        InputMode.REPLACE: 'R',
        InputMode.INSERT_MULTIPLE: 'M',
    }[get_app().vi_state.input_mode] 
开发者ID:dbcli,项目名称:athenacli,代码行数:10,代码来源:clitoolbar.py

示例4: _get_vi_mode

# 需要导入模块: from prompt_toolkit.key_binding.vi_state import InputMode [as 别名]
# 或者: from prompt_toolkit.key_binding.vi_state.InputMode import REPLACE [as 别名]
def _get_vi_mode():
    return {
        InputMode.INSERT: 'I',
        InputMode.NAVIGATION: 'N',
        InputMode.REPLACE: 'R',
        InputMode.INSERT_MULTIPLE: 'M',
    }[get_app().vi_state.input_mode] 
开发者ID:dbcli,项目名称:mssql-cli,代码行数:9,代码来源:mssqltoolbar.py

示例5: get_inputmode_fragments

# 需要导入模块: from prompt_toolkit.key_binding.vi_state import InputMode [as 别名]
# 或者: from prompt_toolkit.key_binding.vi_state.InputMode import REPLACE [as 别名]
def get_inputmode_fragments(python_input: "PythonInput") -> StyleAndTextTuples:
    """
    Return current input mode as a list of (token, text) tuples for use in a
    toolbar.
    """
    app = get_app()

    @if_mousedown
    def toggle_vi_mode(mouse_event: MouseEvent) -> None:
        python_input.vi_mode = not python_input.vi_mode

    token = "class:status-toolbar"
    input_mode_t = "class:status-toolbar.input-mode"

    mode = app.vi_state.input_mode
    result: StyleAndTextTuples = []
    append = result.append

    if python_input.title:
        result.extend(to_formatted_text(python_input.title))

    append((input_mode_t, "[F4] ", toggle_vi_mode))

    # InputMode
    if python_input.vi_mode:
        recording_register = app.vi_state.recording_register
        if recording_register:
            append((token, " "))
            append((token + " class:record", "RECORD({})".format(recording_register)))
            append((token, " - "))

        if app.current_buffer.selection_state is not None:
            if app.current_buffer.selection_state.type == SelectionType.LINES:
                append((input_mode_t, "Vi (VISUAL LINE)", toggle_vi_mode))
            elif app.current_buffer.selection_state.type == SelectionType.CHARACTERS:
                append((input_mode_t, "Vi (VISUAL)", toggle_vi_mode))
                append((token, " "))
            elif app.current_buffer.selection_state.type == SelectionType.BLOCK:
                append((input_mode_t, "Vi (VISUAL BLOCK)", toggle_vi_mode))
                append((token, " "))
        elif mode in (InputMode.INSERT, "vi-insert-multiple"):
            append((input_mode_t, "Vi (INSERT)", toggle_vi_mode))
            append((token, "  "))
        elif mode == InputMode.NAVIGATION:
            append((input_mode_t, "Vi (NAV)", toggle_vi_mode))
            append((token, "     "))
        elif mode == InputMode.REPLACE:
            append((input_mode_t, "Vi (REPLACE)", toggle_vi_mode))
            append((token, " "))
    else:
        if app.emacs_state.is_recording:
            append((token, " "))
            append((token + " class:record", "RECORD"))
            append((token, " - "))

        append((input_mode_t, "Emacs", toggle_vi_mode))
        append((token, " "))

    return result 
开发者ID:prompt-toolkit,项目名称:ptpython,代码行数:61,代码来源:layout.py

示例6: __init__

# 需要导入模块: from prompt_toolkit.key_binding.vi_state import InputMode [as 别名]
# 或者: from prompt_toolkit.key_binding.vi_state.InputMode import REPLACE [as 别名]
def __init__(self, editor, editor_buffer):
        def get_text():
            app = get_app()

            insert_mode = app.vi_state.input_mode in (InputMode.INSERT, InputMode.INSERT_MULTIPLE)
            replace_mode = app.vi_state.input_mode == InputMode.REPLACE
            sel = editor_buffer.buffer.selection_state
            temp_navigation = app.vi_state.temporary_navigation_mode
            visual_line = sel is not None and sel.type == SelectionType.LINES
            visual_block = sel is not None and sel.type == SelectionType.BLOCK
            visual_char = sel is not None and sel.type == SelectionType.CHARACTERS

            def mode():
                if get_app().layout.has_focus(editor_buffer.buffer):
                    if insert_mode:
                        if temp_navigation:
                            return ' -- (insert) --'
                        elif editor.paste_mode:
                            return ' -- INSERT (paste)--'
                        else:
                            return ' -- INSERT --'
                    elif replace_mode:
                        if temp_navigation:
                            return ' -- (replace) --'
                        else:
                            return ' -- REPLACE --'
                    elif visual_block:
                        return ' -- VISUAL BLOCK --'
                    elif visual_line:
                        return ' -- VISUAL LINE --'
                    elif visual_char:
                        return ' -- VISUAL --'
                return '                     '

            def recording():
                if app.vi_state.recording_register:
                    return 'recording '
                else:
                    return ''

            return ''.join([
                ' ',
                recording(),
                (editor_buffer.location or ''),
                (' [New File]' if editor_buffer.is_new else ''),
                ('*' if editor_buffer.has_unsaved_changes else ''),
                (' '),
                mode(),
            ])
        super(WindowStatusBar, self).__init__(
            get_text,
            style='class:toolbar.status') 
开发者ID:prompt-toolkit,项目名称:pyvim,代码行数:54,代码来源:layout.py


注:本文中的prompt_toolkit.key_binding.vi_state.InputMode.REPLACE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。