diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-24 16:48:10 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-24 16:48:10 +0200 |
| commit | ea787fd572c791447b02801e02c5f46099283a00 (patch) | |
| tree | 600ac70007f2496f4403f70a7b58749841216fbe | |
| parent | 41debbfd7649a347f5c49489ed4de536f9d62c78 (diff) | |
| download | vis-ea787fd572c791447b02801e02c5f46099283a00.tar.gz vis-ea787fd572c791447b02801e02c5f46099283a00.tar.xz | |
Implement :new and :vnew
| -rw-r--r-- | README | 2 | ||||
| -rw-r--r-- | config.def.h | 2 | ||||
| -rw-r--r-- | vis.c | 13 |
3 files changed, 17 insertions, 0 deletions
@@ -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 }, @@ -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); |
