From 514b6e1ddf2b086378cc689bb87765d259ac9732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 11 Sep 2014 10:24:01 +0200 Subject: Add/cleanup window commands Ctrl-{n,s,q} --- vis.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 8439856..da8d37c 100644 --- a/vis.c +++ b/vis.c @@ -317,8 +317,12 @@ static void insert_newline(const Arg *arg); static void openline(const Arg *arg); /* join the line where the cursor currently is with the one above or below */ static void joinline(const Arg *arg); +/* create a new window with the filename arg->s */ +static void winnew(const Arg *arg); +/* close currently focused window except if there are unsafed changes */ +static void winclose(const Arg *arg); /* split current window horizontally (default) or vertically (if arg->b is set) */ -static void split(const Arg *arg); +static void winsplit(const Arg *arg); /* perform last action i.e. action_prev again */ static void repeat(const Arg *arg); /* replace character at cursor with one read form keyboard */ @@ -675,11 +679,19 @@ static void quit(const Arg *arg) { running = false; } -static void split(const Arg *arg) { +static void winnew(const Arg *arg) { + editor_window_new(vis, arg->s); +} + +static void winclose(const Arg *arg) { + cmd_quit((const char*[]){ "q", NULL }); +} + +static void winsplit(const Arg *arg) { if (arg->b) - editor_window_vsplit(vis, arg->s); + editor_window_vsplit(vis, NULL); else - editor_window_split(vis, arg->s); + editor_window_split(vis, NULL); } static void cursor(const Arg *arg) { -- cgit v1.2.3