aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-11 10:24:01 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-11 10:24:01 +0200
commit514b6e1ddf2b086378cc689bb87765d259ac9732 (patch)
tree4116e2f4ec397a117ac81a88aa6f013e861f4ea9 /vis.c
parente324e6975367c235ed5413f76fdc3d5189cd00a2 (diff)
downloadvis-514b6e1ddf2b086378cc689bb87765d259ac9732.tar.gz
vis-514b6e1ddf2b086378cc689bb87765d259ac9732.tar.xz
Add/cleanup window commands Ctrl-{n,s,q}
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c20
1 files changed, 16 insertions, 4 deletions
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) {