]> git.mdlowis.com Git - projs/tide.git/commitdiff
added Ctrl+Shift+o shortcut to open a new file in the current window
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 20 Jun 2017 17:58:56 +0000 (13:58 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 20 Jun 2017 17:58:56 +0000 (13:58 -0400)
docs/pick.1
docs/tide.1
docs/tide.1.md
lib/colors.c
tide.c

index e1c0c46e6d19d5d75fddc896ea6336b42a254ded..113159b8cf788fa0401e6d65c27adde408146eb9 100644 (file)
@@ -18,7 +18,7 @@ TODO: Document this
 .SH "ENVIRONMENT"
 .
 .TP
-\fBXPICKTITLE\fR
+\fBPICKTITLE\fR
 If this variable is set its contents are used to populate the status region of the \fBpick\fR window\.
 .
 .SH "AUTHOR"
index 2f06f0ed0e0386e1b3adad085a50bf9d1abc3705..ee5754874a66c4a3c79da770068036f6af45ca71 100644 (file)
@@ -1,7 +1,7 @@
 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "TIDE" "1" "May 2017" "" ""
+.TH "TIDE" "1" "June 2017" "" ""
 .
 .SH "NAME"
 \fBtide\fR \- a text editor inspired by acme(1) from Plan 9 and Inferno
@@ -274,7 +274,11 @@ Execute the selected text as described in \fBCOMMAND EXECUTION\fR\. If no text i
 .
 .TP
 \fBCtrl+o\fR
-Launch pickfile(1) to choose a file from a recursive list of files in the current deirectory and sub directories\. This file will be opened in a new instance of \fBtide\fR\.
+Launch pickfile(1) to choose a file from a recursive list of files in the current directory and sub directories\. This file will be opened in a new instance of \fBtide\fR\.
+.
+.TP
+\fBCtrl+Shift+o\fR
+Launch pickfile(1) to choose a file from a recursive list of files in the current directory and sub directories\. This file will be opened in the current instance of \fBtide\fR replacing the currently open file\. In the event that the current instance of \fBtide\fR has modifications, the file will be opened in a new instance\.
 .
 .TP
 \fBCtrl+p\fR
index c7c29680e0e151b03442c1ecce29dd2d160e509e..dc9006e481d1fde079861d85642dae24466fb3c3 100644 (file)
@@ -306,9 +306,16 @@ search operation to be applied in the opposite direction of the previous.
 
 * `Ctrl+o`:
     Launch pickfile(1) to choose a file from a recursive list of files in the
-    current deirectory and sub directories. This file will be opened in a
-    new instance of `tide`.
-
+    current directory and sub directories. This file will be opened in a new 
+    instance of `tide`.
+    
+* `Ctrl+Shift+o`:
+    Launch pickfile(1) to choose a file from a recursive list of files in the
+    current directory and sub directories. This file will be opened in the 
+    current instance of `tide` replacing the currently open file. In the event 
+    that the current instance of `tide` has modifications, the file will be 
+    opened in a new instance.
+    
 * `Ctrl+p`:
     Launch picktag(1) to select a tag from a ctags(1) generated index file.
     `tide` will jump to the selected ctag definition in the current window if
index ab5aaffefda8ae811edff1a3eeee9c2975bda3b6..ce63f45d93911a7338e131a95e0cef550badc172 100644 (file)
@@ -5,19 +5,6 @@
 static bool matches(Buf* buf, size_t* off, char* str);
 static SyntaxSpan* mkspan(size_t beg, size_t end, size_t clr, SyntaxSpan* span);
 
-enum {
-    /* standard colors */
-    Normal   = 4,
-    Comment  = 2,
-    Literal  = 14,
-
-    /* diff colors */
-    Added    = 15,
-    Deleted  = 10,
-    Location = 14,
-    Info     = 8,
-};
-
 static SyntaxDef Syntaxes[] = {
     { /* this is also the default syntax if no match is found */
         .name = "text",
diff --git a/tide.c b/tide.c
index de95bed11a97c4716f8064b83bbe284a4790977c..e7ab17401cf5357e61dac5a9bd18da3854f43a13 100644 (file)
--- a/tide.c
+++ b/tide.c
@@ -284,8 +284,9 @@ static void open_file(void) {
     char* file = cmdread(PickFileCmd, NULL);
     if (file) {
         file = chomp(file);
-        if (!win_buf(EDIT)->path && !win_buf(EDIT)->modified) {
-            buf_load(win_buf(EDIT), file);
+        if ((!win_buf(EDIT)->path || x11_keymodsset(ModShift)) && 
+            !win_buf(EDIT)->modified) {
+            view_init(win_view(EDIT), file, ondiagmsg);
         } else {
             OpenCmd[1] = file;
             cmdrun(OpenCmd, NULL);
@@ -490,7 +491,7 @@ static KeyBinding Bindings[] = {
     { ModCtrl,      'h',        highlight    },
     { ModOneOrMore, 'f',        search       },
     { ModCtrl,      'd',        execute      },
-    { ModCtrl,      'o',        open_file    },
+    { ModOneOrMore, 'o',        open_file    },
     { ModCtrl,      'p',        pick_ctag    },
     { ModOneOrMore, 'g',        goto_ctag    },
     { ModCtrl,      'n',        new_win      },