aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-10 21:02:28 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-10 21:28:59 +0200
commit457ce33d1ca3a23388b93dbfb4cb5dd429a6c0de (patch)
treee6730f53ebf2f063f6a112e176bf7d9d3106daf2 /vis.c
parent5c82b53dc43eed66276166d4224749bf11c21e7f (diff)
downloadvis-457ce33d1ca3a23388b93dbfb4cb5dd429a6c0de.tar.gz
vis-457ce33d1ca3a23388b93dbfb4cb5dd429a6c0de.tar.xz
Add normal mode commands 'O' and 'o'
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/vis.c b/vis.c
index a550433..f8efe88 100644
--- a/vis.c
+++ b/vis.c
@@ -313,6 +313,8 @@ static void insert(const Arg *arg);
static void insert_tab(const Arg *arg);
/* inserts a newline (either \n or \n\r depending on file type) */
static void insert_newline(const Arg *arg);
+/* add a new line either before or after the one where the cursor currently is */
+static void openline(const Arg *arg);
/* split current window horizontally (default) or vertically (if arg->b is set) */
static void split(const Arg *arg);
/* perform last action i.e. action_prev again */
@@ -697,6 +699,12 @@ static void insert_newline(const Arg *arg) {
insert(&(const Arg){ .s = "\n" });
}
+static void openline(const Arg *arg) {
+ movement(&(const Arg){ .i = arg->i == MOVE_LINE_NEXT ?
+ MOVE_LINE_END : MOVE_LINE_PREV });
+ insert_newline(NULL);
+}
+
static void switchmode(const Arg *arg) {
switchmode_to(&vis_modes[arg->i]);
}