diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2010-12-06 21:59:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2010-12-06 21:59:42 +0000 |
commit | d0adcbc98a0261716c094c2e83c6d2eaa90a1c95 (patch) | |
tree | 20735b463951a04d8783b3e01c179f3486428290 /tmux.c | |
parent | e75187310d1d8f839de997ac3f074a7adc657276 (diff) | |
download | rtmux-d0adcbc98a0261716c094c2e83c6d2eaa90a1c95.tar.gz rtmux-d0adcbc98a0261716c094c2e83c6d2eaa90a1c95.tar.bz2 rtmux-d0adcbc98a0261716c094c2e83c6d2eaa90a1c95.zip |
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
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.222 2010-12-06 21:53:00 nicm Exp $ */ +/* $Id: tmux.c,v 1.223 2010-12-06 21:59:42 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -234,13 +234,13 @@ main(int argc, char **argv) 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 @@ main(int argc, char **argv) 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 @@ main(int argc, char **argv) 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 @@ main(int argc, char **argv) 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"); |