@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case BACKWARD_CHAR: return EditorAction.DELETE_PREV_CHAR.then(VI_MOVE); case FORWARD_CHAR: return EditorAction.DELETE_NEXT_CHAR.then(VI_MOVE); case END_OF_LINE: return EditorAction.DELETE_END.then(VI_MOVE); case VI_NEXT_WORD: return EditorAction.DELETE_UNTIL_NEXT_WORD.then(VI_MOVE); case VI_DELETE_TO: return EditorAction.DELETE_LINE.then(VI_MOVE); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return VI_MOVE; } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case BACKWARD_CHAR: return EditorAction.DELETE_PREV_CHAR.then(VI_INSERT); case END_OF_LINE: return EMACS.then(EditorAction.DELETE_END).then(VI_INSERT); case VI_NEXT_WORD: return EditorAction.DELETE_NEXT_WORD.then(VI_INSERT); case VI_CHANGE_TO: return EditorAction.DELETE_LINE.then(VI_INSERT); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return VI_MOVE; } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case VI_YANK_TO: return EditorAction.COPY.then(VI_MOVE); case END_OF_LINE: return COPY_END_OF_LINE.then(VI_MOVE); case VI_BEGNNING_OF_LINE_OR_ARG_DIGIT: return COPY_BEGINNING_OF_LINE.then(VI_MOVE); case VI_NEXT_WORD: return EditorAction.COPY_NEXT_WORD.then(VI_MOVE); case VI_FIRST_PRINT: return EditorAction.COPY_PREV_WORD.then(VI_MOVE); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return super.on(keyStroke); } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case VI_MOVEMENT_MODE: // ESC return VI_MOVE; case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return new EditorAction.ChangeChars(count, keyStroke.sequence[0]).then(VI_MOVE); } }
return VI_INSERT; case VI_INSERT_BEG: return EditorAction.MOVE_BEGINNING.then(VI_INSERT); case VI_INSERT_COMMENT: return EditorAction.INSERT_COMMENT; return EditorAction.MOVE_PREV_WORD_AT_BEGINNING; case VI_CHANGE_TO_EOL: return EMACS.then(EditorAction.DELETE_END).then(VI_INSERT); case VI_CHANGE_TO: return CHANGE_TO; return EMACS.then(EditorAction.RIGHT).then(VI_INSERT); case VI_BEGNNING_OF_LINE_OR_ARG_DIGIT: return EditorAction.MOVE_BEGINNING; return EditorAction.CHANGE_CASE; case VI_KILL_WHOLE_LINE: return EditorAction.DELETE_LINE.then(VI_INSERT); case VI_PUT: return EditorAction.PASTE_AFTER;
case BACKWARD_CHAR: if (to == null) { return EditorAction.LEFT.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_PREV_CHAR.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_PREV_CHAR.repeat(count).then(VI_INSERT); } else if (to == 'y') { return EditorAction.RIGHT.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_NEXT_CHAR.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_NEXT_CHAR.repeat(count).then(VI_INSERT); } else if (to == 'y') { throw new UnsupportedOperationException("Not yet handled"); return EditorAction.MOVE_NEXT_WORD_AT_BEGINNING.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_UNTIL_NEXT_WORD.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_NEXT_WORD.repeat(count).then(VI_INSERT); } else { return super.on(keyStroke); return EditorAction.MOVE_PREV_WORD_AT_END.repeat(count).then(VI_MOVE); } else { super.on(keyStroke);
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case BACKWARD_CHAR: return EditorAction.DELETE_PREV_CHAR.then(VI_MOVE); case FORWARD_CHAR: return EditorAction.DELETE_NEXT_CHAR.then(VI_MOVE); case END_OF_LINE: return EditorAction.DELETE_END.then(VI_MOVE); case VI_NEXT_WORD: return EditorAction.DELETE_UNTIL_NEXT_WORD.then(VI_MOVE); case VI_DELETE_TO: return EditorAction.DELETE_LINE.then(VI_MOVE); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return VI_MOVE; } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case BACKWARD_CHAR: return EditorAction.DELETE_PREV_CHAR.then(VI_MOVE); case FORWARD_CHAR: return EditorAction.DELETE_NEXT_CHAR.then(VI_MOVE); case END_OF_LINE: return EditorAction.DELETE_END.then(VI_MOVE); case VI_NEXT_WORD: return EditorAction.DELETE_UNTIL_NEXT_WORD.then(VI_MOVE); case VI_DELETE_TO: return EditorAction.DELETE_LINE.then(VI_MOVE); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return VI_MOVE; } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case BACKWARD_CHAR: return EditorAction.DELETE_PREV_CHAR.then(VI_INSERT); case END_OF_LINE: return EMACS.then(EditorAction.DELETE_END).then(VI_INSERT); case VI_NEXT_WORD: return EditorAction.DELETE_NEXT_WORD.then(VI_INSERT); case VI_CHANGE_TO: return EditorAction.DELETE_LINE.then(VI_INSERT); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return VI_MOVE; } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case VI_YANK_TO: return EditorAction.COPY.then(VI_MOVE); case END_OF_LINE: return COPY_END_OF_LINE.then(VI_MOVE); case VI_BEGINNING_OF_LINE_OR_ARG_DIGIT: return COPY_BEGINNING_OF_LINE.then(VI_MOVE); case VI_NEXT_WORD: return EditorAction.COPY_NEXT_WORD.then(VI_MOVE); case VI_FIRST_PRINT: return EditorAction.COPY_PREV_WORD.then(VI_MOVE); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return super.on(keyStroke); } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case VI_YANK_TO: return EditorAction.COPY.then(VI_MOVE); case END_OF_LINE: return COPY_END_OF_LINE.then(VI_MOVE); case VI_BEGNNING_OF_LINE_OR_ARG_DIGIT: return COPY_BEGINNING_OF_LINE.then(VI_MOVE); case VI_NEXT_WORD: return EditorAction.COPY_NEXT_WORD.then(VI_MOVE); case VI_FIRST_PRINT: return EditorAction.COPY_PREV_WORD.then(VI_MOVE); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return super.on(keyStroke); } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case BACKWARD_CHAR: return EditorAction.DELETE_PREV_CHAR.then(VI_INSERT); case END_OF_LINE: return EMACS.then(EditorAction.DELETE_END).then(VI_INSERT); case VI_NEXT_WORD: return EditorAction.DELETE_NEXT_WORD.then(VI_INSERT); case VI_CHANGE_TO: return EditorAction.DELETE_LINE.then(VI_INSERT); case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return VI_MOVE; } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case VI_MOVEMENT_MODE: // ESC return VI_MOVE; case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return new EditorAction.ChangeChars(count, keyStroke.sequence[0]).then(VI_MOVE); } }
@Override public EditorAction on(KeyStroke keyStroke) { switch (keyStroke.operation) { case VI_MOVEMENT_MODE: // ESC return VI_MOVE; case INTERRUPT: return EditorAction.INTERRUPT.then(VI_MOVE); default: return new EditorAction.ChangeChars(count, keyStroke.sequence[0]).then(VI_MOVE); } }
return VI_INSERT; case VI_INSERT_BEG: return EditorAction.MOVE_BEGINNING.then(VI_INSERT); case VI_INSERT_COMMENT: return EditorAction.INSERT_COMMENT; return EditorAction.MOVE_PREV_WORD_AT_BEGINNING; case VI_CHANGE_TO_EOL: return EMACS.then(EditorAction.DELETE_END).then(VI_INSERT); case VI_CHANGE_TO: return CHANGE_TO; return EMACS.then(EditorAction.RIGHT).then(VI_INSERT); case VI_BEGINNING_OF_LINE_OR_ARG_DIGIT: return EditorAction.MOVE_BEGINNING; return EditorAction.CHANGE_CASE; case VI_KILL_WHOLE_LINE: return EditorAction.DELETE_LINE.then(VI_INSERT); case VI_PUT: return EditorAction.PASTE_AFTER;
return VI_INSERT; case VI_INSERT_BEG: return EditorAction.MOVE_BEGINNING.then(VI_INSERT); case VI_INSERT_COMMENT: return EditorAction.INSERT_COMMENT; return EditorAction.MOVE_PREV_WORD_AT_BEGINNING; case VI_CHANGE_TO_EOL: return EMACS.then(EditorAction.DELETE_END).then(VI_INSERT); case VI_CHANGE_TO: return CHANGE_TO; return EMACS.then(EditorAction.RIGHT).then(VI_INSERT); case VI_BEGNNING_OF_LINE_OR_ARG_DIGIT: return EditorAction.MOVE_BEGINNING; return EditorAction.CHANGE_CASE; case VI_KILL_WHOLE_LINE: return EditorAction.DELETE_LINE.then(VI_INSERT); case VI_PUT: return EditorAction.PASTE_AFTER;
case BACKWARD_CHAR: if (to == null) { return EditorAction.LEFT.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_PREV_CHAR.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_PREV_CHAR.repeat(count).then(VI_INSERT); } else if (to == 'y') { return EditorAction.RIGHT.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_NEXT_CHAR.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_NEXT_CHAR.repeat(count).then(VI_INSERT); } else if (to == 'y') { throw new UnsupportedOperationException("Not yet handled"); return EditorAction.MOVE_NEXT_WORD_AT_BEGINNING.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_UNTIL_NEXT_WORD.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_NEXT_WORD.repeat(count).then(VI_INSERT); } else { return super.on(keyStroke); return EditorAction.MOVE_PREV_WORD_AT_END.repeat(count).then(VI_MOVE); } else { super.on(keyStroke);
case BACKWARD_CHAR: if (to == null) { return EditorAction.LEFT.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_PREV_CHAR.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_PREV_CHAR.repeat(count).then(VI_INSERT); } else if (to == 'y') { return EditorAction.RIGHT.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_NEXT_CHAR.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_NEXT_CHAR.repeat(count).then(VI_INSERT); } else if (to == 'y') { throw new UnsupportedOperationException("Not yet handled"); return EditorAction.MOVE_NEXT_WORD_AT_BEGINNING.repeat(count).then(VI_MOVE); } else if (to == 'd') { return EditorAction.DELETE_UNTIL_NEXT_WORD.repeat(count).then(VI_MOVE); } else if (to == 'c') { return EditorAction.DELETE_NEXT_WORD.repeat(count).then(VI_INSERT); } else { return super.on(keyStroke); return EditorAction.MOVE_PREV_WORD_AT_END.repeat(count).then(VI_MOVE); } else { super.on(keyStroke);