From: Michael D. Lowis Date: Tue, 20 Jun 2017 17:58:56 +0000 (-0400) Subject: added Ctrl+Shift+o shortcut to open a new file in the current window X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=94300e3a6078da3ef05749ecf462f38c58339003;p=projs%2Ftide.git added Ctrl+Shift+o shortcut to open a new file in the current window --- diff --git a/docs/pick.1 b/docs/pick.1 index e1c0c46..113159b 100644 --- a/docs/pick.1 +++ b/docs/pick.1 @@ -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" diff --git a/docs/tide.1 b/docs/tide.1 index 2f06f0e..ee57548 100644 --- a/docs/tide.1 +++ b/docs/tide.1 @@ -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 diff --git a/docs/tide.1.md b/docs/tide.1.md index c7c2968..dc9006e 100644 --- a/docs/tide.1.md +++ b/docs/tide.1.md @@ -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 diff --git a/lib/colors.c b/lib/colors.c index ab5aaff..ce63f45 100644 --- a/lib/colors.c +++ b/lib/colors.c @@ -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 de95bed..e7ab174 100644 --- 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 },