Skip to content

Commit

Permalink
vis: add :set escdelay nn option
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
martanne committed Nov 22, 2016
1 parent b56bc71 commit e9f28e9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ typedef struct {

enum {
OPTION_SHELL,
OPTION_ESCDELAY,
OPTION_AUTOINDENT,
OPTION_EXPANDTAB,
OPTION_TABWIDTH,
Expand All @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions vis-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e9f28e9

Please sign in to comment.