Python prompt_toolkit.key_binding.vi_state.InputMode.INSERT_MULTIPLE Examples

The following are 5 code examples of prompt_toolkit.key_binding.vi_state.InputMode.INSERT_MULTIPLE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module prompt_toolkit.key_binding.vi_state.InputMode , or try the search function .
Example #1
Source File: pgtoolbar.py    From pgcli with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _get_vi_mode():
    return {
        InputMode.INSERT: "I",
        InputMode.NAVIGATION: "N",
        InputMode.REPLACE: "R",
        InputMode.INSERT_MULTIPLE: "M",
    }[get_app().vi_state.input_mode] 
Example #2
Source File: clitoolbar.py    From litecli with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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] 
Example #3
Source File: clitoolbar.py    From athenacli with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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] 
Example #4
Source File: mssqltoolbar.py    From mssql-cli with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _get_vi_mode():
    return {
        InputMode.INSERT: 'I',
        InputMode.NAVIGATION: 'N',
        InputMode.REPLACE: 'R',
        InputMode.INSERT_MULTIPLE: 'M',
    }[get_app().vi_state.input_mode] 
Example #5
Source File: layout.py    From pyvim with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
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')