aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h4
-rw-r--r--vis.c20
2 files changed, 19 insertions, 5 deletions
diff --git a/config.def.h b/config.def.h
index 7b99cf5..e8247ff 100644
--- a/config.def.h
+++ b/config.def.h
@@ -333,7 +333,9 @@ static KeyBinding vis_marks_set[] = {
};
static KeyBinding vis_normal[] = {
- { { CONTROL('w'), NONE('s') }, split, { NULL } },
+ { { CONTROL('w'), NONE('n') }, winnew, { .s = NULL } },
+ { { CONTROL('w'), NONE('q') }, winclose, { .s = NULL } },
+ { { CONTROL('w'), NONE('s') }, winsplit, { .b = false } },
{ { CONTROL('w'), NONE('j') }, call, { .f = editor_window_next } },
{ { CONTROL('w'), NONE('k') }, call, { .f = editor_window_prev } },
{ { CONTROL('F') }, cursor, { .m = window_page_up } },
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) {