aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--config.def.h2
-rw-r--r--vis.c13
3 files changed, 17 insertions, 0 deletions
diff --git a/README b/README
index 00f75a2..ae1e7de 100644
--- a/README
+++ b/README
@@ -429,6 +429,8 @@ and their current support in vis.
:read insert content of another file at current cursor position
:split split window horizontally
:vsplit split window vertically
+ :new open an empty window, arrange horizontally
+ :vnew open an empty window, arrange vertically
:wq write changes then close window
:write write current buffer content to file
:saveas save file under another name
diff --git a/config.def.h b/config.def.h
index 68550b3..faa7e06 100644
--- a/config.def.h
+++ b/config.def.h
@@ -49,6 +49,7 @@ enum {
static Command cmds[] = {
{ "^[0-9]+$", cmd_gotoline, false },
{ "^e(dit)?!?$", cmd_edit, false },
+ { "^new$", cmd_new, false },
{ "^o(pen)?$", cmd_open, false },
{ "^qa(ll)?!?$", cmd_qall, false },
{ "^q(quit)?!?$", cmd_quit, false },
@@ -57,6 +58,7 @@ static Command cmds[] = {
{ "^set$", cmd_set, true },
{ "^sp(lit)?$", cmd_split, false },
{ "^s(ubstitute)?$", cmd_substitute, false },
+ { "^vnew?$", cmd_vnew, false },
{ "^v(split)?$", cmd_vsplit, false },
{ "^wq!?$", cmd_wq, false },
{ "^w(rite)?$", cmd_write, false },
diff --git a/vis.c b/vis.c
index e8bd9d9..4d15fdb 100644
--- a/vis.c
+++ b/vis.c
@@ -454,6 +454,9 @@ static bool cmd_split(const char *argv[]);
/* if no argument are given, split the current window vertically,
* otherwise open the file */
static bool cmd_vsplit(const char *argv[]);
+/* create a new empty window and arrange all windows either horizontally or vertically */
+static bool cmd_new(const char *argv[]);
+static bool cmd_vnew(const char *argv[]);
/* save the file displayed in the current window and close it */
static bool cmd_wq(const char *argv[]);
/* save the file displayed in the current window to the name given.
@@ -1254,6 +1257,16 @@ static bool cmd_vsplit(const char *argv[]) {
return openfiles(&argv[1]);
}
+static bool cmd_new(const char *argv[]) {
+ editor_windows_arrange_horizontal(vis);
+ return editor_window_new(vis, NULL);
+}
+
+static bool cmd_vnew(const char *argv[]) {
+ editor_windows_arrange_vertical(vis);
+ return editor_window_new(vis, NULL);
+}
+
static bool cmd_wq(const char *argv[]) {
if (cmd_write(argv))
return cmd_quit(argv);