aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-22 14:43:48 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-22 15:02:12 +0100
commite9f28e98dd09a444fe5ce8a149745e08f9d4228e (patch)
tree3099a19d7373cdbbf4580f6132b11ca249b399e8
parentb56bc7130e7158590c6e863adcb18fe9d46741b8 (diff)
downloadvis-e9f28e98dd09a444fe5ce8a149745e08f9d4228e.tar.gz
vis-e9f28e98dd09a444fe5ce8a149745e08f9d4228e.tar.xz
vis: add `:set escdelay nn` option
Make the delay used to distinguish between an <Escape> key and other terminal escape sequences such as for the Meta key run time configurable. The value is given in miliseconds and defaults to 50ms. Notice that terminal multiplexers like dvtm or tmux might also induce some delay which has to be configured independently.
-rw-r--r--README.md5
-rw-r--r--sam.c6
-rw-r--r--vis-cmds.c6
3 files changed, 17 insertions, 0 deletions
diff --git a/README.md b/README.md
index f8d7a99..1bdbe6c 100644
--- a/README.md
+++ b/README.md
@@ -412,6 +412,11 @@ Operators can be forced to work line wise by specifying `V`.
set shell to use for external commands (e.g. <, >, |)
+ escdelay number default 50 (50ms)
+
+ miliseconds to wait to distinguish between an <Escape> key and other
+ terminal escape sequences
+
tabwidth [1-8] default 8
set display width of a tab and number of spaces to use if
diff --git a/sam.c b/sam.c
index 1f2e061..93c41c2 100644
--- a/sam.c
+++ b/sam.c
@@ -281,6 +281,7 @@ typedef struct {
enum {
OPTION_SHELL,
+ OPTION_ESCDELAY,
OPTION_AUTOINDENT,
OPTION_EXPANDTAB,
OPTION_TABWIDTH,
@@ -302,6 +303,11 @@ static const OptionDef options[] = {
OPTION_TYPE_STRING, OPTION_FLAG_NONE,
"Shell to use for external commands (default: $SHELL, /etc/passwd, /bin/sh)",
},
+ [OPTION_ESCDELAY] = {
+ { "escdelay" },
+ OPTION_TYPE_NUMBER, OPTION_FLAG_NONE,
+ "Miliseconds to wait to distinguish <Escape> from terminal escape sequences",
+ },
[OPTION_AUTOINDENT] = {
{ "autoindent", "ai" },
OPTION_TYPE_BOOL, OPTION_FLAG_NONE,
diff --git a/vis-cmds.c b/vis-cmds.c
index a266bb4..7218676 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -140,6 +140,12 @@ static bool cmd_set(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor
vis->shell = shell;
break;
}
+ case OPTION_ESCDELAY:
+ {
+ TermKey *termkey = vis->ui->termkey_get(vis->ui);
+ termkey_set_waittime(termkey, arg.i);
+ break;
+ }
case OPTION_EXPANDTAB:
vis->expandtab = arg.b;
break;