diff --git a/plugins/vim-emulation/vim-emulation.vala b/plugins/vim-emulation/vim-emulation.vala index e6a6595abd..d3e9c0ffef 100644 --- a/plugins/vim-emulation/vim-emulation.vala +++ b/plugins/vim-emulation/vim-emulation.vala @@ -205,6 +205,31 @@ public class Scratch.Plugins.VimEmulation : Peas.ExtensionBase, Peas.Activatable view.move_cursor (Gtk.MovementStep.DISPLAY_LINE_ENDS, 1, false); debug ("Vim Emulation: INSERT Mode!"); break; + case Gdk.Key.o: + if (mode == Mode.INSERT) { + return false; + } + mode = Mode.INSERT; + debug ("Vim Emulation: INSERT Mode!"); + + view.move_cursor (Gtk.MovementStep.PARAGRAPH_ENDS, 1, false); + view.insert_at_cursor ("\n"); + break; + case Gdk.Key.O: + if (mode == Mode.INSERT) { + return false; + } + mode = Mode.INSERT; + debug ("Vim Emulation: INSERT Mode!"); + + // Move to start of current line + view.move_cursor (Gtk.MovementStep.PARAGRAPH_ENDS, -1, false); + view.move_cursor (Gtk.MovementStep.DISPLAY_LINE_ENDS, -1, false); + // Insert newline before current line + view.insert_at_cursor ("\n"); + // Move to beginning of the new line + view.move_cursor (Gtk.MovementStep.PARAGRAPHS, -1, false); + break; case 46: // Dot "." debug (action); view.insert_at_cursor (action);