Applied, thanks!

On Sat, Mar 03, 2012 at 11:40:21PM -0500, Ben Boeckel wrote:
> Hi,
> 
> Attached is a patch which adds 'A' and 'I' bindings when editing the
> status line. Not sure of any emacs equivalents.
> 
> --Ben

> diff --git a/mode-key.c b/mode-key.c
> index f1df0a4..b82e9b9 100644
> --- a/mode-key.c
> +++ b/mode-key.c
> @@ -35,8 +35,9 @@
>   *
>   * vi command mode is handled by having a mode flag in the struct which 
> allows
>   * two sets of bindings to be swapped between. A couple of editing commands
> - * (MODEKEYEDIT_SWITCHMODE and MODEKEYEDIT_SWITCHMODEAPPEND) are 
> special-cased
> - * to do this.
> + * (MODEKEYEDIT_SWITCHMODE, MODEKEYEDIT_SWITCHMODEAPPEND,
> + * MODEKEYEDIT_SWITCHMODEAPPENDLINE, and MODEKEYEDIT_SWITCHMODEBEGINLINE)
> + * are special-cased to do this.
>   */
>  
>  /* Edit keys command strings. */
> @@ -64,6 +65,8 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
>       { MODEKEYEDIT_STARTOFLINE, "start-of-line" },
>       { MODEKEYEDIT_SWITCHMODE, "switch-mode" },
>       { MODEKEYEDIT_SWITCHMODEAPPEND, "switch-mode-append" },
> +     { MODEKEYEDIT_SWITCHMODEAPPENDLINE, "switch-mode-append-line" },
> +     { MODEKEYEDIT_SWITCHMODEBEGINLINE, "switch-mode-begin-line" },
>       { MODEKEYEDIT_TRANSPOSECHARS, "transpose-chars" },
>  
>       { 0, NULL }
> @@ -151,9 +154,11 @@ const struct mode_key_entry mode_key_vi_edit[] = {
>  
>       { '$',                  1, MODEKEYEDIT_ENDOFLINE },
>       { '0',                  1, MODEKEYEDIT_STARTOFLINE },
> +     { 'A',                  1, MODEKEYEDIT_SWITCHMODEAPPENDLINE },
>       { 'B',                  1, MODEKEYEDIT_PREVIOUSSPACE },
>       { 'D',                  1, MODEKEYEDIT_DELETETOENDOFLINE },
>       { 'E',                  1, MODEKEYEDIT_NEXTSPACEEND },
> +     { 'I',                  1, MODEKEYEDIT_SWITCHMODEBEGINLINE },
>       { 'W',                  1, MODEKEYEDIT_NEXTSPACE },
>       { 'X',                  1, MODEKEYEDIT_BACKSPACE },
>       { '\003' /* C-c */,     1, MODEKEYEDIT_CANCEL },
> @@ -496,6 +501,8 @@ mode_key_lookup(struct mode_key_data *mdata, int key)
>       switch (mbind->cmd) {
>       case MODEKEYEDIT_SWITCHMODE:
>       case MODEKEYEDIT_SWITCHMODEAPPEND:
> +     case MODEKEYEDIT_SWITCHMODEAPPENDLINE:
> +     case MODEKEYEDIT_SWITCHMODEBEGINLINE:
>               mdata->mode = 1 - mdata->mode;
>               /* FALLTHROUGH */
>       default:
> diff --git a/status.c b/status.c
> index 4df6745..e0cb48d 100644
> --- a/status.c
> +++ b/status.c
> @@ -1038,12 +1038,18 @@ status_prompt_key(struct client *c, int key)
>                       c->flags |= CLIENT_STATUS;
>               }
>               break;
> +     case MODEKEYEDIT_SWITCHMODEBEGINLINE:
> +             c->flags |= CLIENT_STATUS;
> +             /* FALLTHROUGH */
>       case MODEKEYEDIT_STARTOFLINE:
>               if (c->prompt_index != 0) {
>                       c->prompt_index = 0;
>                       c->flags |= CLIENT_STATUS;
>               }
>               break;
> +     case MODEKEYEDIT_SWITCHMODEAPPENDLINE:
> +             c->flags |= CLIENT_STATUS;
> +             /* FALLTHROUGH */
>       case MODEKEYEDIT_ENDOFLINE:
>               if (c->prompt_index != size) {
>                       c->prompt_index = size;
> diff --git a/tmux.h b/tmux.h
> index 4a24e88..1479185 100644
> --- a/tmux.h
> +++ b/tmux.h
> @@ -453,6 +453,8 @@ enum mode_key_cmd {
>       MODEKEYEDIT_STARTOFLINE,
>       MODEKEYEDIT_SWITCHMODE,
>       MODEKEYEDIT_SWITCHMODEAPPEND,
> +     MODEKEYEDIT_SWITCHMODEAPPENDLINE,
> +     MODEKEYEDIT_SWITCHMODEBEGINLINE,
>       MODEKEYEDIT_TRANSPOSECHARS,
>  
>       /* Menu (choice) keys. */

> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing 
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/

> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to