If you want to send a string "C-a" to a pane, you have to do

  send-keys C - a

...or something similar; but certainly not "C-a", because that would be
looked up as a key name. While scripting, you probably don't want to
bother whether or not a string also names a key or not.

This adds a flag, that forces a given string to be send to a pane
literally (hence `-l'):

  send-keys -l C-a

Signed-off-by: Frank Terbeck <f...@bewatermyfriend.org>
---
 cmd-send-keys.c |    7 ++++---
 tmux.1          |    6 ++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 3403741..9e6dfe5 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -31,8 +31,8 @@ int   cmd_send_keys_exec(struct cmd *, struct cmd_ctx *);
 
 const struct cmd_entry cmd_send_keys_entry = {
        "send-keys", "send",
-       "Rt:", 0, -1,
-       "[-R] [-t target-pane] key ...",
+       "Rlt:", 0, -1,
+       "[-Rl] [-t target-pane] key ...",
        0,
        NULL,
        NULL,
@@ -71,7 +71,8 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
        for (i = 0; i < args->argc; i++) {
                str = args->argv[i];
 
-               if ((key = key_string_lookup_string(str)) != KEYC_NONE) {
+               if (!args_has(args, 'l') &&
+                   (key = key_string_lookup_string(str)) != KEYC_NONE) {
                            window_pane_key(wp, s, key);
                } else {
                        for (; *str != '\0'; str++)
diff --git a/tmux.1 b/tmux.1
index 295f021..0092196 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1639,7 +1639,7 @@ are listed; this may be one of:
 or
 .Em emacs-copy .
 .It Xo Ic send-keys
-.Fl R
+.Op Fl Rl
 .Op Fl t Ar target-pane
 .Ar key Ar ...
 .Xc
@@ -1652,7 +1652,9 @@ is the name of the key (such as
 or
 .Ql npage
 ) to send; if the string is not recognised as a key, it is sent as a series of
-characters.
+characters. The
+.Fl l
+flag disables any key name lookups and forces a string to be send literally.
 All arguments are sent sequentially from first to last.
 The
 .Fl R
-- 
1.7.8.rc3.17.gf56ef1


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to