Hi,

More patches :) . These add options for different message-{bg,fg,attr}
colours when in command mode versus insert mode. They just have '-cmd'
appended to the message name and the defaults are the inverse of the
standard colours. Also updates vim syntax for them.

--Ben
From b0e3ea4777aa7b24d67b9749a9ae868ae0c968bd Mon Sep 17 00:00:00 2001
From: Ben Boeckel <maths...@gmail.com>
Date: Thu, 20 Oct 2011 17:23:39 -0400
Subject: [PATCH 1/2] Options for changing colours in cmd vs ins modes

There's currently no indication that you're in command or insert mode
when using vi bindings for the command prompt. Add options for different
colours. The defaults for command mode are inverted from insert mode by
default.
---
 trunk/options-table.c |   15 +++++++++++++++
 trunk/status.c        |   18 +++++++++++++++---
 trunk/tmux.1          |    6 ++++++
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/trunk/options-table.c b/trunk/options-table.c
index 0832117..56f4a23 100644
--- a/trunk/options-table.c
+++ b/trunk/options-table.c
@@ -188,16 +188,31 @@ const struct options_table_entry session_options_table[] 
= {
          .default_num = 0
        },
 
+       { .name = "message-attr-cmd",
+         .type = OPTIONS_TABLE_ATTRIBUTES,
+         .default_num = 0
+       },
+
        { .name = "message-bg",
          .type = OPTIONS_TABLE_COLOUR,
          .default_num = 3
        },
 
+       { .name = "message-bg-cmd",
+         .type = OPTIONS_TABLE_COLOUR,
+         .default_num = 0
+       },
+
        { .name = "message-fg",
          .type = OPTIONS_TABLE_COLOUR,
          .default_num = 0
        },
 
+       { .name = "message-fg-cmd",
+         .type = OPTIONS_TABLE_COLOUR,
+         .default_num = 3
+       },
+
        { .name = "message-limit",
          .type = OPTIONS_TABLE_NUMBER,
          .minimum = 0,
diff --git a/trunk/status.c b/trunk/status.c
index 1baab92..637b59a 100644
--- a/trunk/status.c
+++ b/trunk/status.c
@@ -919,9 +919,16 @@ status_prompt_redraw(struct client *c)
        off = 0;
 
        memcpy(&gc, &grid_default_cell, sizeof gc);
-       colour_set_fg(&gc, options_get_number(&s->options, "message-fg"));
-       colour_set_bg(&gc, options_get_number(&s->options, "message-bg"));
-       gc.attr |= options_get_number(&s->options, "message-attr");
+       /* Change colours for ins versus cmd mode. */
+       if (c->prompt_mdata.mode == 1) {
+               colour_set_fg(&gc, options_get_number(&s->options, 
"message-fg-cmd"));
+               colour_set_bg(&gc, options_get_number(&s->options, 
"message-bg-cmd"));
+               gc.attr |= options_get_number(&s->options, "message-attr-cmd");
+       } else {
+               colour_set_fg(&gc, options_get_number(&s->options, 
"message-fg"));
+               colour_set_bg(&gc, options_get_number(&s->options, 
"message-bg"));
+               gc.attr |= options_get_number(&s->options, "message-attr");
+       }
 
        screen_write_start(&ctx, NULL, &c->status);
 
@@ -977,7 +984,12 @@ status_prompt_key(struct client *c, int key)
                        c->flags |= CLIENT_STATUS;
                }
                break;
+       case MODEKEYEDIT_SWITCHMODE:
+               c->flags |= CLIENT_STATUS;
+               break;
        case MODEKEYEDIT_SWITCHMODEAPPEND:
+               c->flags |= CLIENT_STATUS;
+               /* FALLTHROUGH */
        case MODEKEYEDIT_CURSORRIGHT:
                if (c->prompt_index < size) {
                        c->prompt_index++;
diff --git a/trunk/tmux.1 b/trunk/tmux.1
index f56cf8d..a4e3d38 100644
--- a/trunk/tmux.1
+++ b/trunk/tmux.1
@@ -1943,6 +1943,8 @@ or a comma-delimited list of one or more of:
 .Ic hidden ,
 or
 .Ic italics .
+.It Ic message-attr-cmd Ar attributes
+Set status line message attributes when in 'command' mode.
 .It Ic message-bg Ar colour
 Set status line message background colour, where
 .Ar colour
@@ -1963,8 +1965,12 @@ from the 256-colour set,
 or a hexadecimal RGB string such as
 .Ql #ffffff ,
 which chooses the closest match from the default 256-colour set.
+.It Ic message-bg-cmd Ar colour
+Set status line message background colour when in 'command' mode.
 .It Ic message-fg Ar colour
 Set status line message foreground colour.
+.It Ic message-fg-cmd Ar colour
+Set status line message foreground colour when in 'command' mode.
 .It Ic message-limit Ar number
 Set the number of error or information messages to save in the message log for
 each client.
-- 
1.7.6.4

From 51eb86de879fa52dca380c3920f1007d6d0b2464 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <maths...@gmail.com>
Date: Thu, 20 Oct 2011 17:27:19 -0400
Subject: [PATCH 2/2] Add command colour options to vim highlighting

---
 trunk/examples/tmux.vim |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/trunk/examples/tmux.vim b/trunk/examples/tmux.vim
index d21c377..3672735 100644
--- a/trunk/examples/tmux.vim
+++ b/trunk/examples/tmux.vim
@@ -47,11 +47,11 @@ syn keyword tmuxCmds capture-pane joinp join-pane 
choose-buffer
 syn keyword tmuxOptsSet prefix status status-fg status-bg bell-action
 syn keyword tmuxOptsSet default-command history-limit status-left status-right
 syn keyword tmuxOptsSet status-interval set-titles display-time buffer-limit
-syn keyword tmuxOptsSet status-left-length status-right-length message-fg
-syn keyword tmuxOptsSet message-bg lock-after-time default-path repeat-time
-syn keyword tmuxOptsSet message-attr status-attr status-keys set-remain-on-exit
+syn keyword tmuxOptsSet status-left-length status-right-length message-fg[-cmd]
+syn keyword tmuxOptsSet message-bg[-cmd] lock-after-time default-path 
repeat-time
+syn keyword tmuxOptsSet message-attr[-cmd] status-attr set-remain-on-exit
 syn keyword tmuxOptsSet status-utf8 default-terminal visual-activity
-syn keyword tmuxOptsSet visual-bell visual-content status-justify
+syn keyword tmuxOptsSet visual-bell visual-content status-justify status-keys
 syn keyword tmuxOptsSet terminal-overrides status-left-attr status-left-bg
 syn keyword tmuxOptsSet status-left-fg status-right-attr status-right-bg
 syn keyword tmuxOptsSet status-right-fg update-environment base-index
@@ -72,7 +72,7 @@ syn keyword tmuxOptsSetw main-pane-width main-pane-height 
monitor-content
 syn keyword tmuxOptsSetw window-status-current-attr window-status-current-bg
 syn keyword tmuxOptsSetw window-status-current-fg mode-mouse synchronize-panes
 syn keyword tmuxOptsSetw window-status-format window-status-current-format
-syn keyword tmuxOptsSetw word-separators window-status-alert-alert
+syn keyword tmuxOptsSetw word-separators window-status-alert-alert[-attr]
 syn keyword tmuxOptsSetw window-status-alert-bg window-status-alert-fg
 
 syn keyword tmuxTodo FIXME NOTE TODO XXX contained
-- 
1.7.6.4

Attachment: pgpK0g0vikqox.pgp
Description: PGP signature

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to