Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12375

Modified Files:
        tmux.1 tmux.c 
Log Message:
PatchSet 790
Date: 2010/11/29 19:45:58
Author: nicm
Branch: HEAD
Tag: (none)
Log:
If VISUAL or EDITOR contains "vi", configure mode-keys and status-keys
to vi.

Based on a diff from martynas@, previously requested by a couple of
other people.

Members:
        tmux.1:1.190->1.191
        tmux.c:1.93->1.94



Index: tmux.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.c,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -d -r1.222 -r1.223
--- tmux.c      6 Dec 2010 21:53:00 -0000       1.222
+++ tmux.c      6 Dec 2010 21:59:42 -0000       1.223
@@ -234,13 +234,13 @@
        struct options  *oo, *so, *wo;
        struct keylist  *keylist;
        char            *s, *path, *label, *home, **var;
-       int              opt, flags, quiet = 0;
+       int              opt, flags, quiet, keys;
 
 #if defined(DEBUG) && defined(__OpenBSD__)
        malloc_options = (char *) "AFGJPX";
 #endif
 
-       flags = 0;
+       quiet = flags = 0;
        label = path = NULL;
        login_shell = (**argv == '-');
        while ((opt = getopt(argc, argv, "28c:df:lL:qS:uUv")) != -1) {
@@ -362,7 +362,6 @@
        options_set_number(so, "status-fg", 0);
        options_set_number(so, "status-interval", 15);
        options_set_number(so, "status-justify", 0);
-       options_set_number(so, "status-keys", MODEKEY_EMACS);
        options_set_string(so, "status-left", "[#S]");
        options_set_number(so, "status-left-attr", 0);
        options_set_number(so, "status-left-bg", 8);
@@ -403,7 +402,6 @@
        options_set_number(wo, "mode-attr", 0);
        options_set_number(wo, "mode-bg", 3);
        options_set_number(wo, "mode-fg", 0);
-       options_set_number(wo, "mode-keys", MODEKEY_EMACS);
        options_set_number(wo, "mode-mouse", 0);
        options_set_number(wo, "monitor-activity", 0);
        options_set_string(wo, "monitor-content", "%s", "");
@@ -431,6 +429,16 @@
                options_set_number(wo, "utf8", 0);
        }
 
+       keys = MODEKEY_EMACS;
+       if ((s = getenv("VISUAL")) != NULL || (s = getenv("EDITOR")) != NULL) {
+               if (strrchr(s, '/') != NULL)
+                       s = strrchr(s, '/') + 1;
+               if (strstr(s, "vi") != NULL)
+                       keys = MODEKEY_VI;
+       }
+       options_set_number(so, "status-keys", keys);
+       options_set_number(wo, "mode-keys", keys);
+
        /* Locate the configuration file. */
        if (cfg_file == NULL) {
                home = getenv("HOME");

Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.272
retrieving revision 1.273
diff -u -d -r1.272 -r1.273
--- tmux.1      6 Dec 2010 21:55:42 -0000       1.272
+++ tmux.1      6 Dec 2010 21:59:42 -0000       1.273
@@ -14,7 +14,7 @@
 .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: November 14 2010 $
+.Dd $Mdocdate: November 29 2010 $
 .Dt TMUX 1
 .Os
 .Sh NAME
@@ -1852,7 +1852,12 @@
 .Xc
 Use vi or emacs-style
 key bindings in the status line, for example at the command prompt.
-Defaults to emacs.
+The default is emacs, unless the
+.Ev VISUAL
+or
+.Ev EDITOR
+environment variables are set and contain the string
+.Ql vi .
 .It Ic status-left Ar string
 Display
 .Ar string
@@ -2140,7 +2145,14 @@
 .Op Ic vi | emacs
 .Xc
 Use vi or emacs-style key bindings in copy and choice modes.
-Key bindings default to emacs.
+As with the
+.Ic status-keys
+option, the default is emacs, unless
+.Ev VISUAL
+or
+.Ev EDITOR
+contains
+.Ql vi .
 .Pp
 .It Xo Ic mode-mouse
 .Op Ic on | off


------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to